pytest-langchain
pytest-langchain copied to clipboard
✅ Pytest-style test runner for langchain projects
🦜️🔗✅ pytest-langchain
Pytest-style test runner for langchain projects.
Installation
Install from PyPI:
pip install pytest-langchain
Install from source:
git clone https://github.com/ajndkr/pytest-langchain
cd pytest-langchain
pip install .
Usage
-
Serialise your LLM chain into a YAML file. Refer to docs for more details.
-
Create a new configuration YAML file to run
pytest-langchain
with the following structure:chain_file: <path to chain YAML file> test_cases: - [<input-1>, <expected output-1>] - [<input-2>, <expected output-2>] - ...
-
Run
pytest-langchain
:pytest-langchain -c <path to config YAML file> --openai-api-key <OPENAI API key>
For more options, run
pytest-langchain --help
.