Skip to content

Move response formatting to root packages - #1345

Merged
Quim Muntal (qmuntal) merged 2 commits into
mainfrom
move-response-format-packages
Nov 3, 2026
Merged

Quim Muntal (qmuntal) merged 2 commits into
mainfrom
move-response-format-packages

Conversation

@qmuntal

Copy link
Copy Markdown
Member

Summary

  • Move shared response-format descriptions and JSON schema helpers into top-level packages, removing the agent dependency from formatting and function tools.
  • Preserve the previous APIs with deprecated type aliases and forwarding wrappers.
  • Update SDK/example imports and add compatibility regression tests.

Validation

  • Targeted formatting, agent, tool, and provider tests pass against updated main; the structured-output example compiles. Live Foundry integration tests were disabled.
  • go vet passes for affected packages.
  • Dependency checks confirm formatting and function tools no longer depend on the agent package.
  • Scoped lint passes for new packages and changed files. Full lint still reports pre-existing formatting issues in untouched files.

Extract shared response formats and JSON schema helpers from agent. Keep deprecated aliases and forwarding wrappers, update SDK and example consumers, and add compatibility coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner November 2, 2026 13:47
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:47
@github-actions github-actions Bot added area:agent Changes files in the agent area area:examples Changes files in the examples area area:provider Changes files in the provider area area:provider/anthropic Changes files in the provider / anthropic area area:provider/foundry Changes files in the provider / foundry area area:provider/gemini Changes files in the provider / gemini area area:provider/openai Changes files in the provider / openai area area:tool Changes files in the tool area labels Nov 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the response-format package migration.

No open issues 🎉

What changed in this PR

Moves shared response-format types and JSON schema helpers into root packages so formatting and function tools no longer depend on agent, while preserving existing APIs through deprecated aliases and forwarding wrappers.

Changes:

  • Introduces root format and format/jsonformat packages.
  • Migrates agent, provider, tool, and example code to the new packages.
  • Relocates formatting tests and adds legacy API compatibility regression tests.
File Description
tool/​functool/​func.go Uses root JSON formatting helpers.
provider/​openaiprovider/​strict_schema_test.go Updates schema-test imports.
provider/​openaiprovider/​responses.go Uses root formatting types and helpers.
provider/​openaiprovider/​responses_test.go Updates Responses API test imports.
provider/​openaiprovider/​chat.go Uses root formatting types and helpers.
provider/​openaiprovider/​chat_test.go Updates Chat Completions test imports.
provider/​geminiprovider/​agent.go Migrates Gemini formatting callbacks.
provider/​foundryprovider/​agent_e2e_test.go Migrates Foundry test formatting types.
provider/​anthropicprovider/​agent.go Migrates Anthropic formatting callbacks.
format/​jsonformat/​structuredoutput.go Moves structured-output helpers to the root package.
format/​jsonformat/​jsonformat.go Houses JSON format constructors and schema resolution.
format/​jsonformat/​jsonformat_test.go Tests constructors in their new package.
format/​jsonformat/​encoding.go Houses JSON encoding, normalization, and validation.
format/​jsonformat/​encoding_test.go Migrates encoding tests to root types.
format/​jsonformat/​doc.go Documents the root JSON formatting package.
format/​format.go Defines the shared response-format type.
examples/​02-agents/​agents/​step05_structured_output/​main.go Demonstrates the new import path.
agent/​structuredoutput.go Uses root types in middleware callbacks.
agent/​structuredoutput_test.go Updates structured-output tests to root types.
agent/​options.go Uses the root type for response-format options.
agent/​format/​jsonformat/​jsonformat.go Preserves legacy APIs through aliases and wrappers.
agent/​format/​jsonformat/​jsonformat_test.go Adds legacy compatibility and error regression tests.
agent/​format/​jsonformat/​doc.go Documents the deprecated package’s replacement.
agent/​format.go Preserves agent.ResponseFormat as a deprecated alias.
agent/​agent.go Updates provider callback types.
agent/​agent_test.go Migrates agent formatting tests to root types.

Review effort: Balanced

@github-actions github-actions Bot added parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs labels Nov 2, 2026
@github-actions

This comment has been minimized.

Disambiguate example imports using recorded Go target packages. Include root format packages in default indexing while retaining support for older checkouts, and add regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

API consistency review

Result Scope
aligned public API (package relocation, with deprecated aliases)

Changed Go contract

Response-format descriptions and JSON schema helpers move into new top-level packages. The old agent-package APIs stay as deprecated type aliases and forwarding wrappers. The function tools and formatting code no longer depend on the agent package. Provider and example imports are updated. No runtime behavior, defaults, or option shapes change.

Upstream evidence reviewed

No upstream files were read. The GitHub code search for the .NET and Python equivalents was rate-limited (HTTP 429), so I did not compare against them.

Assessment

The PR reorganizes Go packages to remove a dependency cycle. Package layout is a Go-specific concern. The old APIs are kept as aliases, so behavior should be unchanged, and I found no parity issue. The existing parity-approved and public-api-change labels remain appropriate.

Generated by Go API Consistency Review Agent for #1345 · copilot · auto · 15.2 AIC · ⌖ 0.612 AIC · ⊞ 4.9K · ◷

@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit cdcd35d Nov 3, 2026
23 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the move-response-format-packages branch November 3, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Changes files in the agent area area:examples Changes files in the examples area area:provider/anthropic Changes files in the provider / anthropic area area:provider/foundry Changes files in the provider / foundry area area:provider/gemini Changes files in the provider / gemini area area:provider/openai Changes files in the provider / openai area area:provider Changes files in the provider area area:tool Changes files in the tool area parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants