Model Name | Tier |
---|---|
gpt-4o | High |
gpt-4-turbo | High |
gpt-4 | High |
gpt-4-eu | High |
gpt-4o-mini | High |
gpt-4o-mini-eu | High |
mistral-8x7b | High |
claude-3.5-sonnet | High |
claude-3.5-sonnet-v2 | High |
claude-3-haiku | High |
claude-3-opus | High |
claude-3-sonnet | High |
llama-3.1-8b | High |
llama-3.3-70b | High |
llama-3-8b | High |
llama-3-70b | High |
project_id
used here is a dummy id.addition
and division
. At the end of this example, we will show you why you need to define simple arithmetic functions when dealing with something related to LLMs and crunching numbers.
Output without using tools
371410150275.0
, but the answer was 355140529450725.56
. They do not match, and hence, we get an impression of the LLM hallucinating when the number gets too large. Letβs do the same thing, but we will use function calling this time.
function
here). Then, we define the properties of the function, like name
, description
, parameters
(which are function arguments), their type (whether the parameter is an integer or a string or some object), and all the required parameters of the function.
Output
division
operation first and then addition
.
Now we parse this output and then call the functions (as mentioned by the LLM) on by one and gather our results.
messages
list with the role
of assistant
.tool_calls
and then call the function, get the result, take all three values, and fit them into our prompt.user
in our existing messages
list.messages
that we can use it in our second pass.
Output
Output
355140529450725.56
insert_tool_messages
so that your toolcalling workflow becomes easier. Here is your final code:
Final Code