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

Function _stream_upstream

uncommon_route/proxy.py:573–587  ·  view source on GitHub ↗

Stream response from upstream, yielding raw bytes.

(
    upstream_url: str,
    body: dict,
    headers: dict[str, str],
)

Source from the content-addressed store, hash-verified

571
572
573async def _stream_upstream(
574 upstream_url: str,
575 body: dict,
576 headers: dict[str, str],
577) -> AsyncGenerator[bytes, None]:
578 """Stream response from upstream, yielding raw bytes."""
579 client = _get_client()
580 async with client.stream(
581 "POST",
582 upstream_url,
583 json=body,
584 headers=headers,
585 ) as resp:
586 async for chunk in resp.aiter_bytes():
587 yield chunk
588
589
590def _extract_assistant_text(content: bytes) -> str:

Callers

nothing calls this directly

Calls 1

_get_clientFunction · 0.85

Tested by

no test coverage detected