Skip to content

Commit 8476bd0

Browse files
Merge remote-tracking branch 'upstream/v2' into variable_aggregation_support_dict
2 parents 417a8ce + 897eb61 commit 8476bd0

File tree

1 file changed

+4
-6
lines changed
  • apps/models_provider/impl/ollama_model_provider/model

1 file changed

+4
-6
lines changed

apps/models_provider/impl/ollama_model_provider/model/embedding.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def embed_documents(self, texts: List[str]) -> List[List[float]]:
3131
Returns:
3232
List of embeddings, one for each text.
3333
"""
34-
instruction_pairs = [f"{text}" for text in texts]
35-
embeddings = self._embed(instruction_pairs)
36-
return embeddings
34+
return self._client.embed(
35+
self.model, texts, options=self._default_params, keep_alive=self.keep_alive
36+
)["embeddings"]
3737

3838
def embed_query(self, text: str) -> List[float]:
3939
"""Embed a query using a Ollama deployed embedding model.
@@ -44,6 +44,4 @@ def embed_query(self, text: str) -> List[float]:
4444
Returns:
4545
Embeddings for the text.
4646
"""
47-
instruction_pair = f"{text}"
48-
embedding = self._embed([instruction_pair])[0]
49-
return embedding
47+
return self.embed_documents([text])[0]

0 commit comments

Comments
 (0)