Azure OpenAI GPT-4-Vision streaming bug

Alexander Novikov 40 Reputation points
2024-03-01T01:36:38.03+00:00

Good day, experts.

I have a problem when I use GPT-4-Vision model deployed in Australia East using Azure OpenAI service. When I use stream option enabled like in the code below:

            response = chat_client.chat.completions.create(
                            model=engine,
                            messages=gpt_messages, 
                            temperature=temperature,
                            stream=True,
                            max_tokens = output_token_limits[engine]
                            )

The GPT-4-vision returns "Sorry, I can't help with that request." most of the time, like 95% and occasionally it does work.

However, should I switch off streaming, it works fine and consistent.

Has anyone observed that and found a solution?

Thanks in advance.

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,092 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 48,911 Reputation points Microsoft Employee Moderator
    2024-03-01T05:48:43.3466667+00:00

    @Alexander Novikov I believe these two versions support the vision model currently, if you are using the first API version(2023-12-01-preview) and seen this error, could you try the second one (2024-02-15-preview) to check if it is consistent?

    Also, in the messages input you can try to use the image_url first and then the text. Something similar to below and check if the behavior improves?

    "role": "user",
    
                "content": [
    
                              {
    
                              {
    
                                  "type": "image_url",
    
                                  "image_url": {
    
                            "url": <your_url>
    
                        },
    
                                  "type": "text",
    
                                  "text": "Describe this picture:"
    
                              }
    
                    }
    
               ]
    
            }
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.