Skip to main content

coaxer

Label examples. Derive the prompt. Consume it as a string.

Full docs: https://thekevinscott.github.io/coaxer/ · ship-with-package source in docs/.

Motivation

Writing prompts by hand is slow, and the prose grows brittle as cases accumulate. Coaxer flips it: label examples of the behavior you want, derive the prompt from those labels — when it drifts, add more labels instead of rewriting.

Labels are the source of truth. The prompt is a build artifact.

Install

uv add coaxer        # Python
npm install coaxer   # TypeScript

Quick start

coax labels/repo-classification --out prompts/repo-classification
from coaxer import CoaxedPrompt

p = CoaxedPrompt("prompts/repo-classification")
filled = p(readme=new_readme, stars=1200)

The TypeScript version is in docs/guide/getting-started.md.

Getting Started

Label folder is one directory per record; record.json plus sibling files for large text or binary inputs. coax compiles the folder into a prompt artifact you load with CoaxedPrompt. Default optimizer is none (schema-derived, no network).

Full walkthrough: docs/guide/getting-started.md.

CoaxedPrompt

CoaxedPrompt(path, **bound) is a str subclass. str(p) is the raw template; p(**vars) renders it. Missing vars raise MissingVariableError. Bound defaults at construction; call-time vars override. p.fields lists the input variables the template expects.

For structured-output APIs, p.response_format is a Pydantic model derived from the compiled output schema.

Reference: docs/api/coaxed-prompt.md.

CLI

coax <labels-dir> --out <prompts-dir> [--optimizer {none,gepa}] [--output-name NAME]

Reference: docs/api/cli.md.

AgentLM

DSPy BaseLM backed by the Claude Agent SDK. **kwargs forward to ClaudeAgentOptions (tools, allowed_tools, max_turns, …).

from coaxer import AgentLM
lm = AgentLM(tools=[])

Reference: docs/api/agent-lm.md.

OpenAILM

DSPy BaseLM for any OpenAI-compatible chat endpoint (Ollama, vLLM, OpenAI, LM Studio, …).

from coaxer import OpenAILM
lm = OpenAILM(model="gpt-4o", base_url="https://api.openai.com/v1", api_key="sk-...")

Reference: docs/api/openai-lm.md.

Migrations

Downstream-consumer upgrade instructions for breaking changes live in MIGRATIONS.md (also published at docs/migrations.md). The full release log is in CHANGELOG.md.

Development

uv sync --extra dev
uv run just test-unit   # Unit tests
uv run just ci          # Full CI (lint + format + typecheck + tests)

Download files

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

Source Distribution

coaxer-0.3.14.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

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

coaxer-0.3.14-py3-none-any.whl (52.8 kB view details)

Uploaded Python 3

File details

Details for the file coaxer-0.3.14.tar.gz.

File metadata

  • Download URL: coaxer-0.3.14.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for coaxer-0.3.14.tar.gz
Algorithm Hash digest
SHA256 eb852d4034ebfc9201c9bdf2a161fafa31d56abd36d5071d12e85589b0d4bae4
MD5 33a6df3a9315eee7241dc1c807a868c7
BLAKE2b-256 ec29f11c8dc27d794df57316d30a94d1f6608eb005d5f0627e8857f511be47e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for coaxer-0.3.14.tar.gz:

Publisher: release.yml on thekevinscott/coaxer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coaxer-0.3.14-py3-none-any.whl.

File metadata

  • Download URL: coaxer-0.3.14-py3-none-any.whl
  • Upload date:
  • Size: 52.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for coaxer-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 5c8af9f64959bd8005b8513c8cf070fc057d87bcbba742ee5b37fc5aff5810df
MD5 eec371699b94e1c5af1a6186c6687d8e
BLAKE2b-256 40735d13770f47b404d0451c4638e3c0a41ab148bd98e68806c8a657e92f4a9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for coaxer-0.3.14-py3-none-any.whl:

Publisher: release.yml on thekevinscott/coaxer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.15

2 files

This release

0.3.14 This release

2 files

0.3.13

2 files

0.3.12

1 file

0.3.11

1 file

0.3.9

1 file

0.3.8

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.18

1 file

0.2.17

1 file

0.2.16

1 file

0.2.15

1 file

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page