MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / sse_passthrough

Function sse_passthrough

uncommon_route/proxy.py:5546–5561  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5544 )
5545
5546 async def sse_passthrough() -> AsyncGenerator[bytes, None]:
5547 stream_chunks: list[bytes] = []
5548 try:
5549 async for chunk in stream_resp.aiter_bytes():
5550 stream_chunks.append(chunk)
5551 yield _normalize_reasoning_content_chunk(chunk)
5552 await _record_stream_success(
5553 parse_stream_usage_metrics(stream_chunks, selected_model, _get_pricing()),
5554 stream_chunks=stream_chunks,
5555 )
5556 except Exception:
5557 await _record_stream_failure()
5558 raise
5559 finally:
5560 await _record_stream_aborted(stream_chunks=stream_chunks)
5561 await stream_resp.aclose()
5562
5563 return StreamingResponse(
5564 sse_passthrough(),

Callers 1

_handle_chat_coreFunction · 0.85

Calls 7

_record_stream_successFunction · 0.85
_get_pricingFunction · 0.85
_record_stream_failureFunction · 0.85
_record_stream_abortedFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected