Skip to main content

Generate conversational, tool-calling, structured-output, and preference datasets — easily and at scale

Project description

AfterImage

Tests Ruff format Ruff lint Documentation

AfterImage is a Python library and CLI for generating synthetic conversational datasets with modern LLMs (Gemini, OpenAI-compatible APIs, DeepSeek, and local OpenAI-compatible servers). It is built so you can start with a YAML file and one command, then compose callbacks, document providers, storage, evaluation, and export pipelines as your needs grow—from quick experiments to large, production-style runs.

Two ways to work (same engine)

1. CLI and config — easy to begin
Describe generation in YAML, set your API key in the environment, and run afterimage generate. No boilerplate, no custom harness required to get JSONL on disk. Optional commands cover export to fine-tuning formats and preference (DPO-style) pair generation.

2. Python API — composable and extensible
Use ConversationGenerator, StructuredGenerator, and PersonaGenerator with pluggable instruction generators, respondent prompt modifiers, stopping criteria, storage (JSONL or SQL), quality judges, and monitoring. The same abstractions power the CLI; you swap or combine pieces instead of forking the stack.

That split keeps onboarding shallow while leaving room for scale (concurrency, key pools, SQL storage) and specialized flows (RAG-style context, personas, structured extraction, preference data). Guides and API reference are on afterimage.altai.dev.


Installation

The package can be installed from PyPI as afterimage.

uv add afterimage
pip install afterimage

Optional extras (see pyproject.toml for exact dependency sets):

uv add "afterimage[embeddings-local]"
# or
pip install "afterimage[embeddings-local]"
Extra Purpose
embeddings-local Local embeddings (sentence-transformers) for process-based embedding providers, Qdrant-style workflows, and quality checks that need a local model.
server FastAPI app (afterimage-server entry point).
training Torch / TRL stack, Gradio, and FastMCP for examples/demo_ui and the training scripts under examples/.

Start in minutes (CLI)

Requires Python 3.11+ and an API key (e.g. GEMINI_API_KEY for the sample config).

afterimage generate -c examples/configs/basic.yaml

Dry-run the plan without calling the API:

afterimage generate -c examples/configs/basic.yaml --dry-run

Export a dataset to common fine-tuning formats:

afterimage export -i your_dataset.jsonl -f sharegpt -f messages
afterimage export --list-formats

Generate preference pairs from config:

afterimage preference -c your_config.yaml

More examples live under examples/configs/. In-depth guides (conversations, personas, structured generation, evaluation, export, preference data, local models) are on afterimage.altai.dev.


What you can build

  • Multi-turn synthetic chat for SFT, evaluation sets, or simulation.
  • Document-grounded questions and answers (instruction side + optional respondent context).
  • Persona-driven diversity tied to your corpus.
  • Structured outputs via Pydantic schemas (single-turn extraction or generation).
  • DPO / RLHF-style preference data with multiple variation strategies.
  • Quality loops (async judge, optional auto-improve) and observability (metrics, periodic alert checks, exports to JSON/CSV/Parquet).

Repository layout

Path Contents
docs/ Sphinx sources; mirrors and extends the hosted site.
examples/ YAML configs and demo flows.
DESIGN.md Architecture and design notes for contributors.
afterimage/ Library and CLI implementation.

Source & issues: github.com/altaidevorg/afterimage


License

MIT (see PyPI package metadata and pyproject.toml classifiers).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afterimage-0.14.2.tar.gz (147.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

afterimage-0.14.2-py3-none-any.whl (161.2 kB view details)

Uploaded Python 3

File details

Details for the file afterimage-0.14.2.tar.gz.

File metadata

  • Download URL: afterimage-0.14.2.tar.gz
  • Upload date:
  • Size: 147.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.19

File hashes

Hashes for afterimage-0.14.2.tar.gz
Algorithm Hash digest
SHA256 a1dc8b1ad3e9e2a858bbafbe0a0cdea1e2da9265741093669edf64be6070aa36
MD5 becdc54b2bdfbc0fea7e07c6738a6613
BLAKE2b-256 0cb1b8f579a92557ccd80a6d2be4dae4cf41850a25910c76b91706cee8bcd728

See more details on using hashes here.

File details

Details for the file afterimage-0.14.2-py3-none-any.whl.

File metadata

File hashes

Hashes for afterimage-0.14.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25a8adbc861feb56919d5775ccf5b159cb1c3baa71fda914cd7b7230f3f25c3b
MD5 b830f5e1cca10abd329148e2de893310
BLAKE2b-256 3e1a99e9e3c8b876c6b087e6fd2a9efd667f7c7f5eada7ba14f741a764a0b1c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page