LLM Learning Hub

workspace/llm-course/home

Tool Definitions

Tool definitions are JSON-Schema objects describing each tool's name, purpose, and parameter types, provided to the LLM so it knows what tools are available and how to call them correctly.

What is Tool Definitions?

Tool definitions are JSON-Schema objects describing each tool's name, purpose, and parameter types, provided to the LLM so it knows what tools are available and how to call them correctly.

Tool definitions are JSON-Schema objects describing each tool's name, purpose, and parameter types, provided to the LLM so it knows what tools are available and how to call them correctly.

Where is it used?

OpenAI `tools=[{"type": "function", "function": {...}}]`, Anthropic `tools=[{"name": ..., "input_schema": ...}]`, and LangChain `.bind_tools()` all use schema-based definitions.

How to build it

Write a Pydantic `class WeatherInput(BaseModel): city: str`, derive the JSON schema with `WeatherInput.model_json_schema()`, and pass it in the `tools` parameter of `client.chat.completions.create`.