LLM Learning Hub

workspace/llm-course/home

Function Arguments

Function arguments are the JSON object the LLM generates to fill the parameters of a selected tool, matching the tool's schema so the runtime can execute the function with valid inputs.

What is Function Arguments?

Function arguments are the JSON object the LLM generates to fill the parameters of a selected tool, matching the tool's schema so the runtime can execute the function with valid inputs.

Function arguments are the JSON object the LLM generates to fill the parameters of a selected tool, matching the tool's schema so the runtime can execute the function with valid inputs.

Where is it used?

OpenAI returns `tool_calls[0].function.arguments` as a JSON string; `json.loads` parses it before calling the actual Python function; LangChain `ToolCallingAgent` does this automatically.

How to build it

Parse `args = json.loads(tool_call.function.arguments)`, validate with `WeatherInput(**args)` via Pydantic, and call `tool.func(**validated.model_dump())` to execute the function.