little-kite-91953
10/15/2025, 7:06 PMtall-airline-16756
10/15/2025, 7:06 PMtall-airline-16756
10/15/2025, 7:07 PM@function_tool decorator in LiveKit! It’s a handy feature that lets Python-based AI agents share their methods as callable tools for language models (LLMs). Behind the scenes, it uses Python's inspect module to understand function signatures and type hints, then creates a Pydantic model that’s converted into a JSON Schema so LLMs can work with it smoothly. By default, it uses a legacy schema, but you also have the option to enable strict mode for a more precise schema adherence.
Strict mode is really helpful because it makes sure the LLM follows the defined parameters exactly. It does this by setting additionalProperties to false, marking all required fields clearly, and managing optional fields with null types. This way, it boosts reliability by preventing the LLM from making up or skipping parameters and helps catch type mismatches early on.
If you’d like to try strict mode, you can use the build_strict_openai_schema function, which tweaks the JSON schema to meet OpenAI’s strict mode requirements. Feel free to ask if you want more details or some examples—I’m here to help!
Sources: docs/index.yaml | livekit-agents/livekit/agents/voice/agent.py | Agents v0.x migration guide - Python | LiveKit Docslittle-kite-91953
10/15/2025, 7:09 PMtall-airline-16756
10/15/2025, 7:10 PM