Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
yoomlam committed Apr 5, 2024
1 parent bebbf9d commit 7814691
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion 02-household-queries/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def create_retriever(vectordb):
retrieve_k = int(os.environ.get("RETRIEVE_K", "1"))
return vectordb.as_retriever(search_kwargs={"k": retrieve_k})


def retrieval_call(llm, vectordb, question):
# Create the retrieval chain
template = """
Expand Down Expand Up @@ -39,4 +40,3 @@ def retrieval_call(llm, vectordb, question):
print(d)
print()
return response

18 changes: 12 additions & 6 deletions 02-household-queries/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def load_training_json():
# print(json.dumps(json_data, indent=2))
return json_data


def evaluate_retrieval():
qa = load_training_json()
results = []
Expand All @@ -89,13 +90,18 @@ def evaluate_retrieval():
# print(f" Desired CARDS : {guru_cards}")

retrieval = retriever.invoke(question)
results.append({
"question": question,
"guru_cards": guru_cards,
"retrieved_cards": [doc.metadata['source'] for doc in retrieval]
})
results.append(
{
"id": qa_dict["id"],
"question": question,
"guru_cards": guru_cards,
"retrieved_cards": [doc.metadata["source"] for doc in retrieval],
}
)
print(retriever)
print("EVALUATION RESULTS:\n", "\n".join([json.dumps(r, indent=2) for r in results]))
print(
"EVALUATION RESULTS:\n", "\n".join([json.dumps(r, indent=2) for r in results])
)


print("""
Expand Down

0 comments on commit 7814691

Please sign in to comment.