Contribution Guidelinesยถ

Thanks for considering contributing to OPEA project. The contribution process is similar with other open source projects on Github, involving an amount of open discussion in issues and feature requests between the maintainers, contributors and users.

All The Ways To Contributeยถ

Contribute a GenAI Componentยถ

  1. Navigate to OPEA GenAIComps and locate the component folder your integration belongs to. If the microservice type already exists, review the OPEA microservice API and follow it in your implementation. Otherwise, if you are contributing a brand new microservice type, you need to define and contribute first its API specification. Please start by submitting an RFC to get community feedback.

    GenAIComps
    โ”œโ”€โ”€ comps
    โ”‚ย ย  โ”œโ”€โ”€ agent
    โ”‚ย ย  โ”œโ”€โ”€ asr
    โ”‚ย ย  โ”œโ”€โ”€ chathistory
    โ”‚ย ย  โ”œโ”€โ”€ cores
    โ”‚   โ”‚   โ”œโ”€โ”€ mega     #orchestrator, gateway, micro_service class code
    โ”‚   โ”‚   โ”œโ”€โ”€ proto    #api protocol
    โ”‚   โ”‚   โ””โ”€โ”€ telemetry
    โ”‚ย ย  โ”œโ”€โ”€ dataprep
    โ”‚ย ย  โ”œโ”€โ”€ embeddings
    โ”‚ย ย  โ”œโ”€โ”€ feedback_management
    โ”‚ย ย  โ”œโ”€โ”€ finetuning
    โ”‚ย ย  โ”œโ”€โ”€ guardrails
    โ”‚ย ย  โ”œโ”€โ”€ intent_detection
    โ”‚ย ย  โ”œโ”€โ”€ knowledgegraphs
    โ”‚ย ย  โ”œโ”€โ”€ llms
    โ”‚ย ย  โ”œโ”€โ”€ lvms
    โ”‚ย ย  โ”œโ”€โ”€ nginx
    โ”‚ย ย  โ”œโ”€โ”€ prompt_registry
    โ”‚ย ย  โ”œโ”€โ”€ ragas
    โ”‚ย ย  โ”œโ”€โ”€ reranks
    โ”‚ย ย  โ”œโ”€โ”€ retrievers
    โ”‚ย ย  โ”œโ”€โ”€ tts
    โ”‚ย ย  โ”œโ”€โ”€ vectorstores
    โ”‚ย ย  โ””โ”€โ”€ web_retrievers
    โ””โ”€โ”€ tests
     ย ย  โ”œโ”€โ”€ agent
     ย ย  โ”œโ”€โ”€ asr
     ย ย  โ”œโ”€โ”€ chathistory
     ย ย  โ”œโ”€โ”€ cores
     ย ย  โ”œโ”€โ”€ dataprep
     ย ย  โ”œโ”€โ”€ embeddings
     ย ย  โ”œโ”€โ”€ feedback_management
     ย ย  โ”œโ”€โ”€ finetuning
     ย ย  โ”œโ”€โ”€ guardrails
     ย ย  โ”œโ”€โ”€ intent_detection
     ย ย  โ”œโ”€โ”€ llms
     ย ย  โ”œโ”€โ”€ lvms
     ย ย  โ”œโ”€โ”€ nginx
     ย ย  โ”œโ”€โ”€ prompt_registry
     ย ย  โ”œโ”€โ”€ reranks
     ย ย  โ”œโ”€โ”€ retrievers
     ย ย  โ”œโ”€โ”€ tts
     ย ย  โ”œโ”€โ”€ vectorstores
     ย ย  โ””โ”€โ”€ web_retrievers
    
  2. Follow the folder structure in the TEI embedding component below:

    GenAIComps
    โ”œโ”€โ”€ comps
    โ”‚   โ””โ”€โ”€ embeddings
    โ”‚       โ”œโ”€โ”€ __init__.py
    โ”‚       โ””โ”€โ”€ tei     #vendor name or serving framework name
    โ”‚           โ”œโ”€โ”€ langchain
    โ”‚           โ”‚   โ”œโ”€โ”€ Dockerfile
    โ”‚           โ”‚   โ”œโ”€โ”€ Dockerfile.amd_gpu
    โ”‚           โ”‚   โ”œโ”€โ”€ Dockerfile.nvidia_gpu
    โ”‚           โ”‚   โ”œโ”€โ”€ embedding_tei.py    # definition and registration of microservice
    โ”‚           โ”‚   โ”œโ”€โ”€ README.md
    โ”‚           โ”‚   โ””โ”€โ”€ requirements.txt
    โ”‚           โ””โ”€โ”€ llama_index
    โ”‚               โ””โ”€โ”€ . . .
    โ”œโ”€โ”€ tests
    โ”‚   โ””โ”€โ”€ embeddings
    โ”‚       โ”œโ”€โ”€ test_embeddings_tei_langchain.sh
    โ”‚       โ”œโ”€โ”€ test_embeddings_tei_langchain_on_amd_gpu.sh
    โ”‚       โ””โ”€โ”€ test_embeddings_tei_llama_index.sh
    โ””โ”€โ”€ README.md
    
    
    • File Descriptions:

      • embedding_tei.py: This file defines and registers the microservice. It serves as the entrypoint of the Docker container. Refer to whisper ASR for a simple example or TGI for a more complex example that required adapting to the OpenAI API.

      • requirements.txt: This file is used by Docker to install the necessary dependencies.

      • Dockerfile: Used to generate the service container image. Please follow naming conventions:

        • Dockerfile: Dockerfile.[vendor]_[hardware], vendor and hardware in lower case (i,e Dockerfile.amd_gpu)

        • Docker Image: opea/[microservice type]-[microservice sub type]-[library name]-[vendor]-[hardware]:latest all lower case (i,e opea/llm-vllm-intel-hpu, opea/llm-faqgen-tgi-intel-hpu-svc)

      • tests/[microservices type]/ : contains end-to-end test for microservices Please refer to an example test_asr_whisper.sh. Please follow naming convention:test_[microservice type]_[microservice sub type]_[library name]_on_[vendor]_[hardware].sh

      • tests/cores/ : contains Unit Tests (UT) for the core python components (orchestrator, gatewayโ€ฆ). Please follow the naming convention:test_[core component].sh

      • README.md: at minimum it should include: microservice description, build, and start commands and a curl command with expected output.

  3. Now you have created all the required files, and validated your service. Last step is to modify the README.md at the component level GenAIComps/comps/[microservice type] to list your new component. Now you are ready to file your PR! Once your PR is merged, in the next release the project release maintainers will publish the Docker Image for the same to the Docker Hub.

  4. After your component has been merged, you are likely interested in building an application with it, and perhaps contributing it also to OPEA! Please continue on to the Contribute a GenAI Example guide.

