refactor: 🔨 Mostly working Ollama migration, few tweaks left

This commit is contained in:
2026-05-16 09:11:21 +01:00
parent 968b98f6a2
commit fc08f1a814
6 changed files with 43 additions and 37 deletions
+3 -2
View File
@@ -10,7 +10,7 @@ API_VERSION = CFG["api"]["api_version"]
class LocalLMEmbeddings(Embeddings):
def __init__(self, model: str, base_url: str = API_BASE, batch_size: int = 32):
self.url = f"{base_url}/{API_VERSION}embeddings"
self.url = f"{base_url}/api/embed"
self.model = model
self.batch_size = batch_size
@@ -22,10 +22,11 @@ class LocalLMEmbeddings(Embeddings):
response = requests.post(
self.url, json=payload, timeout=120
) # Longer timeout for batches
# print(response)
response.raise_for_status()
data = response.json()
# print(data)
return [item["embedding"] for item in data["data"]]
return data["embeddings"]
except Exception as e:
print(f"❌ Batch request failed: {e}")
# Returning empty lists to maintain index integrity if needed,