nat.front_ends.fastapi.routes.chat#

OpenAI-compatible chat route registration.

Classes#

_ChatEndpointType

Enum where members are also (and must be) strings

_ChatEndpointMethod

Enum where members are also (and must be) strings

Functions#

_add_chat_route(app, worker, endpoint_path, ...)

add_chat_routes(worker, app, endpoint, session_manager, *)

Add OpenAI-compatible chat routes for an endpoint.

Module Contents#

class _ChatEndpointType#

Bases: enum.StrEnum

Enum where members are also (and must be) strings

Initialize self. See help(type(self)) for accurate signature.

SINGLE = 'single'#
STREAMING = 'streaming'#
class _ChatEndpointMethod#

Bases: enum.StrEnum

Enum where members are also (and must be) strings

Initialize self. See help(type(self)) for accurate signature.

GET = 'GET'#
POST = 'POST'#
_add_chat_route(
app: fastapi.FastAPI,
worker: Any,
endpoint_path: str,
session_manager: nat.runtime.session.SessionManager,
endpoint_type: _ChatEndpointType,
endpoint_method: _ChatEndpointMethod,
endpoint_description: str,
enable_interactive: bool,
)#
async add_chat_routes(
worker: Any,
app: fastapi.FastAPI,
endpoint: Any,
session_manager: nat.runtime.session.SessionManager,
*,
enable_interactive_extensions: bool = False,
disable_legacy_routes: bool = False,
)#

Add OpenAI-compatible chat routes for an endpoint.