Contribute a GenAI Exampleยถ

Each of the samples in OPEA GenAIExamples are a common oft used solution. They each have scripts to ease deployment, and have been tested for performance and scalability with Docker compose and Kubernetes. When contributing an example, a Docker Compose deployment is the minimum requirement. However, since OPEA is intended for enterprise applications, supporting Kubernetes deployment is highly encouraged. You can find examples for Kubernetes deployment using manifests, Helms Charts, and the GenAI Microservices Connector (GMC). GMC offers additional enterprise features, such as the ability to dynamically adjust pipelines on Kubernetes (e.g., switching to a different LLM on the fly, adding guardrails), composing pipeleines that include external services hosted in public cloud or on-premisees via URL, and supporting sequential, parallel and conditional flows in the pipelines.

  • Navigate to OPEA GenAIExamples and check the catalog of examples. If you find one that is very similar to what you are looking for, you can contribute your variation of it to that particular example folder. If you are bringing a completly new application you will need to create a separate example folder.

  • Before stitching together all the microservices to build your application, letโ€™s make sure all the required building blocks are available!. Take a look at this ChatQnA Flow Chart:

flowchart LR %% Colors %% classDef blue fill:#ADD8E6,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5 classDef orange fill:#FBAA60,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5 classDef orchid fill:#C26DBC,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5 classDef invisible fill:transparent,stroke:transparent; style ChatQnA-MegaService stroke:#000000 %% Subgraphs %% subgraph ChatQnA-MegaService["ChatQnA-MegaService"] direction LR EM([Embedding <br>]):::blue RET([Retrieval <br>]):::blue RER([Rerank <br>]):::blue LLM([LLM <br>]):::blue end subgraph User Interface direction TB a([User Input Query]):::orchid Ingest([Ingest data]):::orchid UI([UI server<br>]):::orchid end subgraph ChatQnA GateWay direction LR invisible1[ ]:::invisible GW([ChatQnA GateWay<br>]):::orange end subgraph . X([OPEA Micsrservice]):::blue Y{{Open Source Service}} Z([OPEA Gateway]):::orange Z1([UI]):::orchid end TEI_RER{{Reranking service<br>}} TEI_EM{{Embedding service <br>}} VDB{{Vector DB<br><br>}} R_RET{{Retriever service <br>}} DP([Data Preparation<br>]):::blue LLM_gen{{LLM Service <br>}} %% Data Preparation flow %% Ingest data flow direction LR Ingest[Ingest data] -->|a| UI UI -->|b| DP DP <-.->|c| TEI_EM %% Questions interaction direction LR a[User Input Query] -->|1| UI UI -->|2| GW GW <==>|3| ChatQnA-MegaService EM ==>|4| RET RET ==>|5| RER RER ==>|6| LLM %% Embedding service flow direction TB EM <-.->|3'| TEI_EM RET <-.->|4'| R_RET RER <-.->|5'| TEI_RER LLM <-.->|6'| LLM_gen direction TB %% Vector DB interaction R_RET <-.->|d|VDB DP <-.->|d|VDB
  • OPEA uses gateways to handle requests and route them to the corresponding megaservices (unless you have an agent that will otherwise handle the gateway function). If you are just making small changes to the application, like swaping one DB for another, you can reuse the existing Gateway but if you are contributing a completely new application, you will need to add a Gateway class. Navigate to OPEA GenAIComps Gateway and implement how Gateway should handle requests for your application. Note that Gateway implementation is moving to GenAIExamples in future release.

  • Follow the folder structure in the ChatQA example below:

    โ”œโ”€โ”€ assets
    โ”œโ”€โ”€ benchmark     # optional
    โ”œโ”€โ”€ chatqna.py    # Main application definition (microservices, megaservice, gateway).
    โ”œโ”€โ”€ chatqna.yaml  # starting v1.0 used to generate manifests for k8s w orchestrator_with_yaml
    โ”œโ”€โ”€ docker_compose
    โ”‚   โ”œโ”€โ”€ intel
    โ”‚   โ”‚   โ”œโ”€โ”€ cpu
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ xeon
    โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ compose.yaml
    โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ README.md
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ set_env.sh  #export env variables
    โ”‚   โ”‚   โ””โ”€โ”€ hpu
    โ”‚   โ”‚       โ””โ”€โ”€ gaudi
    โ”‚   โ”‚           โ”œโ”€โ”€ compose.yaml
    โ”‚   โ”‚           โ”œโ”€โ”€ how_to_validate_service.md    #optional
    โ”‚   โ”‚           โ”œโ”€โ”€ README.md
    โ”‚   โ”‚           โ””โ”€โ”€ set_env.sh
    โ”‚   โ””โ”€โ”€ nvidia
    โ”‚       โ””โ”€โ”€ gpu
    โ”‚           โ”œโ”€โ”€ compose.yaml
    โ”‚           โ”œโ”€โ”€ README.md
    โ”‚           โ””โ”€โ”€ set_env.sh
    โ”œโ”€โ”€ Dockerfile
    โ”œโ”€โ”€ docker_image_build
    โ”‚   โ””โ”€โ”€ build.yaml
    โ”œโ”€โ”€ kubernetes
    โ”‚   โ”œโ”€โ”€ intel
    โ”‚   โ”‚   โ”œโ”€โ”€ cpu
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ xeon
    โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ gmc
    โ”‚   โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ chatQnA_xeon.yaml
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ manifest
    โ”‚   โ”‚   โ”‚           โ””โ”€โ”€ chatqna.yaml
    โ”‚   โ”‚   โ””โ”€โ”€ hpu
    โ”‚   โ”‚       โ””โ”€โ”€ gaudi
    โ”‚   โ”‚           โ”œโ”€โ”€ gmc
    โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ chatQnA_gaudi.yaml
    โ”‚   โ”‚           โ””โ”€โ”€ manifest
    โ”‚   โ”‚               โ””โ”€โ”€ chatqna.yaml
    โ”‚   โ”œโ”€โ”€ amd
    โ”‚   โ”‚   โ”œโ”€โ”€ cpu
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ gmc
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ manifest
    โ”‚   โ”‚   โ””โ”€โ”€ gpu
    โ”‚   โ”‚       โ”œโ”€โ”€ gmc
    โ”‚   โ”‚       โ””โ”€โ”€ manifest
    โ”‚   โ”œโ”€โ”€ README_gmc.md  # K8s quickstar
    โ”‚   โ””โ”€โ”€ README.md      # quickstart
    โ”œโ”€โ”€ README.md
    โ”œโ”€โ”€ tests
    โ”‚   โ”œโ”€โ”€ test_compose_on_gaudi.sh  #could be more tests for different flavors of the app
    โ”‚   โ”œโ”€โ”€ test_gmc_on_gaudi.sh
    โ”‚   โ”œโ”€โ”€ test_manifest_on_gaudi.sh
    โ””โ”€โ”€ ui
    
    
    • File Descriptions:

      • chatqna.py: application definition using microservice, megaservice and gateway. There could be multiple .py in the folder based on slight modification of the example application.

      • docker_build_image/build.yaml: builds necessary images pointing to the Dockerfiles in the GenAIComp repository.

      • docker_compose/vendor/device/compose.yaml: defines pipeline for Docker compose deployment. For selectng docker image name please follow the naming convention:

        • Docker Image: opea/[example name]-[feature name]:latest all lower case (i,e: opea/chatqna, opea/codegen-react-ui)

      • kubernetes/vendor/device/manifests/chatqna.yaml: used for K8s deployemnt

      • kubernetes/vendor/device/gmc/chatqna.yaml: (optional) used for deployment with GMC

      • tests/: at minimum you need to provide an E2E test with Docker compose. If you are contritbutng K8s manifests and GMC yaml, you should also provide test for those. Please follow naming convention:

        • Docker compose test: tests/test_compose_on_[hardware].sh

        • K8s test: tests/test_manifest_on_[hardware].sh

        • K8s with GMC test: tests/test_gmc_on_[hardware].sh

      • ui: (optional)

      • assets: nice to have an application flow diagram

