Skip to content

Commit

Permalink
chore: update Jina embedding model (langgenius#8376)
Browse files Browse the repository at this point in the history
  • Loading branch information
DresAaron authored and cuiks committed Sep 26, 2024
1 parent 512f2d6 commit 4cd5c22
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/core/model_runtime/model_providers/jina/jina.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def validate_provider_credentials(self, credentials: dict) -> None:
try:
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
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:
raise ex
except Exception as ex:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def transform_jina_input_text(model, text):

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:
response = post(url, headers=headers, data=dumps(data))
except Exception as e:
Expand Down

0 comments on commit 4cd5c22

Please sign in to comment.