From f240baf79dab5f279abd3e95b4a50da5da4a3a41 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 19 Oct 2026 18:37:33 +0200 Subject: [PATCH] LCORE-4621: Apply response request max size limit --- src/app/endpoints/responses.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/endpoints/responses.py b/src/app/endpoints/responses.py index c96965eaa..cbb3bef2a 100644 --- a/src/app/endpoints/responses.py +++ b/src/app/endpoints/responses.py @@ -33,7 +33,11 @@ from authorization.middleware import authorize from client.ogx import AsyncOgxClientHolder from configuration import configuration -from constants import ENDPOINT_PATH_RESPONSES, SUBSTITUTED_INSTRUCTIONS_PLACEHOLDER +from constants import ( + ENDPOINT_PATH_RESPONSES, + RESPONSES_REQUEST_MAX_SIZE, + SUBSTITUTED_INSTRUCTIONS_PLACEHOLDER, +) from log import get_logger from metrics import recording from models.api.requests import ResponsesRequest @@ -1500,6 +1504,13 @@ async def handle_non_streaming_response( tools, configuration.rag_id_mapping, ) + + # retrieve max size of response request + responses_request_max_size = RESPONSES_REQUEST_MAX_SIZE + customization = configuration.configuration.customization + if customization is not None: + responses_request_max_size = customization.responses_request_max_size + return ResponsesResponse.model_validate( { **response_dict, @@ -1507,5 +1518,6 @@ async def handle_non_streaming_response( "conversation": normalize_conversation_id(api_params.conversation), "completed_at": int(completed_at.timestamp()), "output_text": output_text, - } + }, + context={"responses_request_max_size": responses_request_max_size}, )