When executed with the argument --api, the application runs a http server exposing an API to interact with it.
By default, the docker container starts in this mode.
The API endpoints are:
-
POST /transcript
- Purpose: Submit a YouTube video URL for it's transcript to be downloaded, processed and stored.
- Rate limit: 10 requests per minute
- Input: JSON object containing:
video_url: The target video's URL.
- Output: JSON object containing:
video_status: Current processing status ('queued' | 'processing' | 'completed' | 'error')message: Status messageposition: Queue position (if queued)queue_size: Current queue size
- Behavior:
- Validates YouTube URL
- Extracts video ID
- Checks if transcript already exists in the database
- Adds video to processing queue
- Returns current processing status
-
GET /transcript
- Purpose: Check status of transcript processing for a video
- Rate limit: 10 requests per minute
- Input:
video_id(query parameter) - Output: JSON object containing:
video_status: Current processing status ('queued' | 'processing' | 'completed' | 'error')message: Status messageposition: Queue position (if queued)queue_size: Current queue size
- Behavior:
- Validates video ID length
- Checks if transcript already exists in the database
- Adds video to processing queue
- Returns current processing status
-
POST /chat
- Purpose: Chat with a video's transcript using message history
- Rate limit: 10 requests per minute
- Input: JSON object containing:
video_url: The target video's URL.messages: List of chat message objects, each containing arole(user | assistant) and acontentkey (the message itself).
- Output: List of chat messages objects with the new assistant response.
- Behavior:
- Validates YouTube URL
- Extracts video ID
- Checks if transcript exists in the database
- Uses inferencer and embedder to process chat
- Returns updated message history
-
GET /chat
- Purpose: Single-turn chat with a video's transcript (no message history)
- Rate limit: 10 requests per minute
- Input:
video_idandprompt(query parameters) - Output: Assistant response in raw text
- Behavior:
- Validates video ID length
- Checks if transcript exists in the database
- Processes single query without maintaining history
- Returns response based on transcript
-
GET /health
- Purpose: Health check endpoint
- Output: {"status": "healthy"}
- Behavior: Simple endpoint to verify API is running