partoneplay commited on
Commit
3909018
·
1 Parent(s): 0649cc6

`embedding` deprecated in favor of `embed`

Browse files
Files changed (1) hide show
  1. lightrag/llm.py +9 -0
lightrag/llm.py CHANGED
@@ -745,6 +745,9 @@ async def hf_embedding(texts: list[str], tokenizer, embed_model) -> np.ndarray:
745
 
746
 
747
  async def ollama_embedding(texts: list[str], embed_model, **kwargs) -> np.ndarray:
 
 
 
748
  embed_text = []
749
  ollama_client = ollama.Client(**kwargs)
750
  for text in texts:
@@ -754,6 +757,12 @@ async def ollama_embedding(texts: list[str], embed_model, **kwargs) -> np.ndarra
754
  return embed_text
755
 
756
 
 
 
 
 
 
 
757
  class Model(BaseModel):
758
  """
759
  This is a Pydantic model class named 'Model' that is used to define a custom language model.
 
745
 
746
 
747
  async def ollama_embedding(texts: list[str], embed_model, **kwargs) -> np.ndarray:
748
+ """
749
+ Deprecated in favor of `embed`.
750
+ """
751
  embed_text = []
752
  ollama_client = ollama.Client(**kwargs)
753
  for text in texts:
 
757
  return embed_text
758
 
759
 
760
+ async def ollama_embed(texts: list[str], embed_model, **kwargs) -> np.ndarray:
761
+ ollama_client = ollama.Client(**kwargs)
762
+ data = ollama_client.embed(model=embed_model, input=texts)
763
+ return data["embeddings"]
764
+
765
+
766
  class Model(BaseModel):
767
  """
768
  This is a Pydantic model class named 'Model' that is used to define a custom language model.