lance_rag_task
langroid/agent/special/lance_rag/lance_rag_task.py
The LanceRAGTaskCreator.new() method creates a 3-Agent system that uses this agent. It takes a LanceDocChatAgent instance as argument, and adds two more agents: - LanceQueryPlanAgent, which is given the LanceDB schema in LanceDocChatAgent, and based on this schema, for a given user query, creates a Query Plan using the QueryPlanTool, which contains a filter, a rephrased query, and a dataframe_calc. - QueryPlanCritic, which is given the LanceDB schema in LanceDocChatAgent, and gives feedback on the Query Plan and Result using the QueryPlanFeedbackTool.
The LanceRAGTaskCreator.new() method sets up the given LanceDocChatAgent and QueryPlanCritic as sub-tasks of the LanceQueryPlanAgent's task.
Langroid's built-in task orchestration ensures that: - the LanceQueryPlanAgent reformulates the plan based on the QueryPlanCritics's feedback, - LLM deviations are corrected via tools and overrides of ChatAgent methods.
LanceRAGTaskCreator
¶
new(agent, interactive=True)
staticmethod
¶
Add a LanceFilterAgent to the LanceDocChatAgent, set up the corresponding Tasks, connect them, and return the top-level query_plan_task.