langchain4j/CONTRIBUTING.md

69 lines
5.7 KiB
Markdown
Raw Normal View History

2024-04-18 18:00:31 +08:00
Thank you for investing your time and effort in contributing to our project, we appreciate it a lot! 🤗
2024-04-25 17:14:34 +08:00
# General guidelines
2024-04-27 00:05:29 +08:00
- If you want to contribute a bug fix or a new feature that isn't listed in the [issues](https://github.com/langchain4j/langchain4j/issues) yet, please open a new issue for it. We will prioritize is shortly.
2024-04-18 18:00:31 +08:00
- Follow [Google's Best Practices for Java Libraries](https://jlbp.dev/)
- Keep the code compatible with Java 8. We plan to increase the baseline to Java 17 a bit later.
2024-07-25 15:52:23 +08:00
- 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.
2024-04-19 03:23:09 +08:00
- Write unit and/or integration tests for your code. This is critical: no tests, no review!
2024-07-25 15:52:23 +08:00
- Avoid making breaking changes. Always keep backward compatibility in mind. For example, instead of removing fields/methods/etc, mark them `@Deprecated` and make sure they still work as before.
2024-04-18 18:00:31 +08:00
- Follow existing naming conventions.
2024-09-09 20:32:34 +08:00
- Avoid using Lombok in the new code, and remove it from the old code if you get a chance.
2024-04-18 18:00:31 +08:00
- Add Javadoc where necessary. There's no need to duplicate Javadoc from the implemented interfaces.
- Follow existing code style present in the project.
2024-04-19 03:23:09 +08:00
- Large features should be discussed with maintainers before implementation. Please ping @langchain4j in the comments on the issue.
2024-04-18 18:00:31 +08:00
# Priorities
2024-04-18 18:00:31 +08:00
All [issues](https://github.com/langchain4j/langchain4j/issues) are prioritized by maintainers. There are 4 priorities: [P1](https://github.com/langchain4j/langchain4j/issues?q=is%3Aissue+is%3Aopen+label%3AP1), [P2](https://github.com/langchain4j/langchain4j/issues?q=is%3Aissue+is%3Aopen+label%3AP2), [P3](https://github.com/langchain4j/langchain4j/issues?q=is%3Aissue+is%3Aopen+label%3AP3) and [P4](https://github.com/langchain4j/langchain4j/issues?q=is%3Aissue+is%3Aopen+label%3AP4).
Please start with the higher priorities. PRs will be reviewed in order of priority, with bugs being a higher priority than new features.
2024-04-27 00:05:29 +08:00
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.
2024-04-18 18:00:31 +08:00
# Opening an issue
- Please fill in all sections of the issue template.
2024-04-27 00:05:29 +08:00
# Opening a draft PR
2024-04-27 00:05:29 +08:00
- 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).
2024-04-18 18:00:31 +08:00
- 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.
2024-04-27 00:05:29 +08:00
# Finalizing the draft PR
2024-04-27 00:05:29 +08:00
- Add [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) (if required).
- Add an example to the [examples repository](https://github.com/langchain4j/langchain4j-examples) (if required).
- [Mark a PR as ready for review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review)
2024-04-18 18:00:31 +08:00
# Guidelines on adding a new model integration
2024-04-18 18:00:31 +08:00
- [Integration with Anthropic](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-anthropic) is a good example.
- Use the official SDK if available.
2024-06-07 18:24:01 +08:00
- If the official SDK is not available, use Retrofit and Jackson to implement the client.
2024-04-18 18:00:31 +08:00
- Document the new integration [here](https://github.com/langchain4j/langchain4j/blob/main/README.md), [here](https://github.com/langchain4j/langchain4j/tree/main/docs/docs/integrations/language-models) and [here](https://github.com/langchain4j/langchain4j/blob/main/docs/docs/integrations/language-models/index.md).
- Add an example to the [examples repository](https://github.com/langchain4j/langchain4j-examples), similar to [this](https://github.com/langchain4j/langchain4j-examples/tree/main/anthropic-examples).
- Add a new module to the appropriate section of the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml).
- It would be great if you could add a [Spring Boot starter](https://github.com/langchain4j/langchain4j-spring).
# Guidelines on adding a new embedding store integration
2024-04-18 18:00:31 +08:00
- [Integration with Chroma](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-chroma) is a good example.
- Use the official SDK if available.
2024-06-07 18:24:01 +08:00
- If the official SDK is not available, use Retrofit and Jackson to implement the client.
2024-07-25 15:52:23 +08:00
- Add a `{IntegrationName}EmbeddingStoreIT`. It should extend from `EmbeddingStoreWithFilteringIT` (when store supports metadata filtering) or `EmbeddingStoreIT` and pass all tests.
- Add a `{IntegrationName}EmbeddingStoreRemovalIT`. It should extend from `EmbeddingStoreWithRemovalIT` and pass all tests.
2024-04-18 18:00:31 +08:00
- Document the new integration [here](https://github.com/langchain4j/langchain4j/blob/main/README.md), [here](https://github.com/langchain4j/langchain4j/tree/main/docs/docs/integrations/embedding-stores) and [here](https://github.com/langchain4j/langchain4j/blob/main/docs/docs/integrations/embedding-stores/index.md).
- Add an example to the [examples repository](https://github.com/langchain4j/langchain4j-examples), similar to [this](https://github.com/langchain4j/langchain4j-examples/tree/main/chroma-example).
- Add a new module to the appropriate section of the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml).
- It would be great if you could add a [Spring Boot starter](https://github.com/langchain4j/langchain4j-spring). (after
2024-04-27 00:05:29 +08:00
# Guidelines on changing an existing embedding store integration
2024-04-27 00:05:29 +08:00
- Ensure that your changes are backwards compatible. `Embedding`s and `TextSegment`s persisted with the latest released version of LangChain4j should still work.