Skip to main content

LLM-based summary quality evaluation

Project description

assert-eval

LLM-based summary quality evaluation.

Scores a summary against source text across four metrics: coverage, factual consistency, factual alignment, and topic preservation. No PyTorch, no BERT, no heavy dependencies.

Installation

pip install assert-eval

Quick Start

from assert_eval import evaluate_summary, LLMConfig

config = LLMConfig(
    provider="bedrock",
    model_id="us.amazon.nova-pro-v1:0",
    region="us-east-1",
)

results = evaluate_summary(
    full_text="Original long text goes here...",
    summary="Summary to evaluate goes here...",
    metrics=["coverage", "factual_consistency", "factual_alignment", "topic_preservation"],
    llm_config=config,
)

print(results)
# {'coverage': 0.85, 'factual_consistency': 0.92, 'factual_alignment': 0.88, 'topic_preservation': 0.90}

Available Metrics

Metric Description
coverage What % of source document claims appear in the summary (recall)
factual_consistency What % of summary claims are supported by the source (precision)
factual_alignment F1 score combining coverage and factual_consistency
topic_preservation How well the main topics from the source are preserved

Custom Evaluation Instructions

Tailor LLM evaluation criteria for your domain:

results = evaluate_summary(
    full_text=text,
    summary=summary,
    metrics=["coverage", "factual_consistency"],
    llm_config=config,
    custom_prompt_instructions={
        "coverage": "Apply strict standards. Only mark a claim as covered if it is clearly and explicitly represented.",
        "factual_consistency": "Flag any claim that adds detail not present in the original text.",
    },
)

LLM Configuration

from assert_eval import LLMConfig

# AWS Bedrock
config = LLMConfig(
    provider="bedrock",
    model_id="us.amazon.nova-pro-v1:0",
    region="us-east-1",
)

# OpenAI
config = LLMConfig(
    provider="openai",
    model_id="gpt-4o",
    api_key="your-openai-api-key",
)

Dependencies

  • assert-core — shared LLM provider layer (AWS Bedrock, OpenAI)

Migrating from assert_llm_tools

assert-eval replaces the summary evaluation functionality of assert_llm_tools, which is now deprecated. The API is largely the same — swap the import:

# Before
from assert_llm_tools import evaluate_summary, LLMConfig

# After
from assert_eval import evaluate_summary, LLMConfig

License

MIT

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

assert_eval-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

assert_eval-0.1.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file assert_eval-0.1.1.tar.gz.

File metadata

  • Download URL: assert_eval-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for assert_eval-0.1.1.tar.gz
Algorithm Hash digest
SHA256 805c2977ab0200c4f59c8c9f53d432cb6092b82728a0be6b092d77351b5c9db9
MD5 e5c2a9cdf9f71127fdb5b39ec18f882f
BLAKE2b-256 8be999ab58f4f02566b29d2dcab988eb049c2d9a77011421c39b7a001bc19358

See more details on using hashes here.

Provenance

The following attestation bundles were made for assert_eval-0.1.1.tar.gz:

Publisher: publish-assert-eval.yml on charliedouglas/assert_llm_tools

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

File details

Details for the file assert_eval-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: assert_eval-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for assert_eval-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a213668370cbf7e03e5f4e9a10d8e404e93e33ac80b3a769e7d4b616fd743ca
MD5 d5d82c3e07d5d3c3738b69e5356bafe4
BLAKE2b-256 4f031afe9ca599afb961060f5c5ee170ee749ad50c4e4decfa328dd33bf27ac8

See more details on using hashes here.

Provenance

The following attestation bundles were made for assert_eval-0.1.1-py3-none-any.whl:

Publisher: publish-assert-eval.yml on charliedouglas/assert_llm_tools

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

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