mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
chore: update Jina embedding model (#8376)
This commit is contained in:
parent
de7bc22649
commit
6f7625fa47
|
@ -18,9 +18,9 @@ class JinaProvider(ModelProvider):
|
||||||
try:
|
try:
|
||||||
model_instance = self.get_model_instance(ModelType.TEXT_EMBEDDING)
|
model_instance = self.get_model_instance(ModelType.TEXT_EMBEDDING)
|
||||||
|
|
||||||
# Use `jina-embeddings-v2-base-en` model for validate,
|
# Use `jina-embeddings-v3` model for validate,
|
||||||
# no matter what model you pass in, text completion model or chat model
|
# no matter what model you pass in, text completion model or chat model
|
||||||
model_instance.validate_credentials(model="jina-embeddings-v2-base-en", credentials=credentials)
|
model_instance.validate_credentials(model="jina-embeddings-v3", credentials=credentials)
|
||||||
except CredentialsValidateFailedError as ex:
|
except CredentialsValidateFailedError as ex:
|
||||||
raise ex
|
raise ex
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
model: jina-embeddings-v3
|
||||||
|
model_type: text-embedding
|
||||||
|
model_properties:
|
||||||
|
context_size: 8192
|
||||||
|
max_chunks: 2048
|
||||||
|
pricing:
|
||||||
|
input: '0.001'
|
||||||
|
unit: '0.001'
|
||||||
|
currency: USD
|
|
@ -56,6 +56,9 @@ class JinaTextEmbeddingModel(TextEmbeddingModel):
|
||||||
|
|
||||||
data = {"model": model, "input": [transform_jina_input_text(model, text) for text in texts]}
|
data = {"model": model, "input": [transform_jina_input_text(model, text) for text in texts]}
|
||||||
|
|
||||||
|
if model == "jina-embeddings-v3":
|
||||||
|
data["task_type"] = "retrieval.passage"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = post(url, headers=headers, data=dumps(data))
|
response = post(url, headers=headers, data=dumps(data))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user