openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.6k stars 468 forks source link

gpt-4-vision-preview - receives an incomplete response #260

Closed shakhbiev closed 8 months ago

shakhbiev commented 8 months ago

After sending an image, I receive an incomplete response in the “content” key

(
    [index] => 0
    [message] => OpenAI\Responses\Chat\CreateResponseMessage Object
        (
            [role] => assistant
            [content] => The image shows a Nikon DSLR camera with a telephoto lens attached, resting
            [toolCalls] => Array
                (
                )
            [functionCall] => 
        )
    [finishReason] => 
)

Why is the answer text cut?

ThibautPV commented 8 months ago

I think your 'max_tokens' is too low.

Increase the 'max_tokens' value to 900 (for example) like this: 'max_tokens' => 900.

sevenpixels commented 8 months ago

@shakhbiev I see you are getting a response. Can you share your code? I keep getting an error when sending the request with the library but not with CURL ... same request. #258

gehrisandro commented 8 months ago

@shakhbiev I agree with @ThibautPV

shakhbiev commented 8 months ago

@shakhbiev I agree with @ThibautPV

Yes, problem solved!