Chat API
The Chat API runs retrieval over your indexed sources (and optional package scope), then generates an answer with citations. UsePOST /chat for a single JSON response, or POST /chat/stream for Server-Sent Events (event: token, event: done, event: error).
Endpoints
Request (POST /chat)
The question to ask the Ground Agent
Optional. When authenticated via JWT (dashboard), continues an existing conversation.
Number of sources to use as context (1-10)
Maximum tokens for context window
Include pre-indexed global packages in search
Optional. Restrict retrieval to specific source IDs (e.g. “talk to one repo”).
Optional. Use
ground_docs to limit to Ground’s own documentation source when enabled.Streaming (POST /chat/stream)
Same fields as above, plus optional package_mentions (for example [{"package_name":"react","ecosystem":"npm"}]) to blend in on-demand package context. Consume the SSE stream in your client; the done event includes citations, timing, and conversation_id when persisted.
PDF context (POST /chat/upload-pdf)
Multipart form: file (PDF) and conversation_id. Requires JWT auth matching the conversation. Chunks are stored for ephemeral retrieval during that conversation’s chat turns.
Response
AI-generated answer based on Ground’s indexed documentation
List of sources used to generate the answer
Time taken to search Ground’s index
Time taken for AI to generate answer
Total response time
AI model used (e.g., “gpt-4o”)
Example
Response Example
Notes
- API key requests work for core Q&A; conversation persistence uses JWT (dashboard) with
/conversationsAPIs. - Model id and latency depend on your deployment’s Azure / LLM configuration.
Citations
Answers include source names, paths, and excerpts you can verify in the repo or doc.
Streaming
Use
/chat/stream for token-by-token UX in custom clients.Package scope
Combine indexed sources with on-demand package context where the API supports it.
PDF uploads
Attach PDFs per conversation for short-lived context (JWT).