ollama-python
ollama-python copied to clipboard
types: allow additional properties in tool function schemas
Summary
This change is part of ollama/ollama#11444 and related to ollama/ollama#11448 where the server simplified ToolFunction.Parameters from a structured schema to json.RawMessage for better flexibility and performance.
Problem: The previous structured approach was limiting JSON schema flexibility and preventing support for advanced tooling scenarios that require complete schema definitions.
What changed
- Added
extra='allow'toTool.Function.ParametersandPropertymodel configurations - Enables Pydantic models to accept additional fields beyond explicitly defined ones
Why
- Supports complex JSON schemas with custom properties when sending tool definitions to Ollama API
- Resolves validation errors for schemas containing additional fields like validation rules, examples, or vendor extensions
- Improves compatibility with rich tool schema definitions
Related
- https://github.com/ollama/ollama/issues/11444
- https://github.com/ollama/ollama/pull/11448