Overview
The RAG (Retrieval-Augmented Generation) Copilot provides an intelligent chatbot that answers questions based on course content. It supports both course-specific and organization-wide modes.Chat with Copilot
Request Body
User’s question or message
UUID of the course to search within. If omitted, searches across all courses in the org
Existing chat session UUID. If omitted, creates a new session
Chat mode:
course_only (grounded in course content) or general (broader knowledge)Organization slug (used for cross-course mode when
course_uuid is omitted)Response (SSE Stream)
Returns Server-Sent Events with multiple event types:Event type:
start, chunk, sources, done, follow_ups, session_title, or errorEvent Types
start Event
chunk Event
sources Event
follow_ups Event
session_title Event
done Event
The chat session UUID (
aichat_uuid) should be included in subsequent messages to maintain conversation history.Manually Index Course
Request Body
UUID of the course to index
Authorization
Response
Always
success on completionNumber of content chunks indexed
Example Response
Indexing is automatic when courses are created/updated. Manual indexing is only needed for troubleshooting or forcing re-indexing.
Session Management
List Chat Sessions
Response
Array of session objects with metadata
Get Session Messages
Response
Array of message objects with role, content, and sources
Delete Session
Response
Update Session Metadata
Request Body
New session title
Mark session as favorite
Feature Availability
RAG Copilot can be disabled at the organization level via organization config:403 error.
Implementation Details
- Embedding Model: Content is chunked and embedded for semantic search
- Session Storage: Chat history stored in Redis
- AI Model: Uses
gemini-2.5-flashfor all plans - Credits: Each chat message deducts 1 AI credit
- Source Code:
apps/api/src/routers/ai/rag.py:127