Well, you need to setup an agent, but pretty much
from llama_index.agent import OpenAIAgent
from llama_index.tools import BaseTool, FunctionTool, QueryEngineTool
def multiply(a: int, b: int) -> int:
"""Multiple two integers and returns the result integer"""
return a * b
# uses docstring as description and fn_name as name
multiply_tool = FunctionTool.from_defaults(fn=multiply)
query_engine_tool = QueryEngineTool.from_defaults(query_engine, name=name, description=description)
agent = OpenAIAgent.from_tools([query_engine_tool, multiply_tool])
agent.chat("Hello!")
# or, you can force a function to be called at least once
agent = OpenAIAgent.from_tools([query_engine_tool, multiply_tool], function_call="name to call every time")