close

View as MarkdownOpen in Claude

Close the AIChatClient the gateway built for itself. A gateway constructed with your own client= leaves that client alone, since it did not create it.

Parameters

None.

Returns

None.

Example

Close it when your app shuts down:

1from contextlib import asynccontextmanager
2
3from fastapi import FastAPI
4from signalwire.ai_chat import ChatGateway
5
6gateway = ChatGateway(config_url="https://bayview-taxi.example.com/swml")
7
8
9@asynccontextmanager
10async def lifespan(app: FastAPI):
11 yield
12 await gateway.close()
13
14
15app = FastAPI(lifespan=lifespan)
16app.include_router(gateway.router(), prefix="/chat")