Tonic Validate Logging
Tonic Validate helps you develop your retrieval augmented generation (RAG) system by providing RAG metrics and a platform for tracking and evaluating experiments and changes to your RAG system. This is Tonic Validate Logging, the logging component of Tonic Validate - how you send your RAG system output to the Tonic Validate Application. When you log RAG system outputs using Tonic Validate Logging, the outputs are scored using Tonic Validate Metrics, and then the outputs and scores are sent to the Tonic Validate Application, where the outputs and responses are visualized allowing you to easily track the performance of you RAG system.
Getting Started
- Sign up for a free Tonic Validate account.
- Install Tonic Validate Logging via pip
pip install tvallogging - Get a Tonic Validate API key, and set it in your environment as the
TONIC_VALIDATE_API_KEYenvironment variable. - Set up a project and a benchmark dataset of questions and reference answers, and the log your RAG system responses to the questions in the benchmark. Use the following code snippet to get started. Tonic Validate uses LLM assisted evaluation to score your RAG responses, so in addition to assuming you have the
TONIC_VALIDATE_API_KEYenvironment variable set to you Tonic Validate API Key, it also assumes you have theOPENAI_API_KEYenvironment variable set so Open AI models can be used to evaluate your RAG responses.import os # to set the environment variables via python os.environ["OPENAI_API_KEY"] = "put-your-openai-api-key-here" os.environ["TONIC_VALIDATE_API_KEY"] = "put-your-tonic-validate-api-key-here" from tvallogging.api import TonicValidateApi from tvallogging.chat_objects import Benchmark project_name: str # name of your new project benchmark_name: str # name of your new benchmark # list of dictionaries of the form # { # "question": "question for the benchmark", # "answer": "reference answer to the question" # } question_with_answer_list: List[Dict[str, str]] api = TonicValidateApi() benchmark = Benchmark.from_json_list(question_with_answer_list) benchmark_id = api.new_benchmark(benchmark, benchmark_name) project = api.new_project(benchmark_id, project_name) llm_evaluator = "gpt-4" run = project.new_run(llm_evaluator) for question_with_answer in run.benchmark.question_with_answer_list: question = question_with_answer.question llm_answer: str # answer obtained from the RAG system retrieved_context_list: List[str] # list of context retrieved by the RAG system # log the llm_answer and retrieved_context_list to Tonic Validate # in this step, the RAG metrics are calculated locally run.log(question_with_answer, llm_answer, retrieved_context_list)
- Review how your RAG system is performing in the Tonic Validate UI.
Documentation and Tonic Validate Metrics
- Tonic Vaidation Documentation has extensive information on how Tonic Validate works and the RAG metrics used in Tonic Validate.
- Check out Tonic Validate Metrics for more information about the RAG metrics used in Tonic Validate and if you're interested in computing the RAG metrics outside of Tonic Validate.
Metadata
Release files for tvallogging 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tvallogging-1.0.0.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tvallogging-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / tvallogging-1.0.0.tar.gz
| Download URL | tvallogging-1.0.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31349d1e33623acc534a0d99baba5990c979712f0a7e0088326860ead8550ac6
|
|
BLAKE2b-256 checksum How to use checksums |
866d3d40f3040caa50534fa7d15d3061229b7d409a67d190225d61767eadeb63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / tvallogging-1.0.0-py3-none-any.whl
| Download URL | tvallogging-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7bcfc77ff318aaeb9eac278badff78b6ad16a96c6cf7ce03c3b2e0632be26af2
|
|
BLAKE2b-256 checksum How to use checksums |
ef5334d50ff087b6d9ffc37f9536f221f3483d0c3d5d89504f94e78db2af5a12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|