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

Apache License 2.0 (see the LICENSE file and PyPI package metadata).

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.4.tar.gz (155.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.4-py3-none-any.whl (168.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for afterimage-0.14.4.tar.gz
Algorithm Hash digest
SHA256 c88c3ec9ede259a02d6a80e67db0158deae9435c1b05ba6683784bcaeecc9c18
MD5 203b0137c89e3dda6e20ce59d0214b62
BLAKE2b-256 3d08cb5c70ae6652be0e8f828e1ddb3db7666e6ec797a643fc65574b381509f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for afterimage-0.14.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e55833c714c162a4c104ab2f1ddc1eb06988c61d9f366b4705fa301967a10906
MD5 a7d8e57cc1b722a7a2d50337cc128759
BLAKE2b-256 6a15c8403cc0f36e4eb5bdedd28499caa78378faf6afcb997ece5b8c2ccb657a

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