AI Chat
Streaming AI Chat
Changed onStreaming 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
- Base URLhttps://api.privacypal.ai
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
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
Changes
- breaking
added the new required request property
- breaking
the request's body type changed from no type to
object - info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- breaking
- info
endpoint added
- info