update accuracy embedding endpoint for no wrapper (#1056)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
lkk
2024-11-04 09:18:49 +08:00
committed by GitHub
parent 5eb3d2869f
commit 3372b9d480

View File

@@ -41,11 +41,11 @@ class MultiHop_Evaluator(Evaluator):
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 []