Find answers from the community

Home
Members
nickisyourfan
n
nickisyourfan
Offline, last seen 4 months ago
Joined November 1, 2024
Hello! Not sure if I am in the right spot but looking for some help.

I have created a ReAct agent that has two tools. One FunctionTool and one QueryEngineTool.

My function tool is async so I am using await agent.achat(prompt) to execute the operation. This works great.
My QueryEngineTool does not like this, and only works with agent.chat(prompt)

If I use agent.chat, the async function tool works, but response is delivered after the chat responds since it is not async.

Plain Text
async_tool = FunctionTool.from_defaults(
  async_fn=lambda a: execute(a, ...otherstuff),
  name="myfirsttool",
  description="calls an API async"
)
index = load_index_from_storage(storage_context=storage_context)
query_engine = index.as_query_engine()
sync_tool = QueryEngineTool.from_defaults(
  query_engine=query_engine,
  name="google gemini indexed",
  description="Indexing from google gemini seems to throw error here when doing achat"
)

agent = ReActAgent.from_tools(llm=llm, tools=[sync_tool, async_tool])


The error occurs when using the sync tool with the achat function.

Error:

Plain Text
embeddings.0 Input should be a valid list [type=list_type, input_value=<coroutine object GeminiEm...dings at 0xec57134d34c0> input_type=coroutine]


Thanks for taking a look at the psuedo code above and any guidance!
5 comments
n
L