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.0.1.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file relari-0.0.1.tar.gz
.
File metadata
- Download URL: relari-0.0.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7827eb768bb9c01aa5cac6a66b238c7d67ee35260ac22f1de86b90aaffc04f52 |
|
MD5 | 7fdf42e61119fdcc5c056217088072a7 |
|
BLAKE2b-256 | cc86e8aafb2514c6a2b59ba18c82fda1b9d3b3e0624d8c5ab336ae9fb8e9439d |
File details
Details for the file relari-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: relari-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b89a6a8c4702a33d4c97fe47631733e077fd3201729c23e8795507080423bc5e |
|
MD5 | b21f1a569843c8fea9d815e82d350183 |
|
BLAKE2b-256 | 4daea720068982247361203b57b7c5de4bc9d96a853a19331110095cbab7d4f1 |