mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-12-25 22:02:21 +00:00
Merge pull request #375 from partoneplay/main
Ollama `embedding` deprecated in favor of `embed`
This commit is contained in:
commit
96962cd243
@ -745,6 +745,9 @@ async def hf_embedding(texts: list[str], tokenizer, embed_model) -> np.ndarray:
|
||||
|
||||
|
||||
async def ollama_embedding(texts: list[str], embed_model, **kwargs) -> np.ndarray:
|
||||
"""
|
||||
Deprecated in favor of `embed`.
|
||||
"""
|
||||
embed_text = []
|
||||
ollama_client = ollama.Client(**kwargs)
|
||||
for text in texts:
|
||||
@ -754,6 +757,12 @@ async def ollama_embedding(texts: list[str], embed_model, **kwargs) -> np.ndarra
|
||||
return embed_text
|
||||
|
||||
|
||||
async def ollama_embed(texts: list[str], embed_model, **kwargs) -> np.ndarray:
|
||||
ollama_client = ollama.Client(**kwargs)
|
||||
data = ollama_client.embed(model=embed_model, input=texts)
|
||||
return data["embeddings"]
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
"""
|
||||
This is a Pydantic model class named 'Model' that is used to define a custom language model.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user