Find answers from the community

Updated 2 months ago

Issue with agents decisions in llama-index==0.11.5

Issue with Agents decisions in llama-index==0.11.5.
Hello everyone,

I am currently working on building an agent that can execute queries in a database OR perform RAG through several documents. The agent is functional, but I am struggling with enhancing the decision-making process for choosing whether to query the database or perform RAG with documents. Any advice or suggestions on how to improve this decision-making logic would be greatly appreciated. Thank you!
My db is neo4j and im executing cypher queries in one side. Also my embeddings from text are located in another neo db.
Summary of the code:
Plain Text
# Filter all the FunctionTools from a module
    tools = [getattr(module, attr_name) for attr_name in dir(module)
        if isinstance(getattr(module, attr_name), FunctionTool)]

    query_engine_tool = QueryEngineTool(query_engine=query_engine, metadata=ToolMetadata(
    name='get_document_info',
    description=(f"Useful for extract information from documents.")))

    tools.append(query_engine_tool )

    agent_worker = FunctionCallingAgentWorker.from_tools(
        tools,
        verbose=True,
        system_prompt=system_prompt,
    )
    agent = AgentRunner(agent_worker)
    agent.chat(query)
d
L
2 comments
@Logan M
Currently, the agent has to choose between all the Cypher query functions and the RAG document function. I would like to know if there is an option for the agent to first decide between using RAG documents or Cypher queries. If it chooses Cypher queries, it should then select from a list of FunctionTools.

Any advice on how to implement this decision-making process would be greatly appreciated. Thank you!
Have you looked into implementing this more from-sctrach using workflows? There are lower-level functions on the LLM that allow you to do single-pass function calling, which may help quite a bit with implementing more custom workflows

Not sure if you've seen workflows yet
Workflow Docs: https://docs.llamaindex.ai/en/stable/module_guides/workflow/#workflows
Agent Example: https://docs.llamaindex.ai/en/stable/examples/workflow/function_calling_agent/
All Examples: https://docs.llamaindex.ai/en/stable/module_guides/workflow/#examples
Add a reply
Sign up and join the conversation on Discord