Skip to content

Add Responses API structured outputs, function calling, and Conversations API#203

Open
naga-k wants to merge 1 commit intoandrewyng:mainfrom
naga-k:feat/openai-responses-conversations-api
Open

Add Responses API structured outputs, function calling, and Conversations API#203
naga-k wants to merge 1 commit intoandrewyng:mainfrom
naga-k:feat/openai-responses-conversations-api

Conversation

@naga-k
Copy link
Copy Markdown

@naga-k naga-k commented Mar 27, 2026

Summary

The OpenAI docs currently only show Chat Completions for structured outputs and function calling, despite recommending the Responses API as primary. This PR adds the missing Responses API equivalents and the Conversations API across Python, JavaScript, and Go.

Note on diff size: The large number of additions/deletions is mostly from moving legacy Chat Completions examples and additional API sections (audio, files, embeddings, etc.) out of the main DOC.md files into references/additional-apis.md files to comply with the 500-line guideline. The actual new content added is the Responses API structured outputs, function calling, and Conversations API sections.

Changes

New content added (all three languages — Python, JS, Go):

  • responses.parse() / responses.create() as primary method for structured outputs
  • Responses API function calling as primary method
  • Conversations API section (persistent multi-turn sessions)

Refactored (Python & JavaScript):

  • Moved legacy Chat Completions examples to references/additional-apis.md
  • Moved additional API sections (audio, files, embeddings, image gen, realtime, Azure, webhooks, pagination) to references/additional-apis.md
  • Main DOC.md files now link to reference files for these sections
  • This brings Python from 694 → 363 lines and JavaScript from 527 → 409 lines

Fix (package/python):

  • Corrected incorrect claim: "The SDK's documented auto-parsing helper is on Chat Completions, not on the Responses API" — responses.parse() with text_format exists now

Existing content preserved:

  • All Chat Completions examples kept as "Legacy" subsections or moved to reference files with links
  • No model names changed in existing examples

Verification

  • Python examples verified by testing against live OpenAI API
  • JavaScript examples verified against official OpenAI structured outputs guide
  • Go examples verified via Codex code review against openai-go v3 SDK
  • All files pass chub build content/ --validate-only
  • All DOC.md files under 500 lines

Related

…ions API to OpenAI docs

- Python, JavaScript, Go: added responses.parse() with structured outputs as primary method
- Python, JavaScript, Go: added Responses API function calling as primary method
- Python, JavaScript, Go: added Conversations API section
- package/python: fixed incorrect claim that structured outputs only work with Chat Completions
- Python, JavaScript: moved legacy Chat Completions examples and additional APIs to references/ files to stay under 500-line guideline
- All existing Chat Completions examples preserved as "Legacy" with links to reference files
- Verified Python and JS examples against official OpenAI SDK docs
- Verified Go examples against openai-go v3 SDK via Codex review
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.

1 participant