From aef0cf5d3e2767a45edcdab5d924d0d3b0abcbea Mon Sep 17 00:00:00 2001 From: lkk <33276950+lkk12014402@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:28:19 +0800 Subject: [PATCH] update embedding endpoint for no wrapper. (#187) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- evals/evaluation/rag_eval/evaluator.py | 6 +++--- evals/evaluation/rag_eval/examples/eval_multihop.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/evals/evaluation/rag_eval/evaluator.py b/evals/evaluation/rag_eval/evaluator.py index 85d7af81..b1e9efed 100644 --- a/evals/evaluation/rag_eval/evaluator.py +++ b/evals/evaluation/rag_eval/evaluator.py @@ -155,11 +155,11 @@ def post_process(self, result): def get_retrieved_documents(self, data, arguments): query = self.get_query(data) - data = {"text": query} + data = {"inputs": query} headers = {"Content-Type": "application/json"} - response = requests.post(arguments.embedding_endpoint, data=json.dumps(data), headers=headers) + response = requests.post(arguments.tei_embedding_endpoint + "/embed", data=json.dumps(data), headers=headers) if response.ok: - embedding = response.json()["embedding"] + embedding = response.json()[0] else: print(f"Request for embedding failed due to {response.text}.") return [] diff --git a/evals/evaluation/rag_eval/examples/eval_multihop.py b/evals/evaluation/rag_eval/examples/eval_multihop.py index 7df77746..3c81866c 100644 --- a/evals/evaluation/rag_eval/examples/eval_multihop.py +++ b/evals/evaluation/rag_eval/examples/eval_multihop.py @@ -42,11 +42,11 @@ def get_reranked_documents(self, query, docs, arguments): return [] def get_retrieved_documents(self, query, arguments): - data = {"text": query} + data = {"inputs": query} headers = {"Content-Type": "application/json"} - response = requests.post(arguments.embedding_endpoint, data=json.dumps(data), headers=headers) + response = requests.post(arguments.tei_embedding_endpoint + "/embed", data=json.dumps(data), headers=headers) if response.ok: - embedding = response.json()["embedding"] + embedding = response.json()[0] else: print(f"Request for embedding failed due to {response.text}.") return []