File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
apps/models_provider/impl/ollama_model_provider/model Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments