INNER CODE UNIT · Python

_should_stream_response

genome-spy/genome-spy · packages/app-agent/server/app/main.py:274

def _should_stream_response(
    settings: Settings, http_request: Request, stream: bool
) -> bool:
    """Decide whether the current turn should use SSE streaming."""
    return settings.enable_streaming and (
        stream or "text/event-stream" in http_request.headers.get("accept", "")
    )


def _build_streaming_response(
    provider_request: ProviderRequest,
    settings: Settings,
    *,
    estimated_input_tokens: int | None,
) -> StreamingResponse:
    """Build the FastAPI streaming response wrapper."""
    return StreamingResponse(
        _stream_plan(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…