feat(llm): support incremental Responses WebSocket transport

This commit is contained in:
chenmingxuan committed 2026-11-04 17:15:32 +08:00
1 parent 73adcf25a7
commit 2a3f43fb60
22 files changed
+1176 -12

No files matched your search

+8 -1
View File
@@ -390,7 +390,12 @@ async def observe_response_headers(response):
"""Correlate allowlisted headers and passively observe bounded SSE frames."""
attempt = ACTIVE_ATTEMPT.get()
if attempt is not None:
attempt.headers(response)
websocket = response.extensions.get("artemis_websocket", False)
if websocket:
# 200/SSE is an in-process SDK facade, not a wire HTTP response.
attempt.data.update(headers_at=time.time(), phase="waiting_output")
else:
attempt.headers(response)
content_type = response.headers.get("content-type", "").split(";", 1)[0].lower()
if (
response.status_code == 200
@@ -407,5 +412,7 @@ async def observe_response_headers(response):
)
response.stream = stream
attempt.wire_streams.append(stream)
if websocket:
stream.observation.data["observation_boundary"] = "websocket_event_sse_adapter"
else:
attempt.data["wire_streams_truncated"] = True