chore: update Jina embedding model (#8376)

This commit is contained in:
Aaron Ji 2024-09-14 16:21:17 +08:00 committed by GitHub
parent de7bc22649
commit 6f7625fa47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -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

View File

@ -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: