File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -935,11 +935,16 @@ async fn chat_completions(
935935 // note - we might do this as part of the post processing set to make it more generic
936936
937937 if streaming {
938+ // For streaming responses, we return HTTP 200 immediately without checking for errors.
939+ // Once HTTP 200 OK is sent, we cannot change the status code, so any backend errors
940+ // must be delivered as SSE events with `event: error` in the stream (handled by
941+ // EventConverter and monitor_for_disconnects). This is standard SSE behavior.
938942 stream_handle. arm ( ) ; // allows the system to detect client disconnects and cancel the LLM generation
939943
940944 let mut http_queue_guard = Some ( http_queue_guard) ;
941945 let stream = stream. map ( move |response| {
942946 // Calls observe_response() on each token
947+ // EventConverter will detect `event: "error"` and convert to SSE error events
943948 process_response_using_event_converter_and_observe_metrics (
944949 EventConverter :: from ( response) ,
945950 & mut response_collector,
You can’t perform that action at this time.
0 commit comments