fastrag.serve.app#
The FastAPI app: create_app(), lifespan, middleware, handlers.
Functions
|
Build the serving app. |
- fastrag.serve.app.create_app(*, engine, chat_store, config=None)[source]#
Build the serving app.
A thin adapter over its two collaborators, laid out in the example the SDK ships: a
QueryEngineand aChatStore. The app itself owns no database engine and no ORM session — chatting goes through the store’s methods, generation throughengine.stream, and the advisory lock and/healthzconnection check borrow the store’s engine via itsengineproperty. Both collaborators are required: there is no half-configured mode.- Parameters:
engine (QueryEngine) – The
QueryEnginethe API exposes — the single place retrieval and generation happen.chat_store (ChatStore) – The
ChatStoreall session/chat/message persistence goes through. Already entered by the caller (async with ... as chat_store).config (ServeConfig | None) –
ServeConfig. Defaults to a config with an emptyallowed_originslist.
- Returns:
A FastAPI app serving
/healthzand the full/v1chats API.- Return type:
FastAPI