Learn how to use function calling with IronaAI to enable models to interact with external tools and APIs.
IronaAI supports function calling, allowing language models to interact with external tools, APIs, or custom functions. This feature enhances the model’s capabilities by enabling actions such as retrieving real-time data, performing computations, or accessing databases.
Retrieve real-time or external data (e.g., weather info, stock prices)
Perform computations not natively supported by the model
Interact with APIs or databases
Execute custom functions in your application
This is ideal for building interactive agents, automating workflows, or integrating AI into systems.
Defining tools
Tools can be defined in multiple ways:
As dictionaries: Specify the tool’s name, description, and parameters.
As LangChain tools: Integrate tools from the LangChain library.
# Bind the tool to the clientclient = IronaAI()completion_with_tools = client.bind_tools([multiply])response = client.completion_with_tools( messages=[{"role": "user", "content": "What's the weather like in San Francisco?"}], tools=tools, tool_choice="auto")
The response includes a tool_calls attribute if the model opts to call a tool.