Skip to main content

jupyter.handlers.chat_handler

Tornado handlers for chat API compatible with Vercel AI SDK.

TornadoRequestAdapter Objects

class TornadoRequestAdapter(Request)

Adapter to make Tornado request compatible with Starlette Request interface.

__init__

def __init__(handler: APIHandler) -> None

Initialize the adapter with a Tornado handler.

Arguments:

  • handler - The Tornado RequestHandler instance

body

async def body() -> bytes

Get request body as bytes.

VercelAIChatHandler Objects

class VercelAIChatHandler(APIHandler)

Handler for /api/chat endpoint.

This handler implements the Vercel AI protocol for streaming chat responses. It receives chat messages and streams back AI responses with support for:

  • Text responses
  • Tool calls
  • Reasoning steps
  • Source citations

post

async def post() -> None

Handle chat POST request with streaming.