feat: ✨ Embedding working again, have next steps
This commit is contained in:
+3
-1
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user