Skip to content

chat-create-response_format - response_format={"type": "json_object"} does not follow other default types for that param #705

Closed as not planned
@Hendler

Description

@Hendler

Most are Typing.Literal, not Dict. This is especially confusing given that the default param is a str and the documentation seems to imply the type is str. Instead it requires response_format={"type": "json_object"} and {"type": "text"}

openai.chat.completions.create(
            model=model_type,
            messages=prompts,
            response_format="json_object" 
        )

produces:

openai.BadRequestError: Error code: 400 - 
{'error': {'message': 
"'json_object' is not of type 'object' - 'response_format'", 
'type': 'invalid_request_error', 'param': None, 'code': None}}

I haven't dug deeper; perhaps this has a reason I am missing, such as it is detected as dict, so the api "knows" the type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions