get_weather
functionget_weather
function as a tool.
Here’s how we’ll do it:
get_weather
function.get_weather
functionagent/main.py
). Then, copy and paste the get_weather
function below into it:
get_weather
function by adding the tools
definition below to your LLM
response handler:
tools
definition above by following OpenAI’s Function
Calling guide.
Important: The function definition you include in your LLM response handler must exactly match the function signature of the corresponding function. In other words, the function name (e.g.get_weather
above) and the parameter name(s) (e.g.location
) must match. Any mismatch in the function name or parameter names can cause the tool call to fail or be ignored by the LLM.
get_weather
function to the tools
array in your Agent
:
get_weather
) and its parameters (e.g. "location": "New York City"
).