Handle multiple response formats in OllamaEmbeddingEngine
The OllamaEmbeddingEngine is compatible with OpenAI
This commit is contained in:
parent
1e531385a6
commit
72c20c256d
1 changed files with 4 additions and 1 deletions
|
|
@ -124,7 +124,10 @@ class OllamaEmbeddingEngine(EmbeddingEngine):
|
||||||
self.endpoint, json=payload, headers=headers, timeout=60.0
|
self.endpoint, json=payload, headers=headers, timeout=60.0
|
||||||
) as response:
|
) as response:
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
return data["embeddings"][0]
|
if "embeddings" in data:
|
||||||
|
return data["embeddings"][0]
|
||||||
|
else:
|
||||||
|
return data["data"][0]["embedding"]
|
||||||
|
|
||||||
def get_vector_size(self) -> int:
|
def get_vector_size(self) -> int:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue