Chat
Changed onChat endpoint using LiteLLM with GitHub Copilot and optional RAG.
This endpoint requires the user to be authenticated with both Extralit and GitHub (via the /auth/github/login flow).
If dataset_id is provided, the endpoint will perform RAG retrieval:
- Generate embedding for the user's query
- Search for relevant documents in the dataset
- Inject retrieved context into the system prompt
Args: request: Chat request with model, messages, and optional dataset_id current_user: Authenticated Extralit user db: Database session (injected for RAG) search_engine: Search engine instance (injected for RAG)
Returns: StreamingResponse with chat completion
Raises: HTTPException: If user is not authenticated with GitHub
Request
- Base URLhttps://extralit-public-demo.hf.space/api/v1
- URLhttps://extralit-public-demo.hf.space/api/v1/chat
- Auth
- API key in header X-Extralit-Api-Key
- or HTTP bearer
Request body
Response
A text/event-stream of data: frames. Each frame carries either a content token, the literal [DONE] terminator, or a JSON object with an error key.
Changes
- breaking
removed the media type
application/jsonfor the response with the status - info
added the media type
text/event-streamfor the response with the status
- breaking
- info
endpoint added
- info