Additional steps if your contribution is Hardware Specificยถ

You will need additional steps to configure the CI/CD for first testing and then deploying your merged GenAIComp or GenAIExample.

  • Connect hardware into OPEA GitHub Actions (GHA) as a self-hosted runner

  • Contribute test scripts for the new hardware

  • Dockerfile for the Component (i,e GenAIComp/comps/llm/text-generation/tgi/Dockerfile.[vendor]_[hardware] )

  • Update the image build yaml for new images

  • Update the CI/CD workflow to identify and deploy new test

OPEA maintainer @chensuyue can assist in this process.

Community Discussionsยถ

Developers are encouraged to participate in discussions by opening an issue in one of the GitHub repos at https://github.com/opea-project. Alternatively, they can send an email to info@opea.dev or subscribe to X/Twitter and LinkedIn Page to get latest updates about the OPEA project.

Documentationยถ

The quality of OPEA projectโ€™s documentation can have a huge impact on its success. We reply on OPEA maintainers and contributors to build clear, detailed and update-to-date documentation for user.

Reporting Issuesยถ

If OPEA user runs into some unexpected behavior, reporting the issue to the Issues page under the corresponding github project is the proper way to do. Please ensure there is no similar one already existing on the issue list). Please follow the Bug Report template and supply as much information as you can, and any additional insights you might have. Itโ€™s helpful if the issue submitter can narrow down the problematic behavior to a minimal reproducible test case.

