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.
  • 🔄 Async Native: Built for high-throughput evaluations
  • 🔧 Template Support: Dynamic evaluations with template variables
  • High Performance: Optimized for vLLM with automatic batching
  • 🌐 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(
    response="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(
    response="def add(a, b): return a + b",
    metric=CODE_QUALITY
)

# With template variables
result = await judge.evaluate(
    response="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(
    response="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(
    response="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.2.tar.gz (31.7 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.2-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vllm_judge-0.1.2.tar.gz
  • Upload date:
  • Size: 31.7 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.2.tar.gz
Algorithm Hash digest
SHA256 f3d6cebac5b650cbb4fa5dfdf732c26119cdc8e6691aba54bf8560c6dc1bba65
MD5 4ddeeaa7339e9cc00b309833f0d1cd2a
BLAKE2b-256 11a270da84ca6b4cf4122656ebee8244325ac15cc27beadd63532f0e79a69f6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vllm_judge-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 35.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dfed9ae49b04e0379601c06a9021d5b7914545d7b7a6957c944d6bc56d0907c1
MD5 efb31bec60ccee44f5f20c86e1ad26a0
BLAKE2b-256 cfc04821d47491e4cf48ecf561d3140eff20c69e03ab2a683c4f8b57b71e0438

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