From c5c9356e5a31e4a3b4a3d781d473bdf64501e2cb Mon Sep 17 00:00:00 2001 From: valentimarco Date: Wed, 15 Nov 2023 21:18:18 +0100 Subject: [PATCH] Fix Fastembed bug --- core/cat/factory/custom_embedder.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/cat/factory/custom_embedder.py b/core/cat/factory/custom_embedder.py index 3e595f6ed..21da5e599 100644 --- a/core/cat/factory/custom_embedder.py +++ b/core/cat/factory/custom_embedder.py @@ -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() \ No newline at end of file