chat

Chat

Chat 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:

  1. Generate embedding for the user's query
  2. Search for relevant documents in the dataset
  3. 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

post/chat

Request body

modelstring

Model to use for chat (e.g., 'copilot')

streamboolean

Whether to stream the response

dataset_idstring uuid nullable

Optional dataset ID for RAG retrieval

top_kinteger

Number of documents to retrieve for RAG

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

Changed in 2 of the 7 revisions of this API.12

  • ca32894f988c11See the full diff
    • removed the media type application/json for the response with the status 200

      response-media-type-removed

    • added the media type text/event-stream for the response with the status 200

      response-media-type-added

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • endpoint added

      endpoint-added