I construct my tools by doing the following:
# create a set of tools on top of the query engine
query_engine_tools = [
QueryEngineTool(
query_engine=recursive_query_engine,
metadata=ToolMetadata(
name = 'document_type_finder',
description = (
'''
This tool finds the type of document and outputs the answer.
This tool will look for obvious features in the document such as words like "invoice" or "tax invoice" for invoice and words like "purchase order", "sales order" for purchase order.
Finally, this tool only outputs answer as "invoice" or "purchase order"
'''
)
)
),
QueryEngineTool(
query_engine=recursive_query_engine,
metadata=ToolMetadata(
name = 'document_origin_finder',
description = (
'''
This tool finds the country of origin of the document
This finder will first identify the country of origin of the document sender by looking into its company name, address, or any other relevant information to derive the origin of country.
Finally, this tool format the answer following to ISO 3166-1 alpha-3 and outputs it.
'''
)
)
)
]
# create a RAG ReAct QueryEngineTool agent
agent = ReActAgent.from_tools(tools=query_engine_tools, llm=llm, verbose=True)
response = agent.chat(
'''
What is the document type and origin? Use any of the tools provided to you.
'''
)
I am not sure why but the agent thought process and answer is always about no document provided.
# output
>>>Thought: The user has not provided the document text for analysis. I need to ask for the document text to proceed with the analysis using the appropriate tool.
Answer: Could you please provide the text of the document you would like me to analyze for its type and origin?