Skip to content

About

On this day Wikipedia history videos — fetch historical events from the Wikipedia API and generate daily documentary videos with an LLM (LangChain + OpenAI Sora).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

On This Day Agentic Documentary Video Generator

Generate "on this day" Wikipedia history videos: this app fetches historical events from the Wikipedia API, asks an LLM to rewrite the top events as a documentary script, then renders each one as a presenter video with OpenAI Sora and stitches them into a single downloadable daily history video.

uv sync

On this day Wikipedia events

Fetches "on this day" historical events from the Wikipedia API (requests only) and ensures every event is date-associated.

Daily history video generation

Uses LangChain (modern, non-classic) to build an agentic system that:

  1. Downloads "On this day" historical events from Wikipedia
  2. Ensures every event is date-associated
  3. Uses an OpenAI LLM (via LangChain) to rewrite events as a documentary script
  4. Uses OpenAI Sora to generate a documentary presenter video with audio
  5. Produces a downloadable video

Architecture

  • agents/ – High-level agent orchestration
  • chains/ – LLM chains for summarization and script generation
  • tools/ – External tools (Wikipedia fetcher, video generator)
  • prompts/ – Prompt templates
  • utils/ – Shared helpers
  • tests/ – Unit tests for every class

AI Generation Prompt

ChatGPT 5.2 was used to generate the initial version of this code using the prompt in generation_prompt.txt. There was significant amount of time spent debugging and refactoring the generated code. However, it works now. One of the refactors involved splitting the generated text into smaller chunks so Sora could generate the video via API within its limits. After downloading the individual files, I asked ChatGPT to generate code for stitching the video files into one file.

Install

uv sync

Run

uv run python src/main.py

Environment Variables

  • OPENAI_API_KEY

Notes

  • Wikipedia access uses requests only
  • No langchain_classic
  • Follows SOLID / DRY / KISS / YAGNI principles

Tests

uv run --group dev pytest

Every class has unit tests — the Wikipedia fetcher, the LLM script chain, the Sora video generator, the clip stitcher, settings, and the agent's orchestration. All external calls (Wikipedia, OpenAI, moviepy) are mocked, so the suite needs no network access, no API key, and no ffmpeg. Coverage is reported on every run.

Lint and format checks:

uv run ruff check .
uv run ruff format --check .

CI runs lint and the test suite on every pull request.

About

On this day Wikipedia history videos — fetch historical events from the Wikipedia API and generate daily documentary videos with an LLM (LangChain + OpenAI Sora).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages