Skip to main content

digline-anthropic

An Anthropic target and judges for digline: a prompt file goes in, a priced Response comes out.

pip install digline-anthropic

Requires Python 3.12+, like digline itself.

from pathlib import Path
from digline_anthropic import AnthropicTarget

target = AnthropicTarget(
    prompt_file=Path(__file__).parent / "prompts/answer.md",
    system_file=Path(__file__).parent / "prompts/system.md",
    model="claude-sonnet-5",
    max_tokens=1024,
    prefill="{",  # put JSON in the model's mouth
)

Both files are recorded in every run, so the committed baseline carries the prompt that produced it. Cost comes from a price list declared in code and replaceable in one argument; an unknown model raises rather than costing nothing. The key is never named here — the SDK reads ANTHROPIC_API_KEY.

The judges

A plugin is a target and a judge (ADR 0004): whoever generates can judge, with the same key and the same price list, and the twenty lines of SDK-and-JSON leave your suite.

from digline.core import LlmRubric
from digline_anthropic import AnthropicJudge

judge = AnthropicJudge(model="claude-haiku-4-5")
rubric = LlmRubric(
    rubric="The answer is one sentence and cites the passage it came from.",
    judge=judge,
    threshold=0.8,
    tolerance=0.05,
)

Faithfulness asks a judge to decompose rather than to score — how many claims the output makes, how many the context supports — so it takes the other one:

from digline.core import Faithfulness
from digline_anthropic import AnthropicClaimJudge

faithful = Faithfulness(
    judge=AnthropicClaimJudge(model="claude-haiku-4-5"),
    threshold=0.9,
    tolerance=0.05,
)

Both put { in the model's mouth and prepend it before parsing, and both read a reply the model wrapped in a fence or a sentence. What judging cost is counted on the judge and never reset:

from digline_anthropic import AnthropicJudge

judge = AnthropicJudge(model="claude-haiku-4-5")
print(f"{judge.calls} judgements, {judge.spent_usd:.4f} USD, {judge.latency_ms:.0f} ms")

A suite with samples=5 and Repeated(n=3) makes fifteen judging calls per case, so this is not a rounding error. For a per-run figure, read it before and after and subtract. It is in-process only today, and ADR 0004 §3 says what it would take to put it in the report.

Apache-2.0. Docs: digline/digline.

Metadata

Release files for digline-anthropic 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digline-anthropic 0.3.0
File Size Uploaded
digline_anthropic-0.3.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for digline-anthropic 0.3.0
File Interpreter ABI Platform
digline_anthropic-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / digline_anthropic-0.3.0.tar.gz

Download URL digline_anthropic-0.3.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
216075db7f505d166bc0a0ad2bbe58e6280a35c82971316b8b58bf1ec298c054
BLAKE2b-256 checksum
How to use checksums
4086d8acb448f79b32884200dd2faac6ac7bde71cbe9c434280225a713162c35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / digline_anthropic-0.3.0-py3-none-any.whl

Download URL digline_anthropic-0.3.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9c6b519cda684af7224786621250ff811652d3c2751e8056b66c714a81585ce
BLAKE2b-256 checksum
How to use checksums
2f39e06b9e7ed3238278d7692a6fe2a034b2508c510eed72c7c911afad3392fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release 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