Skip to main content

LLM plugin to compare responses from multiple language models

Project description

llm-compare

PyPI License

LLM plugin to compare responses from multiple language models and evaluate their performance.

Installation

Install this plugin in the same environment as LLM:

llm install llm-compare

Usage

The plugin adds a new compare command that allows you to send the same prompt to multiple models and compare their responses:

llm compare "What are the key considerations for AI safety?"

This will:

  1. Send the prompt to multiple models in parallel
  2. Gather their responses
  3. Use an evaluator model to analyze and compare the responses
  4. Generate a synthesis of the best elements from each response

Options

  • -m, --models: Models to include in comparison (can specify multiple)
  • --evaluator: Model to use as evaluator (default: gpt-4)
  • --score-threshold: Minimum score threshold (default: 0.7)
  • --output: Save full results to a JSON file
  • --stdin/--no-stdin: Read additional input from stdin (default: True)

Examples

Basic usage with default models:

llm compare "Explain quantum computing"

Using specific models:

llm compare "Explain blockchain technology" \
  -m gpt-4 \
  -m claude-3-sonnet \
  -m gemini-pro \
  --evaluator claude-3-opus-20240229

Reading from a file:

cat prompt.txt | llm compare "Analysis request:"

Saving full results:

llm compare "Complex technical question" \
  -m gpt-4 \
  -m claude-3-opus \
  --output results.json

Output Format

The command outputs:

  1. Individual responses from each model
  2. Detailed comparison and analysis
  3. Scores for each response
  4. Key points of agreement and disagreement
  5. A synthesized best answer

Development

To set up this plugin locally:

git clone https://github.com/yourusername/llm-compare
cd llm-compare
python -m venv venv
source venv/bin/activate
pip install -e '.[test]'

Run tests:

pytest

License

This project is licensed under the Apache License 2.0.

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

llm_compare-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

llm_compare-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_compare-0.1.0.tar.gz.

File metadata

  • Download URL: llm_compare-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for llm_compare-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d3bc8b0b5382536d8095f8c76e0b643d0dbcfb0af284157531272d039074015d
MD5 136b01db56a3dbb160812870dada88a3
BLAKE2b-256 0b2ad4dd67ee87957fff39aed4ddff6d02b960322ec0f46827241c2d929ba477

See more details on using hashes here.

File details

Details for the file llm_compare-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_compare-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for llm_compare-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 023b3c585ebcdc52e30793bb35a37aa8ebccda5a212998ea48ddfd26262d691d
MD5 e78ca408687628f5a260210719d565a9
BLAKE2b-256 0f7804a9062d1a73294c54624ea13997e2f83aedfc75c9890034b63631a7999f

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