Skip to content

Commit

Permalink
Merge pull request #570 from valentimarco/develop
Browse files Browse the repository at this point in the history
Fix Fastembed bug
  • Loading branch information
pieroit authored Nov 15, 2023
2 parents bb44da4 + c5c9356 commit 11b86cf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/cat/factory/custom_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ def __init__(self, url, model,max_length) -> None:


def embed_documents(self, texts: List[str]):
payload = json.dumps({"document": texts})
ret = httpx.post(f"{self.url}/embeddings/document", data=payload, timeout=None)
ret = httpx.post(f"{self.url}/embeddings/document", json={"document": texts}, timeout=None)
ret.raise_for_status()
return ret.json()

def embed_query(self, text: str) -> List[float]:
payload = json.dumps({"prompt": text})
ret = httpx.post(f"{self.url}/embeddings/prompt", data=payload, timeout=None)
ret = httpx.post(f"{self.url}/embeddings/prompt", json={"prompt": text}, timeout=None)
ret.raise_for_status()
return ret.json()

0 comments on commit 11b86cf

Please sign in to comment.