4646from configuration import configuration
4747from constants import (
4848 ENDPOINT_PATH_STREAMING_QUERY ,
49+ IMAGE_CONTENT_TYPES ,
4950 LLM_TOKEN_EVENT ,
5051 LLM_TOOL_CALL_EVENT ,
5152 LLM_TOOL_RESULT_EVENT ,
6970 UnprocessableEntityResponse ,
7071)
7172from models .api .responses .successful import StreamingQueryResponse
73+ from models .common .query import Attachment
7274from models .common .responses .contexts import ResponseGeneratorContext
7375from models .common .responses .responses_api_params import ResponsesApiParams
7476from models .common .responses .types import ResponseInput
@@ -307,6 +309,13 @@ async def streaming_query_endpoint_handler( # pylint: disable=too-many-locals
307309 )
308310 recording .record_llm_call (provider_id , model_id , endpoint_path )
309311
312+ # Extract image attachments for multimodal support
313+ image_attachments = [
314+ a
315+ for a in (query_request .attachments or [])
316+ if a .content_type in IMAGE_CONTENT_TYPES
317+ ] or None
318+
310319 response_media_type = (
311320 MEDIA_TYPE_TEXT
312321 if query_request .media_type == MEDIA_TYPE_TEXT
@@ -330,6 +339,7 @@ async def streaming_query_endpoint_handler( # pylint: disable=too-many-locals
330339 context = context ,
331340 responses_params = responses_params ,
332341 endpoint_path = endpoint_path ,
342+ image_attachments = image_attachments ,
333343 ),
334344 media_type = response_media_type ,
335345 )
@@ -339,6 +349,7 @@ async def streaming_query_endpoint_handler( # pylint: disable=too-many-locals
339349 context = context ,
340350 endpoint_path = endpoint_path ,
341351 no_tools = bool (query_request .no_tools ),
352+ image_attachments = image_attachments ,
342353 )
343354
344355 # Combine inline RAG results (BYOK + Solr) with tool-based results
@@ -461,6 +472,7 @@ async def generate_response_with_compaction(
461472 context : ResponseGeneratorContext ,
462473 responses_params : ResponsesApiParams ,
463474 endpoint_path : str ,
475+ image_attachments : Optional [list [Attachment ]] = None ,
464476) -> AsyncIterator [str ]:
465477 """Stream a response for a conversation that requires compaction.
466478
@@ -475,6 +487,7 @@ async def generate_response_with_compaction(
475487 context: The response generator context.
476488 responses_params: The base Responses API parameters.
477489 endpoint_path: API endpoint path used for metric labeling.
490+ image_attachments: Image attachments for multimodal prompt construction.
478491
479492 Yields:
480493 SSE-formatted strings.
@@ -507,6 +520,7 @@ async def generate_response_with_compaction(
507520 responses_params = responses_params ,
508521 context = context ,
509522 endpoint_path = endpoint_path ,
523+ image_attachments = image_attachments ,
510524 )
511525 except HTTPException as e :
512526 yield http_exception_stream_event (e )
0 commit comments