Skip to main content

ContextCheck Logo

ContextCheck

A human-friendly framework for testing and evaluating LLMs, RAGs, and chatbots.

ContextCheck is an open-source framework designed to evaluate, test, and validate large language models (LLMs), Retrieval-Augmented Generation (RAG) systems, and chatbots. It provides tools to automatically generate queries, request completions, detect regressions, perform penetration tests, and assess hallucinations, ensuring the robustness and reliability of these systems. ContextCheck is configurable via YAML and can be integrated into continuous integration (CI) pipelines for automated testing.

Table of Contents

Features

  • Simple test scenario definition using human-readable .yaml files
  • Flexible endpoint configuration for OpenAI, HTTP, and more
  • Customizable JSON request/response models
  • Support for variables and Jinja2 templating in YAML files
  • Response validation options, including heuristics, LLM-based judgment, and human labeling
  • Enhanced output formatting with the rich package for clear, readable displays

Installation

For Users

Install the package directly from PyPI using pip:

pip install ccheck

After installation, you can access the ccheck CLI command:

ccheck --help

This will display all available options and help you get started with using ContextCheck.

For Developers

If you wish to contribute to the project or modify it for your own use, you can set up a development environment using Poetry.

  1. Fork your own copy of Addepto/contextcheck on GitHub.
  2. Clone the Repository:
git clone https://github.com/<your_username>/contextcheck.git
cd contextcheck
  1. Ensure you have Poetry installed.
  2. Install Dependencies:
poetry install
  1. Activate the Virtual Environment:
poetry shell
  1. Activate the ccheck CLI command using:
poetry run ccheck --help

Tutorial

Please refer to examples/ folder for the tutorial.

CLI Features

Output Test Results to Console

  • Run a single scenario and output results to the console:
    ccheck --output-type console --filename path/to/file.yaml
    
  • Run multiple scenarios and output results to the console:
    ccheck --output-type console --filename path/to/file.yaml path/to/another_file.yaml
    

Running in CI/CD

To automatically stop the CI/CD process if any tests fail, add the --exit-on-failure flag. Failed test will cause the script to exit with code 1:

ccheck --exit-on-failure --output-type console --folder my_tests

Use env variable OPENAI_API_KEY to be able to run:

  • tests/scenario_openai.yaml
  • tests/scenario_defaults.yaml

Contributing

Contributions are welcomed!

Running Tests

To run tests:

poetry run pytest tests/

To include tests which require calling LLM APIs (currently OpenAI and Ollama), run one of:

poetry run pytest --openai          # includes tests that use OpenAI API
poetry run pytest --ollama          # includes tests that use Ollama API
poetry run pytest --openai --ollama # includes tests that use both OpenAI and Ollama API

Acknowledgments

Made with ❤️ by the Addepto Team

ContextCheck is an extension of the ContextClue product, created by the Addepto team. This project is the result of our team’s dedication, combining innovation and expertise.

Addepto Team:

  • Radoslaw Bodus
  • Bartlomiej Grasza
  • Volodymyr Kepsha
  • Vadym Mariiechko
  • Michal Tarkowski

Like what we’re building? ⭐ Give it a star to support its development!

License

This project is licensed under the MIT License - see the LICENSE file for details

Metadata

Release files for ccheck 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccheck 0.1.4
File Size Uploaded
ccheck-0.1.4.tar.gz 25.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccheck 0.1.4
File Interpreter ABI Platform
ccheck-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 63.5 kB

Release files / ccheck-0.1.4.tar.gz

Download URL ccheck-0.1.4.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6fc3c4f9ed7393060d7d06db05a95108c635f731567c70b934d782f16a3d0b84
BLAKE2b-256 checksum
How to use checksums
536cf4fa77f0aed4931c4f7c66c1c1005644a513f2c87be06d02af567d1d7a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.4 Windows/10

Release files / ccheck-0.1.4-py3-none-any.whl

Download URL ccheck-0.1.4-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b45a45314b3e9814a050749abae4f82b53bc5ed1a714ae47373092577ae32b5
BLAKE2b-256 checksum
How to use checksums
c318325034537ed18a1371d9ce2905d3246251e7e0742b03ef974cd489cde99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.4 Windows/10

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page