from llama_index.tools import FunctionTool def add(a: int, b: int) -> int: """Useful for adding two numbers.""" return a + b tool = Function_tool.from_defaults(fn)
from_defaults()
call as well. The type hints are also important def agent(input_str: str) -> str: """Useful for asking information about X.""" response = agent.chat(input_str) return str(response)