Find answers from the community

Updated 3 months ago

FunctionTool

In addition to a list query_engine_tools that are using RAG, I also have 20-30 python functions that implement complex logics to answer user query to a chatbot. I am not 100% clear how to put these together. One thing I found in documentation was using FunctionTool. Can I send a list of FunctionTool and QueryEngineTool to RouterQueryEngine ? Any examples?
L
m
15 comments
Right now, function tools can only be used with agents (in addition to query engine tools)
Thanks. I'll try it today itself and let you know the feedback! Apprecite it.
Attachment
image.png
I am trying to use FuncTools without OpenAI agent. I wish to use Llama 2 instead.
do you know how to get around this?
Attachment
image.png
@Logan M is it possible to do something like this or do I have to use openai agent with functools?
You have to use either an openai agent or react agent yea
Maybe a PR could generalize this a little better
Basically, i m tryin to have a list of functool and other query engine tools... all being selectively chosen using a Router
I'll check reactagent
If you are using openai, I highly recommend the openai agent. Otherwise, yea react agent wouldn't be too bad either.

Like I mentioned too, a but of a refactor could extend the router engine to work for this, if you had time

Just need to modify it to work with any tool rather than specifically query engines

https://github.com/jerryjliu/llama_index/blob/d59ed48a08a5e5fd9d3361250beeb9fbfaf8cd50/llama_index/query_engine/router_query_engine.py#L99
sure... i'll check this.. thanks
i m still very new to Llamaindex... just reading all the help docs and starting to build things...

I read the code you shared, one way could be to define self._query_engine in Functool and define query function in Functool which jsut sends the response by calling the function set in constructor

https://github.com/jerryjliu/llama_index/blob/d59ed48a08a5e5fd9d3361250beeb9fbfaf8cd50/llama_index/query_engine/router_query_engine.py#L145
then we don't have to touch RouterQueryEngine... FuncTool will pretty much look like any other query engine
I see both query-engine and functiontool can be adjusted as LangChain tool.. so that's probably another way for now
Add a reply
Sign up and join the conversation on Discord