Thank you for investing your time and effort in contributing to our project, we appreciate it a lot! 🤗
- For new integrations, please consider adding it in community repo first.
- If you want to contribute a bug fix or a new feature that isn't listed in the issues yet, please open a new issue for it. We will triage is shortly.
- Follow Google's Best Practices for Java Libraries
- Keep the code compatible with Java 17.
- When integrating third-party services, use the official SDK whenever possible. If no official SDK is available, implement the client using
langchain4j-http-clientand Jackson. - Avoid adding new dependencies as much as possible (new dependencies with test scope are OK). If absolutely necessary, try to use the same libraries which are already used in the project. Make sure you run
mvn dependency:analyzeto identify unnecessary dependencies. - Write unit and/or integration tests for your code. This is critical: no tests, no review!
- The tests should cover both positive and negative cases.
- Make sure you run all unit tests on all modules with
mvn clean test. Some integration tests need the API token (key) to be set up as an environment variable in order to communicate with the configured model provider (look for "EnabledIfEnvironmentVariable" annotation to find out the name of this token). - Avoid making breaking changes. Always keep backward compatibility in mind. For example, instead of removing fields/methods/etc, mark them
@Deprecatedand make sure they still work as before. - Follow existing naming conventions.
- Add Javadoc where necessary. There's no need to duplicate Javadoc from the implemented interfaces.
- Follow existing code style present in the project. Run
make lintandmake formatbefore commit. - Large features should be discussed with maintainers before implementation.
- Please fill in all sections of the issue template.
- Please open the PR as a draft initially. Once it is reviewed and approved, we will then ask you to finalize it (see section below).
- Fill in all the sections of the PR template.
- Please make it easier to review your PR:
- Keep changes as small as possible.
- Do not combine refactoring with changes in a single PR.
- Avoid reformatting existing code.
Please note that we do not have the capacity to review PRs immediately. We ask for your patience. We are doing our best to review your PR as quickly as possible.
- Add documentation (if required).
- Add an example to the examples repository (if required).
- Run
./mvnw spotless:checkand./mvnw spotless:applyto ensure compliance with the source code formatting of the project. - Mark a PR as ready for review
- Please open PRs with new model integrations in the langchain4j-community repository
- Integration with OpenAI is a good example.
- Create integration test classes that extend from
AbstractChatModelIT,AbstractStreamingChatModelIT,AbstractChatModelListenerIT,AbstractStreamingChatModelListenerITandAbstractStreamingAiServiceIT. There are many examples in existing modules. - If model provider supports tools, create an integration test class that extends from
AbstractAiServiceWithToolsIT. There are many examples in existing modules. - If model provider supports structured outputs, create an integration test class that extends from
AbstractAiServiceWithJsonSchemaIT. There are many examples in existing modules. - Document the new integration here, here and here.
- Add an example to the examples repository, similar to this.
- Add a new module to the appropriate section of the BOM.
- It would be great if you could add a Spring Boot starter.
- Please open PRs with new embedding store integrations in the langchain4j-community repository
- Integration with Chroma is a good example.
- Add a
{IntegrationName}EmbeddingStoreIT. It should extend fromEmbeddingStoreWithFilteringIT(when store supports metadata filtering) orEmbeddingStoreITand pass all tests. - Add a
{IntegrationName}EmbeddingStoreRemovalIT. It should extend fromEmbeddingStoreWithRemovalITand pass all tests. - Document the new integration here, here and here.
- Add an example to the examples repository, similar to this.
- Add a new module to the appropriate section of the BOM.
- It would be great if you could add a Spring Boot starter. (after
- Ensure that your changes are backwards compatible.
Embeddings andTextSegments persisted with the latest released version of LangChain4j should still work.