fastapi Package

Classes

AgentHttpAdapter
Citation

Citations returned by the model.

CitationUtil

Utility functions for manipulating text and citations.

CloudAdapter

CloudAdapter for FastAPI web framework.

JwtAuthorizationMiddleware

Starlette-compatible ASGI middleware for JWT authorization.

Usage: from fastapi import FastAPI

app = FastAPI() app.add_middleware(JwtAuthorizationMiddleware)

StreamingResponse

A helper class for streaming responses to the client.

This class is used to send a series of updates to the client in a single response. The expected sequence of calls is:

queue_informative_update(), queue_text_chunk(), queue_text_chunk(), ..., end_stream().

Once end_stream() is called, the stream is considered ended and no further updates can be sent.

Functions

channel_service_route_table

Create FastAPI router for Channel Service API.

channel_service_route_table(handler: ChannelApiHandlerProtocol, base_url: str = '') -> APIRouter

Parameters

Name Description
handler
Required

The handler that implements the Channel API protocol.

base_url
str

Optional base URL prefix for all routes.

Default value: ""

Returns

Type Description

APIRouter with all channel service routes.

start_agent_process

Starts the agent host with the provided adapter and agent application. :param adapter: The adapter to use for the agent host. :type adapter: CloudAdapter :param agent_application: The agent application to run. :type agent_application: AgentApplication

async start_agent_process(request: Request, agent_application: AgentApplication, adapter: CloudAdapter) -> Response | None

Parameters

Name Description
request
Required
agent_application
Required
adapter
Required

Returns

Type Description

channel_service_route_table

Create FastAPI router for Channel Service API.

channel_service_route_table(handler: ChannelApiHandlerProtocol, base_url: str = '') -> APIRouter

Parameters

Name Description
handler
Required

The handler that implements the Channel API protocol.

base_url
str

Optional base URL prefix for all routes.

Default value: ""

Returns

Type Description

APIRouter with all channel service routes.