Welcome, dear contributor. We are glad you are here. This document will guide you through the process of contributing to this project.
The package lakera_chainguard
allows you to secure Large Language Model (LLM) applications and agents built with LangChain from prompt injection and jailbreaks (and other risks) with Lakera Guard.
This project is open to contributions from anyone. We welcome contributions of all kinds. If you want to give feedback, report a bug or request a feature, please open an issue. If you want to contribute code or documentation, please submit a pull request on the GitHub repository. We will review your contribution and merge it if it is in line with our goals for the package.
We follow the PEP 8 style guide. We use Black to automatically format our code. We perform static type checking with mypy.
These requirements are all enforced by our pre-commit hooks. Make sure to follow the instructions below to set them up.
When contributing, we use the fork and pull request procedure.
The Python environment management is done via poetry. Any Python-related command must therefore be run using poetry run <command>
. This will ensure that the correct environment is used. If the environment is not set up, the command will take care of installing all required dependencies, so you don't need to worry about that.
We use MkDocs and mkdocstrings to automatically generate documentation based on the docstrings in the source code. Therefore, it is important to always update the source code's docstrings according to your code changes. To check the updated docs, run poetry run mkdocs serve
which will serve the documentation on your localhost.
We followed this guide to set up the automatic documentation, so look there for inspiration if you want to contribute to the documentation.
We use pre-commit to run a series of checks on the code before it is committed. This ensures that the code is formatted correctly, that the tests pass, and that the code is properly typed. To set up the pre-commit/pre-push hooks, run poetry run pre-commit install
in the root of the repository.
After you've made your changes and updated any necessary tests, you can commit your changes using the following steps:
-
Create a branch from
main
with thefeature/
prefixgit checkout -b feature/<your-branch-name>
-
Make your changes
-
Stage your changes
git add .
-
Commit your changes with a commit message that follows the Conventional Commits spec Here's an example of a valid commit message:
git commit -m "feat(endpoints): renamed classifiers to endpoints"
Note: This repo uses
pre-commit
hooks to runruff
,black
, andisort
on your code before committing. If any of these checks fail, your commit will be rejected and you will need to stage the changes again and commit them again. -
Push your
feature/*
branch to your fork -
Open a Pull Request to the
main
branch from yourfeature/*
branch
When you submit a Pull Request, please make sure to include a detailed description of the changes you made, and to reference any issues that are related to the Pull Request. We will review your Pull Request and merge it if it is in line with our goals for the project.
All submitted code must pass our pre-commit hooks and CI pipelines, and must be properly tested. If you are unsure about how to write tests, please ask for help.
Thanks to all the people who have contributed to this project, and to the people who have inspired us to create it. In particular, thanks to the team at Lakera AI for their positive feedback and support.
Open an Issue or get in touch with opensource
(at) lakera.ai
.