Skip to content

feat: support Annotated[T, Field(...)] in function schema#2435

Merged
seratch merged 1 commit intoopenai:mainfrom
haasonsaas:codex/2428-code
Feb 9, 2026
Merged

feat: support Annotated[T, Field(...)] in function schema#2435
seratch merged 1 commit intoopenai:mainfrom
haasonsaas:codex/2428-code

Conversation

@haasonsaas
Copy link
Contributor

@haasonsaas haasonsaas commented Feb 7, 2026

Derived from #2428, but split docs changes out per review feedback.

  • Adds support for Annotated[T, Field(...)] on @function_tool args.
  • Includes tests in tests/test_function_schema.py.

Docs follow-up: see the companion PR from haasonsaas:codex/2428-docs (kept separate so it can be merged/released independently).

…rameters

- Preserve per-parameter Annotated metadata and extract FieldInfo when building fields
- Add _extract_field_info_from_metadata() helper; use it in normal-parameter branch
- Merge annotated Field with docstring description and optional signature default
- Add tests for required/optional constraints, string constraints, and multiple params
@haasonsaas
Copy link
Contributor Author

CI is green (lint/typecheck/tests/docs). Looks ready to merge once a maintainer has a moment.

@seratch seratch added this to the 0.8.x milestone Feb 9, 2026
@seratch seratch merged commit c96de5e into openai:main Feb 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments