Skip to content

Commit

Permalink
update embedding endpoint for no wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkk12014402 committed Nov 3, 2024
1 parent ccfd127 commit 466f965
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions evals/evaluation/rag_eval/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,14 @@ 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 []
Expand Down
9 changes: 6 additions & 3 deletions evals/evaluation/rag_eval/examples/eval_multihop.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ 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 []
Expand Down

0 comments on commit 466f965

Please sign in to comment.