Share via

Connection timeout when using ChatMessageImageContentItem and AzureSearchChatExtensionConfiguration

Rahul Navalakha 25 Reputation points
2026-03-05T17:27:30.7366667+00:00

I have a chat client application utilizing Azure Open AI java SDK. Our use case is to query the OpenAI LLM by sending image as context along with user message and also use RAG data in the query.

The application invokes getChatCompletions endpoint using text user message and Azure AI Search options to the Chat (RAG). This works fine until I start using an image along with text user messages. When adding ChatMessageImageContentItem into the mix, the connection times out. We are including the image as a data URL with base64 encoding. As a test we tried to query the LLM using image and text user content without Azure AI Search options and it works fine. As soon as we mix image+text in the chat completiong with RAG search options, we run into the time out.

Looking for some guidance on what could be wrong with the strategy here.

Azure OpenAI in Foundry Models

1 answer

Sort by: Most helpful
  1. Anshika Varshney 13,305 Reputation points Microsoft External Staff Moderator
    2026-03-05T19:31:49.74+00:00

    Hi Rahul Navalakha,

    From what is described, this usually comes down to the request taking longer to complete when images are included, rather than a hard service failure. When ChatMessageImageContent is used, the request payload becomes much larger and the model needs extra time to process both the text and the image. If the client or HTTP library has a shorter timeout configured, the connection can get closed before the service finishes generating the response, which shows up as a connection timeout.

    Another thing to watch is how the image is being sent. Large images or uncompressed base64 payloads can noticeably increase request size and processing time. In practice, resizing the image to a reasonable resolution and avoiding unnecessary metadata helps reduce latency and makes the call more reliable.

    This behavior can also feel intermittent because it depends on current load and how complex the prompt plus image combination is. Text only requests may succeed quickly, while image-based requests hit the timeout more easily under the same settings.

    What has helped others is increasing the client-side timeout to allow enough time for multimodal processing, keeping image sizes modest, and testing the same request with and without images to confirm that the delay is image related rather than a general connectivity issue. Once those are aligned, the timeouts usually stop occurring and the same setup works consistently.

    Do let me know if you have any further queries.

    Thankyou!

    Was this answer helpful?

    0 comments No comments

Your answer

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