Skip to content

Replace ai.Tool.args with spec and config#172

Merged
anbuzin merged 3 commits into
mainfrom
rework-tool-param-typing
Jun 19, 2026
Merged

Replace ai.Tool.args with spec and config#172
anbuzin merged 3 commits into
mainfrom
rework-tool-param-typing

Conversation

@anbuzin

@anbuzin anbuzin commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Turns out ai.Tool.args was trying to carry two unrelated things: user-defined tools' param spec, and provider-side tools' request-wise configuration. Also, typing didn't quite work anyway.

This PR splits ai.Tool.args into ToolSpec (param spec and description used by server-side tools) and ToolConfig. The latter can now also be used by server-side tools to set e.g. retry policy or other execution-related config.

It also deletes provider-specific dataclasses and only leave factories for built-in tools.

Delete provider-specific dataclasses and only leave factories for
built-in tools.
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-python Ready Ready Preview, Comment Jun 19, 2026 2:30am

@vercel vercel Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Docs/skill examples reference the removed ai.tools.FunctionToolArgs and deleted args= field on ai.Tool, so copying them raises AttributeError and a pydantic validation error.

Fix on Vercel

@anbuzin anbuzin changed the title Split Tool.args into tool spec and tool config Replace ai.Tool.args with spec and config Jun 16, 2026
@anbuzin anbuzin requested a review from msullivan June 16, 2026 15:28
Comment thread src/ai/types/tools.py
Comment thread src/ai/providers/openai/tools.py Outdated
@anbuzin anbuzin merged commit 9cd2972 into main Jun 19, 2026
7 checks passed
@anbuzin anbuzin deleted the rework-tool-param-typing branch June 19, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants