docs: fix incorrect API call in Nested params README example#3278
Open
pintaste wants to merge 1 commit into
Open
docs: fix incorrect API call in Nested params README example#3278pintaste wants to merge 1 commit into
pintaste wants to merge 1 commit into
Conversation
The "Nested params" example called `client.chat.responses.create` with an `input=` parameter, mixing two incompatible API surfaces: - `client.chat.responses` does not exist (`Chat` only exposes `completions`) - `input=[...]` is the Responses API shape, but `response_format` is a Chat Completions parameter Fix by switching to `client.chat.completions.create` with the correct `messages=` parameter name and a real model name (`gpt-4o`). Fixes openai#3264
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The "Nested params" section in
README.mdreferences a non-existent API methodclient.chat.responses.createand mixes two incompatible API surfaces:client.chat.responsesdoes not exist —Chatonly exposescompletions(seesrc/openai/resources/chat/chat.py)input=[...]is the Responses API parameter shaperesponse_format={"type": "json_object"}is a Chat Completions parametergpt-5.2is not a real model nameRunning the snippet raises
AttributeError: 'Chat' object has no attribute 'responses'.Fix
Switch to
client.chat.completions.createwith the correctmessages=parameter name, a meaningful prompt, and a real model name (gpt-4o).Fixes #3264