Proposing New Featuresยถ

OPEA communities use the RFC (request for comments) process for collaborating on substantial changes to OPEA projects. The RFC process allows the contributors to collaborate during the design process, providing clarity and validation before jumping to implementation.

When the RFC process is needed?

The RFC process is necessary for changes which have a substantial impact on end users, workflow, or user facing API. It generally includes:

  • Changes to core workflow.

  • Changes with significant architectural implications.

  • changes which modify or introduce user facing interfaces.

It is not necessary for changes like:

  • Bug fixes and optimizations with no semantic change.

  • Small features which doesnโ€™t involve workflow or interface change, and only impact a narrow use case.

Step-by-Step guidelinesยถ

  • Follow this RFC Template to propose your idea (found in the docs repo community/rfcs/rfc_template.txt):

    # RFC Template
    
    Replace the "RFC Template" heading with your RFC Title, followed by
    the short description of the feature you want to contribute
    
    ## Author(s)
    
    List all contributors of this RFC.
    
    ## Status
    
    Change the PR status to `Under Review` | `Rejected` | `Accepted`.
    
    ## Objective
    
    List what problem will this solve? What are the goals and non-goals of this RFC?
    
    ## Motivation
    
    List why this problem is valuable to solve? Whether some related work exists?
    
    ## Design Proposal
    
    This is the heart of the document, used to elaborate the design philosophy and detail proposal.
    
    ## Alternatives Considered
    
    List other alternatives if have, and corresponding pros/cons to each proposal.
    
    ## Compatibility
    
    list possible incompatible interface or workflow changes if exists.
    
    ## Miscellaneous
    
    List other information user and developer may care about, such as:
    
    - Performance Impact, such as speed, memory, accuracy.
    - Engineering Impact, such as binary size, startup time, build time, test times.
    - Security Impact, such as code vulnerability.
    - TODO List or staging plan.
    
    
  • Submit the proposal to the Issues page of the corresponding OPEA github repository.

  • Reach out to your RFCโ€™s assignee if you need any help with the RFC process.

  • Amend your proposal in response to reviewerโ€™s feedback.

