Skip to main content

Evals-first prompt optimization. Label examples, get better prompts.

Project description

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

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)

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 prompt.jinja + meta.json (+ dspy.json when --optimizer gepa) + history.jsonl. 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 Jinja template; p(**vars) renders it (Jinja2 StrictUndefined — missing vars raise). Bound defaults at construction; call-time vars override.

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)

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

coaxer-0.3.5.tar.gz (40.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: coaxer-0.3.5.tar.gz
  • Upload date:
  • Size: 40.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for coaxer-0.3.5.tar.gz
Algorithm Hash digest
SHA256 dcb2d08f5dfafdc788ba12c7d53b5cdcc07b28c789431623f6fb6c1a87ef03bf
MD5 05d12cd1848720d68fea93afda856f7b
BLAKE2b-256 cffcd9dd0f5f51fe1af5270420fbb92b0b52c2025f9d0d744aab3c8ffdb48523

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