Skip to content

docs: clarify Field description handling for variadic tool parameters - #4954

Closed
subhashpolisetti wants to merge 1 commit into
openai:mainfrom
subhashpolisetti:docs/variadic-field-descriptions
Closed

subhashpolisetti wants to merge 1 commit into
openai:mainfrom
subhashpolisetti:docs/variadic-field-descriptions

Conversation

@subhashpolisetti

Copy link
Copy Markdown
Contributor

Summary

This pull request clarifies how a Pydantic Field description is handled for variadic tool parameters.

The section is titled "Constraining and describing arguments with Pydantic Field" and states that Field adds constraints and descriptions to tool arguments. The variadic paragraph then mentions only constraints, so the wording reads as though Field(description=...) also reaches a variadic parameter. It does not: on v0.22.2, *scores: Annotated[int, Field(description="Exam scores", ge=0, le=100)] advertises the constraints on each collected value and no parameter description.

The added sentence states that the SDK ignores a description passed to Field(...) on a variadic parameter and names the two supported ways that description is taken, following the guidance given when #4951 was closed.

Test plan

  • Verified on v0.22.2 that *scores: Annotated[int, "Exam scores", Field(ge=0, le=100)] and a docstring entry alongside Field(ge=0, le=100) each produce the parameter description together with the per-value constraints, and that Field(description=...) alone produces no description.
  • make build-docs completes with no errors and no new warnings. Generated pages under docs/ja, docs/ko, and docs/zh are untouched.
  • This is a docs-only change, so the SDK verification stack does not apply; make build-docs is the applicable check.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

The section covers constraining and describing arguments with Field, and the
variadic paragraph mentions only constraints, so the wording reads as though a
Field description also reaches a variadic parameter.

State that the SDK does not read Field(description=...) for a variadic
parameter and name the two supported ways to supply that description.
@seratch seratch added the documentation Improvements or additions to documentation label Sep 11, 2026
@seratch seratch mentioned this pull request Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 10 days with no activity.

@jbeckwith-oai

Copy link
Copy Markdown
Collaborator

Thank you, @subhashpolisetti, for identifying this documentation gap, writing the original clarification and example, and verifying the supported alternatives.

We have carried your contribution forward in #5223, with the description guidance in its own paragraph and explicit docstring precedence. The replacement PR credits you prominently, and its commit includes you as a co-author using the authorship from your original commit.

Closing this draft in favor of #5223 so we can take the clarification through review there. Thank you again for the investigation and contribution.

jbeckwith-oai added a commit that referenced this pull request Sep 28, 2026
* docs: clarify descriptions for variadic tool parameters

Explain the existing Field description limitation and document supported
docstring and Annotated descriptions, including their precedence.

Based on Subhash Polisetti's original clarification and example in #4954.

Co-authored-by: subhash polisetti <subhashr161347@gmail.com>

* docs: explain non-strict variadic keyword tool arguments

---------

Co-authored-by: subhash polisetti <subhashr161347@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants