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.1.tar.gz (10.8 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.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eval_judge-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 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.1.tar.gz
Algorithm Hash digest
SHA256 6e298e897621c13a95e967e022be2287478b034d642996cedcffec07be3e382f
MD5 027b19829311f5671d3818e7cc5bc4ae
BLAKE2b-256 c86ee0e16d2eddec7ae846c65b1a28443f18da0ee5889416118cf6a82040c9ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eval_judge-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a603376330756b26bdf0b3c617173fa4a8115814dfa329fa207612761ae5655
MD5 38658625a88b08e4901349f7c4d057f9
BLAKE2b-256 434e0abfabd52a1658aa204868b7272a23febbe8d300a8b763ebc087d671abf0

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