Skip to main content

Add your description here

Project description

eval-judge

LLM-as-a-judge scoring for AI systems.

Installation

First, install:

pip install eval-judge

or if using uv:

uv add eval-judge

Then, create a .env and add your OPENAI_API_KEY to it.

Example

First, set up the essentials:

# First, create a list of EvalDimensions you want to score on.
my_eval_dimensions = [
    EvalDimension(
        key="humor",
        title="Humor Level",
        definition=(
            "Evaluates how funny the agent is"
        ),
        penalize=[
            "Boring or corny jokes"
        ],
        reward=[
            "Unpredictability"
        ],
        anchors=[
            ScoreAnchor(
                score=1,
                description="Agent is unfunny",
            ),
            ScoreAnchor(
                score=2,
                description="Agent is not very funny",
            ),
            ScoreAnchor(
                score=3,
                description="Agent is not funny nor unfunny",
            ),
            ScoreAnchor(
                score=4,
                description="Agent is moderately funny",
            ),
            ScoreAnchor(
                score=5,
                description="Agent is very funny",
            ),
        ],
    ),
    # more dimensions...
]


# Then, create your config
config = JudgeConfig(
    model="gpt-5.6-luna",
    effort="medium",
    max_output_tokens=3000,
    dimensions=my_eval_dimensions
)


# Then, create a list of ContextMessage, injecting relevant context yourself.
my_messages = [
    ContextMessage(
        message_id="my_id_123",
        context="At the barbecue to a guest in line",
        content="Why did the LLM go to the gym? For weight training!"
    ),
    # more messages...
]

For regular users (recommended):

# Create Judge based off config
judge = Judge(config=config)


# Get results; may take a while due to async OpenAI batching
results = judge.evaluate_batch(messages=my_messages)

For advanced users:

# Then build your requests batch
jsonl_path = build_requests_batch(
    messages=my_messages, 
    output_path="path/to/jsonl", # where you want to write the JSONL
    config=config
)


# Then, submit your batch
batch_id = submit_batch(jsonl_path=jsonl_path)


# Blocks until OpenAI batch results available and saves results to disk
batch_output_path = "path/to/batch/output" # where you want to write the raw batch output


# Also returns raw JSONL output directly
raw_jsonl = retrieve_batch(batch_id=batch_id, output_path=batch_output_path)


# Extract relevant information from full OpenAI batch results
results = load_and_parse_results(input_path=batch_output_path)

Both approaches produce the same result structure. Enjoy!

License

Apache License 2.0 - see LICENSE for details.

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

eval_judge-0.1.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

eval_judge-0.1.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file eval_judge-0.1.2.tar.gz.

File metadata

  • Download URL: eval_judge-0.1.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for eval_judge-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c39fb5b5da76d60050c8912c0c68948668dc172ba6c9b35b947616059d2f18bf
MD5 300f626bd0ce96c17c6a4a53bc21e6f3
BLAKE2b-256 19dad824ece64fa400b3b250a9c6499d3dfb69e99675a95c202cbb0db2844615

See more details on using hashes here.

File details

Details for the file eval_judge-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: eval_judge-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for eval_judge-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7541393bd7211ad828f55e28406c42d23ccca7e30625aa7b7b0150ded12b6f3b
MD5 ec3d252b1bb23cb9d8cf547c550e0c41
BLAKE2b-256 9e6c79fc215efcbdf4fdf6d83e283a37200aa2b44686d6c93b1757e7b4887373

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