openai / openai-openapi

OpenAPI specification for the OpenAI API
https://platform.openai.com/docs/api-reference/introduction
MIT License
1.29k stars 376 forks source link

`finish_details` not described in a chat completion `choice` when using gpt-4-vision-preview #136

Closed kristapratico closed 11 months ago

kristapratico commented 11 months ago

The spec shows that a choice object will contain finish_reason, index, and message:

https://github.com/openai/openai-openapi/blob/23a4b18b65bb7b002894bae1084d99134b2897e3/openapi.yaml#L6196-L6225

However, when making a chat completions call with image input and using the gpt-4-vision-preview model, the service returns a response with finish_details instead of finish_reason:

{
    "id": "chatcmpl-8Ug09spjvWvOYEi140zw2mp9odnUi",
    "object": "chat.completion",
    "created": 1702321985,
    "model": "gpt-4-1106-vision-preview",
    "usage": {
        "prompt_tokens": 1118,
        "completion_tokens": 16,
        "total_tokens": 1134
    },
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "This image features a wooden boardwalk extending through a lush green wetland or grass"
            },
            "finish_details": {
                "type": "max_tokens"
            },
            "index": 0
        }
    ]
}

Should finish_details be described in the spec?

FYI @rattrayalex - the Python stainless library captures this property for vision, but it ends up in model_extra. Thought this would be the better spot to open the issue, though.

rattrayalex commented 11 months ago

The gpt-4-vision-preview will be corrected soon – cc @enochcheung

PatrickFarley commented 11 months ago

@rattrayalex please notify me as well once the spec is corrected. We want to keep the Azure OpenAI docs up to date

rattrayalex commented 11 months ago

gpt-4-vision-preview now responds with finish_reason instead of finish_details; this issue can be closed.