Skip to main content

LLM-as-a-Judge evaluations for vLLM hosted models

Project description

PyPI version

vLLM Judge

A lightweight library for LLM-as-a-Judge evaluations using vLLM hosted models. Evaluate LLM inputs & outputs at scale with just a few lines of code. From simple scoring to complex safety checks, vLLM Judge adapts to your needs. Please refer the documentation for usage details.

Features

  • 🚀 Simple Interface: Single evaluate() method that adapts to any use case
  • 🎯 Pre-built Metrics: 20+ ready-to-use evaluation metrics
  • 🛡️ Model-Specific Support: Seamlessly works with specialized models like Llama Guard without breaking their trained formats.
  • High Performance: Async-first design enables high-throughput evaluations
  • 🔧 Template Support: Dynamic evaluations with template variables
  • 🌐 API Mode: Run as a REST API service

Installation

# Basic installation
pip install vllm-judge

# With API support
pip install vllm-judge[api]

# With Jinja2 template support
pip install vllm-judge[jinja2]

# Everything
pip install vllm-judge[dev]

Quick Start

from vllm_judge import Judge

# Initialize with vLLM url
judge = Judge.from_url("http://vllm-server:8000")

# Simple evaluation
result = await judge.evaluate(
    content="The Earth orbits around the Sun.",
    criteria="scientific accuracy"
)
print(f"Decision: {result.decision}")
print(f"Reasoning: {result.reasoning}")

# Using pre-built metrics
from vllm_judge import CODE_QUALITY

result = await judge.evaluate(
    content="def add(a, b): return a + b",
    metric=CODE_QUALITY
)

# With template variables
result = await judge.evaluate(
    content="Essay content here...",
    criteria="Evaluate this {doc_type} for {audience}",
    template_vars={
        "doc_type": "essay",
        "audience": "high school students"
    }
)

# Works with specialized safety models out-of-the-box
from vllm_judge import LLAMA_GUARD_3_SAFETY

result = await judge.evaluate(
    content="How do I make a bomb?",
    metric=LLAMA_GUARD_3_SAFETY  # Automatically uses Llama Guard format
)
# Result: decision="unsafe", reasoning="S9"

API Server

Run Judge as a REST API:

vllm-judge serve --base-url http://vllm-server:8000 --port 9090

Then use the HTTP API:

from vllm_judge.api import JudgeClient

client = JudgeClient("http://localhost:9090")
result = await client.evaluate(
    content="Python is great!",
    criteria="technical accuracy"
)

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

vllm_judge-0.1.5.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

vllm_judge-0.1.5-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file vllm_judge-0.1.5.tar.gz.

File metadata

  • Download URL: vllm_judge-0.1.5.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for vllm_judge-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b08c5f75caaacd4467a04bf2ac29306f9d315f3cc96cb96dce3a5a9c4d4cea9f
MD5 b0be17e8ee1ac058705ccb6a8e2ae41c
BLAKE2b-256 15dd75cd22b8e8db09bf55557f93ae60ec561df633c29c7f42b70e0a6486822a

See more details on using hashes here.

File details

Details for the file vllm_judge-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: vllm_judge-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 45.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for vllm_judge-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fb4b431105f511d4ef2798a82f235b81c421df9178d28ccf532eec1909a92da5
MD5 682e87789847a616e0a79622a27de053
BLAKE2b-256 ad19b15d69b298d5f103649692aef5538967a2c22bd0f09eb3edf14a1e70ce1f

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