Skip to main content

Pytest-style test runner for langchain agents

Project description

🦜️🔗✅ pytest-langchain

Pytest-style test runner for langchain projects.

license CI Publish

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.

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

pytest-langchain-0.1.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

pytest_langchain-0.1.0-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page