No project description provided
Project description
Relari Evaluation Tookit
Requirements
- Python >=3.9.0
- Poetry, official installation guide
Installation
poetry install
Usage
Before being able to use the evaluation toolkit, you need to export the API key
export RELARI_API_KEY=<your_api_key>
To run the evaluation toolkit, you then need to define the evaluation pipeline
dataset = Dataset("<path_to_dataset>")
retriever = Module(
name="retriever",
input=dataset.question,
output=List[Dict[str, str]],
)
reranker = Module(
name="reranker",
input=retriever,
output=List[Dict[str, str]],
)
llm = Module(
name="llm",
input=reranker,
output=str,
)
pipeline = Pipeline([retriever, reranker, llm], dataset=dataset)
this will inform the evaluator about the modules and the dataset you want to use.
Suppose you have three functions retrieve
, rerank
, and ask
that implement the threes steps of the pipeline.
You can then use the ralari evaluation toolkit as follows:
from relari.eval.manager import eval_manager
from relari import RelariClient
client = RelariClient()
eval_manager.set_pipeline(pipeline)
eval_manager.set_metadata({"name": "SimpleRAG"})
with eval_manager.new_experiment as experiment:
for sample in experiment:
q = eval_manager.curr_sample["question"]
# Run and log Retriever results
retrieved_docs = retrieve(q) # Your retrieve function
eval_manager.log("retriever", [doc.__dict__ for doc in retrieved_docs])
# Run and log Reranker results
reranked_docs = rerank(q, retrieved_docs) # Your rerank function
eval_manager.log("reranker", [doc.__dict__ for doc in reranked_docs])
# Run and log Generator results
response = ask(q, reranked_docs) # Your answer generation function
eval_manager.log("llm", response)
print(f"Q: {q}\nA: {response}\n")
eval_manager.evaluation.save(Path("results.jsonl"))
client.start_remote_evaluation()
This will run the evaluation pipeline on the dataset and log the results to the Relari API.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
relari-0.1.5.tar.gz
(8.4 kB
view details)
Built Distribution
relari-0.1.5-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file relari-0.1.5.tar.gz
.
File metadata
- Download URL: relari-0.1.5.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aae9f1e5acfdee7b77cb8ebd2d3557c469388bf6f366fd05f11396ea6943e247 |
|
MD5 | 225e3a971ac529b9f2703c419bebe1b0 |
|
BLAKE2b-256 | c89786669bdc62e3df1f201f0df70a41080c1ca453755466e40e0f8141948fd9 |
File details
Details for the file relari-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: relari-0.1.5-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f5bda550e7bbdcb83bd6c73bfd9132ee89c345dfa85f0344507721b86061ca1 |
|
MD5 | 8f870d0e611b4d46bd52c83b9b795d95 |
|
BLAKE2b-256 | 2d636893e40c934e0690e73a032b4687a5d8bba94a3a4ef818fdb50f47f6f538 |