Course contentsShow
← Machine Learning and Deep Learning
Lesson 1923 of 3,53841. Structured Output and Tool CallingFree lesson

Function Schema Definition

Defining function signatures with parameters, types, descriptions, and required fields for LLM understanding.

Function Schema Definition

What you'll learn: How to define clear, structured function signatures that LLMs can understand and call correctly.

The Core Idea

When you enable function calling in an LLM, you're essentially giving it a toolkit—but the model needs an instruction manual. A function schema is that manual: a structured description that tells the LLM what each function does, what parameters it accepts, what types those parameters should be, and which ones are required.

Think of it like a job posting. You wouldn't just say "we need help"—you'd specify the role, required skills, optional qualifications, and what success looks like. Similarly, a function schema describes each tool the LLM can use with precision.

What Goes Into a Schema

A well-defined function schema typically includes:

  • Function name: A clear, descriptive identifier (e.g., get_weather)
  • Description: Plain-English explanation of what the function does
  • Parameters: Each input the function accepts
  • Parameter types: Data types like string, number, boolean, array, or object
  • Parameter descriptions: What each parameter represents
  • Required fields: Which parameters must be provided vs. optional

For example, a weather function might specify that location (string, required) is needed, while units (string, optional) defaults to Celsius.

Why This Matters

The LLM doesn't execute your functions—it reads your schema and generates a structured request to call them. Clear schemas reduce hallucinations, prevent type errors, and help the model choose the right tool for the task. Poor schemas lead to malformed calls, missing parameters, or the model avoiding your functions entirely.

Key Takeaway: Function schemas are structured blueprints that tell LLMs exactly how to interact with your tools—defining parameters, types, descriptions, and requirements ensures accurate, reliable function calls.