vendor_connectors.ai_tools
AI tool definition helpers for Vercel AI SDK compatibility.
This module provides Pydantic-based helpers to define AI tool schemas that are compatible with the Vercel AI SDK and other modern AI frameworks.
Module Contents
Section titled “Module Contents”Functions
Section titled “Functions”get_pydantic_schema | Generate a Vercel AI SDK-compatible JSON schema from a Pydantic model. |
|---|
vendor_connectors.ai_tools.get_pydantic_schema(model: type[pydantic.BaseModel]) → dict[str, Any]
Section titled “vendor_connectors.ai_tools.get_pydantic_schema(model: type[pydantic.BaseModel]) → dict[str, Any]”Generate a Vercel AI SDK-compatible JSON schema from a Pydantic model.
This function removes the top-level ‘title’ and ‘description’ fields, which are often redundant and not used by AI frameworks. Parameter-level ‘description’ fields are preserved as they are crucial for the AI to understand the tool’s inputs.
Args: model: The Pydantic model class.
Returns: A JSON schema dictionary.