A flexible task evaluation client
Project description
🧪 task-evaluator
A lightweight, pluggable Python package to evaluate tasks using different model providers like Ollama and OpenAI — with a unified interface.
📦 Installation
pip install llm-evaluator
🚀 Usage
Using Ollama
Before using the LLMEvaluator with Ollama, ensure you have an Ollama server running. If you don't have any, you can start one in your local environment using Ollama CLI. If you don't have it installed, you can download it from here.
After that you can start a server with the following command:
ollama serve
This example assumes you are running a local Ollama server (e.g., at localhost:11434).
from evaluator import LLMEvaluator
# Initialize the Evaluator with Ollama
evaluator = LLMEvaluator(connection="ollama", model="llama3.1:8b", task="summarization")
# Evaluate a task
result = evaluator.evaluate(
text="The quick brown fox jumps over the lazy dog. The dog was not happy about it.",
summary="A fox jumps over a dog.",
)
print(result)
Ollama uses port 11434 by default. If you want to change the port, you can specify the full URI when initializing the LLMEvaluator. For example, if you want to use port 12345, you can do it like this:
from evaluator import LLMEvaluator
evaluator = LLMEvaluator(connection="ollama", model="llama3.1:8b", url="http://localhost:12345", task="summarization")
Using OpenAI
Since we do not deploy any LLM models globally, you can only use OpenAI models with your OpenAI API key. You can find the installation instructions here. You can set your OpenAI API key in your environment variables. For example, in a Unix-like terminal, you can do it like this:
export OPENAI_API_KEY="your_openai_api_key"
Or in a Windows terminal, you can do it like this:
set OPENAI_API_KEY="your_openai_api_key"
You can also set the OpenAI API key in your code directly, but it's not recommended for security reasons.
This example assumes you have set up your OpenAI API key in your environment variables.
from evaluator import LLMEvaluator
import os
# Initialize the Evaluator with OpenAI
evaluator = Evaluator(connection="openai", model="gpt-3.5-turbo", api_key=os.getenv("OPENAI_API_KEY"), task="summarization")
# Evaluate a task
result = evaluator.evaluate(
text="The quick brown fox jumps over the lazy dog. The dog was not happy about it.",
summary="A fox jumps over a dog.",
)
print(result)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evallm-0.1.0.tar.gz.
File metadata
- Download URL: evallm-0.1.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4c00da1998c5535658c63dd79d9f0a6bda957cce8e90aee59edf74cc9dac70
|
|
| MD5 |
3448eac1a09bba5c37733e2d23f90ff6
|
|
| BLAKE2b-256 |
2c38415a36a593bef3ffbb894591ccc96e6871f09212a44f4e9aa81bae89fe9e
|
File details
Details for the file evallm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evallm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad3f5a70c5693ba6a335e1b3690a69a318ef4e9db4002ea4655df7ccd42854e7
|
|
| MD5 |
8e2f8048c1c6e39c3e585aebaea57177
|
|
| BLAKE2b-256 |
eee0e680e61ee4d6dabb2be7e3335b94d977ddd67288dd1a3ef71eb8111e1ecf
|