Skip to content

Commit

Permalink
updated async
Browse files Browse the repository at this point in the history
  • Loading branch information
sreyakumar committed Nov 1, 2024
1 parent 97bac7f commit b76a037
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion evaluations/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ def langsmith_app(inputs):
langsmith_app, # Your AI system
data=dataset_name, # The data to predict and grade over
evaluators=[evaluator], # The evaluators to score the results
experiment_prefix="metadata-chatbot-0.0.49", # A prefix for your experiment names to easily identify them
experiment_prefix="metadata-chatbot-0.0.51", # A prefix for your experiment names to easily identify them
)
22 changes: 11 additions & 11 deletions src/metadata_chatbot/agents/async_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from langchain_core.documents import Document
from langgraph.graph import END, StateGraph, START
from metadata_chatbot.agents.docdb_retriever import DocDBRetriever
from metadata_chatbot.agents.agentic_graph import datasource_router, query_retriever, query_grader, filter_generation_chain, doc_grader, rag_chain, db_rag_chain
from metadata_chatbot.agents.agentic_graph import datasource_router, query_retriever, filter_generation_chain, doc_grader, rag_chain, db_rag_chain

logging.basicConfig(filename='async_workflow.log', level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode="w")

Expand Down Expand Up @@ -80,17 +80,17 @@ async def filter_generator_async(state):

query = state["query"]

result = await query_grader.ainvoke({"query": query})
query_grade = result.binary_score
logging.info(f"Database needs to be further filtered: {query_grade}")
# result = await query_grader.ainvoke({"query": query})
# query_grade = result.binary_score
# logging.info(f"Database needs to be further filtered: {query_grade}")

if query_grade == "yes":
result = await filter_generation_chain.ainvoke({"query": query})
filter = result.filter_query
logging.info(f"Database will be filtered using: {filter}")
return {"filter": filter, "query": query}
else:
return {"filter": None, "query": query}
result = await filter_generation_chain.ainvoke({"query": query})
filter = result.filter_query

logging.info(f"Database will be filtered using: {filter}")
return {"filter": filter, "query": query}
# else:
# return {"filter": None, "query": query}

async def retrieve_async(state):
"""
Expand Down

0 comments on commit b76a037

Please sign in to comment.