Skip to content

Commit 3a8e2e0

Browse files
committed
fix(text_embedding): pass input_type to distinguish between document and query
Signed-off-by: Yuichiro Utsumi <utsumi.yuichiro@fujitsu.com>
1 parent aaba888 commit 3a8e2e0

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

python/dify_plugin/core/entities/plugin/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
OnlineDriveBrowseFilesRequest,
1010
OnlineDriveDownloadFileRequest,
1111
)
12-
from dify_plugin.entities.model import ModelType
12+
from dify_plugin.entities.model import (
13+
EmbeddingInputType,
14+
ModelType,
15+
)
1316
from dify_plugin.entities.model.message import (
1417
AssistantPromptMessage,
1518
PromptMessage,
@@ -200,6 +203,7 @@ class ModelInvokeTextEmbeddingRequest(PluginAccessModelRequest):
200203
action: ModelActions = ModelActions.InvokeTextEmbedding
201204

202205
texts: list[str]
206+
input_type: EmbeddingInputType | None = EmbeddingInputType.DOCUMENT
203207

204208

205209
class ModelGetTextEmbeddingNumTokens(PluginAccessModelRequest):

python/dify_plugin/core/plugin_executor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def invoke_text_embedding(self, session: Session, data: ModelInvokeTextEmbedding
215215
data.credentials,
216216
data.texts,
217217
data.user_id,
218+
data.input_type,
218219
)
219220
else:
220221
raise ValueError(f"Model `{data.model_type}` not found for provider `{data.provider}`")

0 commit comments

Comments
 (0)