Find answers from the community

Updated 8 months ago

React

Hey @Logan M hope you are well. I’m trying to learn the ReACt agent. It takes in a query engine as a tool. However, is there a way to feed in the DAG for a query pipeline instead? The query pipeline has a .run method, but the agent tool query engine expects .query. I cannot figure out how to connect the two. Thoughts or examples somewhere?
L
c
2 comments
You can just shove the query pipeline into a function tool

Plain Text
from llama_index.core.tools import FunctionTool

def query(inp: str) -> str:
  """Useful for answering questions about X."""
  output = pipeline.run(...)
  return str(output['response'])

tool = FunctionTool.from_defaults(fn=query)


Here the function name and docstring are used as the tool name and tool description

You can also go much more low-level, in this notebook example
https://docs.llamaindex.ai/en/stable/examples/agent/agent_runner/query_pipeline_agent/?h=query+pipeline+tool
@Logan M ohhhh thanks!
Add a reply
Sign up and join the conversation on Discord