refactor(proxy): drop explanatory docstrings from the stream attribution helpers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-17 19:17:49 +00:00
parent 73dea4c567
commit 0f3556b1bf
2 changed files with 1 additions and 13 deletions

View file

@ -2576,8 +2576,7 @@ class ProxyBaseLLMRequestProcessing:
)
async def refresh_stream_headers() -> Mapping[str, str]:
"""`custom_headers` rebuilt once the first chunk is buffered, from `self.data` as the
guardrails left it and for whichever deployment served the stream."""
"""`custom_headers` rebuilt for whichever deployment served the stream."""
return self._stream_response_headers(
hidden_params=(
get_hidden_params_dict(response)

View file

@ -468,9 +468,6 @@ def _record_raising_guardrail(request_data: Mapping[str, object], callback: obje
class _UpstreamStreamBoundary(Generic[_T]):
"""Remembers the exception the upstream iterator raised, so the wrapper around a
streaming hook can tell a pass-through failure from one the hook raised itself."""
__slots__ = ("_upstream", "failure")
def __init__(self, upstream: AsyncIterable[_T]) -> None:
@ -2548,14 +2545,6 @@ class ProxyLogging:
hook: _StreamIteratorHook[_T],
request_data: Mapping[str, object],
) -> AsyncGenerator[_T, None]:
"""
Run `hook` over `response` and yield its chunks. If the hook itself raises,
enrich an HTTPException's dict detail with the callback's `guardrail_name`
and `guardrail_mode` and record the callback in `applied_guardrails` before
re-raising. Failures raised by `response` (the provider stream or an inner
layer of the async_post_call_streaming_iterator_hook chain) pass through
untouched, so only the layer that actually raised is attributed.
"""
upstream: Final = _UpstreamStreamBoundary(response)
try:
async for chunk in hook(response=upstream):