Skip to content

Latest commit

 

History

History
72 lines (61 loc) · 2.65 KB

File metadata and controls

72 lines (61 loc) · 2.65 KB

API

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:

  1. 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 message
      • position: 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
  2. 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 message
      • position: 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
  3. 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 a role (user | assistant) and a content key (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
  4. GET /chat

    • Purpose: Single-turn chat with a video's transcript (no message history)
    • Rate limit: 10 requests per minute
    • Input: video_id and prompt (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
  5. GET /health

    • Purpose: Health check endpoint
    • Output: {"status": "healthy"}
    • Behavior: Simple endpoint to verify API is running