Uploads results from ragas to Tonic Validate.
Project description
Tonic Validate Ragas Logger
The Tonic Validate Ragas Logger is a tool to upload your results from Ragas to the Tonic Validate UI for visualization. The UI is completely free to use.
To get started, install the validate-ragas-logger
library.
pip install tonic-ragas-logger
After the library is installed, you can start uploading your Ragas results. Here is an example of how to upload Ragas results.
from ragas import evaluate
from datasets import Dataset
from tonic_ragas_logger import RagasValidateApi
dataset = Dataset.from_dict({
'question': [
'What is the capital of France?'
],
'contexts': [
['Paris is the capital of France.']
],
'answer': ['Paris'],
'ground_truths': [['Paris']]
})
results = evaluate(dataset)
# Upload results to the Tonic Validate UI
validate_api = RagasValidateApi("your-api-key")
validate_api.upload_results("your-project-id", results)
To get an API key for Tonic Validate, sign up for an account on our website. When you sign up, you can create an API key on the sidebar.
Once you have an API key, you can either set it in the TONIC_VALIDATE_API_KEY
environment variable or you can input it into the RagasValidateApi
constructor like so
validate_api = RagasValidateApi("your-api-key")
After you have created an API key, you can create a project which allows you to upload your results to the UI. To do so, click on the create a project button on the homepage of Tonic Validate.
After creating your project, you will be provided a project id which you can copy into upload_results
.
validate_api.upload_results("your-project-id", results)
After you execute upload_results
, your results should be visible in the UI.
Congratulations, now you have uploaded your Ragas results to Tonic Validate!
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
Hashes for tonic_ragas_logger-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb469c4283156c355dc0bea978be34875fa3986fe5f9ab7ffaf1eb0fc6462136 |
|
MD5 | 8d86dcb8b55090b29a1c3b360c1bc60b |
|
BLAKE2b-256 | 6880eff71a763420190a4e808c0689416ce70460957fe3f680610af87ad027dc |