Functions
resolve_stream_context
1
dict[str, Any]
▼
Resolve any awaitables in a Stream() context concurrently.
Values that are cor…
async
resolve_stream_context
1
dict[str, Any]
▼
async def resolve_stream_context(context: dict[str, Any]) -> dict[str, Any]
Resolve any awaitables in a Stream() context concurrently.
Values that are coroutines or awaitables are resolved in parallel. All other values pass through unchanged.
Returns a new dict with all values fully resolved.
Parameters
| Name | Type | Description |
|---|---|---|
context |
dict[str, Any] |
Returns
dict[str, Any]
render_stream_async
2
AsyncIterator[str]
▼
Render a Stream() with async source resolution.
1. Resolves any awaitable cont…
async
render_stream_async
2
AsyncIterator[str]
▼
async def render_stream_async(env: Environment, stream: Stream) -> AsyncIterator[str]
Render a Stream() with async source resolution.
- Resolves any awaitable context values concurrently
- Delegates to kida's synchronous render_stream() for chunk generation
- Yields chunks as an async iterator for ASGI consumption
Usage from negotiation.py::
async for chunk in render_stream_async(kida_env, stream_value):
await send_chunk(chunk)
Parameters
| Name | Type | Description |
|---|---|---|
env |
Environment |
|
stream |
Stream |
Returns
AsyncIterator[str]
has_async_context
1
bool
▼
Check if a Stream() context contains any awaitables.
Used by negotiation.py to…
has_async_context
1
bool
▼
def has_async_context(context: dict[str, Any]) -> bool
Check if a Stream() context contains any awaitables.
Used by negotiation.py to decide between sync and async rendering paths.
Parameters
| Name | Type | Description |
|---|---|---|
context |
dict[str, Any] |
Returns
bool