When a user asks the LLM to perform an action, e.g., get the current weather or current stock market details, the LLM cannot get this information on its own. It needs some functionality or tools along with a description of when to call these tools/functionality.
How is it working?
The LLM analyzes the query to find out whether it is related to any of the tools and their descriptions.
If so, the LLM will suggest the tool along with the parameters to the agent/external logic. The external logic will perform the action and send the result back to the LLM.
The LLM reads the result and generates the structured output.
Suppose the tool call is not matched; the LLM will derive the answer from its own knowledge. If we give an ambiguous description, the LLM may not generate the output properly.
The description for the tool calls must be proper so that the LLM can semantically identify the tool and match the arguments.
example description
"""
Add up two integer numbers.
This function simply wraps the `+` operator, and does not
do anything interesting, except for illustrating what is
the docstring of a very simple function.
Parameters
----------
num1 : int
First number to add
num2 : int
Second number to add
Returns
-------
int
The sum of `num1` and `num2`
See Also
--------
subtract : Subtract one integer from another
Examples
--------
>>> add(2, 2)
4
>>> add(25, 0)
25
>>> add(10, -10)
0
"""

Top comments (0)