-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Milestone
Description
Goal
To make the ProVAI agent more robust by implementing Corrective-RAG (CRAG). This involves adding a web search tool as a fallback mechanism when the initial document retrieval fails to find relevant information.
To-Do List
- Pre-requisite: The LangGraph state machine from Issue Plan and Execute DB Migration to PostgreSQL #43 must be complete.
- Add Dependency: Add
tavily-pythontopyproject.toml. - Create Web Search Tool:
- Create a
WebSearchServicethat uses the Tavily API to perform a search and return the results as LangChainDocumentobjects. - Add a
web_searchnode to your LangGraph (graph_nodes.py).
- Create a
- Implement Document Grader Node:
- Create a
grade_documents(state)node that uses an LLM to determine if the retrieved documents are relevant to the user's question. This grader should return a simple "yes" or "no".
- Create a
- Update Graph Logic:
- Add the new
grade_documentsandweb_searchnodes to the graph. - Modify the conditional edge after the
retrievenode. If thegrade_documentsnode returns "no", the edge should route to theweb_searchnode. If "yes", it should route to thegeneratenode.
- Add the new
- Write tests for cases where web search should be triggered.
Acceptance Criteria
- When a query is asked for which there is no relevant information in the local documents, the agent correctly identifies this, performs a web search, and uses the web results to generate an answer.
- The decision-making process is clearly visible in the LangSmith trace.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels