feat: Embedding working again, have next steps

This commit is contained in:
2026-03-05 17:30:02 +00:00
parent 448024dca3
commit d162aa59dc
3 changed files with 9 additions and 4 deletions
+3 -1
View File
@@ -10,7 +10,7 @@ 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_VERSION}embeddings"
self.model = model
self.batch_size = batch_size
@@ -18,11 +18,13 @@ class LocalLMEmbeddings(Embeddings):
"""Handles the actual HTTP POST to the local server."""
payload = {"model": self.model, "input": input_texts}
try:
# print(f'payload: {payload}')
response = requests.post(
self.url, json=payload, timeout=120
) # Longer timeout for batches
response.raise_for_status()
data = response.json()
# print(data)
return [item["embedding"] for item in data["data"]]
except Exception as e:
print(f"❌ Batch request failed: {e}")