Few-shot chatbot trained on anime subtitles.
A flexible chatbot that generates contextual responses to anime dialogue inputs using few-shot prompting based on the Anime Subtitles Dataset. The project uses the OpenRouter API for access to multiple AI models.
This project was migrated from an older trax implementation and subsequently refactored from a local Hugging Face distilgpt2 model to use external AI APIs with the OpenRouter provider.
The chatbot uses OpenRouter as its sole AI provider, giving access to various models including DeepSeek through a unified API.
Clone the repository:
git clone https://github.com/waifuai/anime-subtitle-chatbot-trax
cd anime-subtitle-chatbot-trax
Create the uv virtual environment and ensure tooling (Windows venv shim path shown):
python -m uv venv .venv
.venv/Scripts/python.exe -m ensurepip
.venv/Scripts/python.exe -m pip install uv
Install dependencies:
.venv/Scripts/python.exe -m uv pip install -r requirements.txt
.venv/Scripts/python.exe -m uv pip install -e ./src/anime_chatbot[test]
Set up API Key:
OPENROUTER_API_KEY in your environment.~/.api-openrouter (Windows: C:\Users\YourUsername\.api-openrouter) containing your key.Prepare Example Data (optional, improves style consistency):
input.txt and output.txt under src/local_data/data/. Example files are included..venv/Scripts/python.exe -m python src/scripts/predict.py
Type quit or press Ctrl+D to exit.
.venv/Scripts/python.exe -m python src/scripts/predict.py --input_file path/to/prompts.txt --output_file path/to/responses.txt
.venv/Scripts/python.exe -m python src/scripts/predict.py --model openrouter/free
--input_file: text file with one prompt per line for batch processing--output_file: optional output path (default: ./output_responses.txt)--data_dir: optional few-shot data directory (default: src/local_data/data/)--model: specific model to use (overrides default).
├── src/
│ ├── anime_chatbot/ # Core package
│ │ ├── __init__.py # Package exports and convenience imports
│ │ ├── setup.py # Package setup and metadata
│ │ ├── provider_selector.py # Provider selection and configuration logic
│ │ └── providers/ # AI provider implementations
│ │ └── openrouter.py # OpenRouter provider
│ ├── local_data/ # Example data for few-shot prompting
│ │ └── data/
│ │ ├── input.txt # Example dialogue inputs
│ │ ├── output.txt # Example dialogue outputs
│ │ └── train.txt # Training data (legacy)
│ ├── scripts/ # Executable scripts
│ │ └── predict.py # Main prediction script with CLI
│ └── tests/ # Test suite
│ └── test_chatbot.py # Comprehensive test coverage
├── .gitignore # Git ignore patterns
├── LICENSE # MIT-0 License
├── pytest.ini # Pytest configuration
├── requirements.txt # Python dependencies
└── README.md # This file
openrouter/free~/.model-openrouter file with custom OpenRouter model name--model CLI parameter to overrideOPENROUTER_API_KEYsrc/local_data/data/input.txt and output.txt# Install with test dependencies
.venv/Scripts/python.exe -m uv pip install -e ./src/anime_chatbot[test]
# Run all tests
.venv/Scripts/python.exe -m pytest
# Run with coverage
.venv/Scripts/python.exe -m pytest --cov=src/anime_chatbot --cov-report=html
Files in src/anime_chatbot
Chat with an animated video companion in your browser. She reacts with 12 states and 12 emotions. Also a Hermes Agent plugin.
Live2D widget for Hermes Agent with five built-in models and expression controls.
REST API for waifu chatbot conversations with user management.
Alignment constitution and behaviour guidelines for waifu agents.
Python library for AI waifus in the Godot engine, with VRM avatar support.
Character and agent trait system, with Manim animations.