nat.front_ends.fastapi.routes.common_utils#
Shared FastAPI route helpers for HTTP generate/chat endpoints.
Attributes#
Functions#
|
Add context-based headers to response if available. |
|
|
|
|
|
Build a single-response GET handler. |
|
Build a streaming GET handler. |
|
Build a single-response POST handler. |
|
Build a streaming POST handler. |
Module Contents#
- logger#
- RESPONSE_500#
- add_context_headers_to_response(response: fastapi.Response) None#
Add context-based headers to response if available.
- _build_interactive_runner(
- worker: Any,
- session_manager: nat.runtime.session.SessionManager,
- get_single_endpoint(
- *,
- worker: Any,
- session_manager: nat.runtime.session.SessionManager,
- result_type: type | None,
Build a single-response GET handler.
- get_streaming_endpoint(
- *,
- worker: Any,
- session_manager: nat.runtime.session.SessionManager,
- streaming: bool,
- result_type: type | None,
- output_type: type | None,
Build a streaming GET handler.
- post_single_endpoint(
- *,
- worker: Any,
- session_manager: nat.runtime.session.SessionManager,
- request_type: Any,
- enable_interactive: bool,
- result_type: type | None,
Build a single-response POST handler.