AI Chat
Streaming AI Chat
Streaming AI chat with real-time response chunks via Server-Sent Events (SSE).
The response is a stream of events with the following types:
- encoding_complete: PII encoding finished
- llm_chunk: Partial LLM response text
- llm_complete: Full LLM response assembled
- complete: Full processing finished (includes decoded response)
- error: An error occurred
SDK Usage:
const result = await client.chatWithAIStream(
{ prompt: 'Summarize account for Jane Smith', model: 'gemini-2.0-flash-exp' },
(update) => {
if (update.type === 'llm_chunk') {
process.stdout.write(update.data.chunk);
}
}
);
post/api/ai/chat/stream
Request body
Example request
{
"prompt": "Analyze credit history for John Doe at john@company.com",
"model": "gemini-2.0-flash-exp",
"provider": "vertex"
}Response
Server-Sent Events stream