API Model for the RAG-Powered Support Assistant Service
Explore how to model a RAG-powered support assistant API around collections, document ingestion, queries, and feedback. Learn how asynchronous ingestion jobs expose status and failures, while grounded question responses preserve citations and recovery paths. See how HTTP status codes, idempotency keys, and server-sent events support predictable client behavior.
We'll cover the following...
This lesson models the RAG-powered support assistant API using the decisions from the preceding lesson. We will define its base URL, resources, and data entities, and the requests and responses used to manage collections, ingest documents, ask grounded questions, and collect feedback.
Administrators manage collections of approved documents, and authorized clients ask questions that return answers with citations to those documents. A collection is the API’s name for a knowledge base, and it is the retrieval boundary for every query, as the diagram below shows:
Base URL and API endpoints
The following host and version prefix are illustrative:
The API groups operations around collections, documents, ingestion jobs, queries, and feedback:
List routes return a page of items with a nextCursor when more are available. Reading a query returns its stored answer, status, and citations, so a client that lost a stream can recover the outcome. Chunks, embeddings, and reranking scores stay internal, so the index can change without breaking clients.
Message format for API endpoints
The service exchanges seven entities. Collection, Document, and IngestionJob describe the content the assistant may use; Query, Answer, and Citation describe a grounded question and its evidence; and Feedback records how useful ...