Submitting Pull Requestsยถ

Create Pull Requestยถ

If you have improvements to OPEA projects, send your pull requests to each project for review. If you are new to GitHub, view the pull request How To.

Step-by-Step guidelinesยถ
  • Star this repository using the button Star in the top right corner.

  • Fork the corresponding OPEA repository using the button Fork in the top right corner.

  • Clone your forked repository to your pc by running git clone "url to your repo"

  • Create a new branch for your modifications by running git checkout -b new-branch

  • Add your files with git add -A, commit git commit -s -m "This is my commit message" and push git push origin new-branch.

  • Create a pull request for the project you want to contribute.

Pull Request Templateยถ

When you submit a PR, youโ€™ll be presented with a PR template that looks something like this:

## Description

The summary of the proposed changes as long as the relevant motivation and context.

## Issues

List the issue or RFC link this PR is working on. If there is no such link, please mark it as `n/a`.

## Type of change

List the type of change like below. Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would break existing design and interface)
- [ ] Others (enhancement, documentation, validation, etc.)

## Dependencies

List the newly introduced 3rd party dependency if exists.

## Tests

Describe the tests that you ran to verify your changes.

Pull Request Acceptance Criteriaยถ

  • At least two approvals from reviewers

  • All detected status checks pass

  • All conversations solved

  • Third-party dependency license compatible

Pull Request Status Checks Overviewยถ

The OPEA projects use GitHub Action for CI test.

Test Name

Test Scope

Test Pass Criteria

DCO

Use git commit -s to sign off

PASS

Code Format Scan

pre-commit.ci [Bot]

PASS

Code Security Scan

Bandit/Hadolint/Dependabot/CodeQL/Trellix

PASS

Unit Test

Unit test under test folder

PASS

End to End Test

End to end test workflow

PASS

  • Developer Certificate of Origin (DCO), the PR must agree to the terms of Developer Certificate of Origin by signing off each of commits with -s, e.g. git commit -s -m 'This is my commit message'.

  • Unit Test, the PR must pass all unit tests and without coverage regression.

  • End to End Test, the PR must pass all end to end tests.

Pull Request Reviewยถ

You can add reviewers from the code owners list to your PR.

Supportยถ

  • Feel free to reach out to OPEA maintainers for support.

  • Submit your questions, feature requests, and bug reports to the GitHub issues page.

Contributor Covenant Code of Conductยถ

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant Code of Conduct.