Contributing
This page provides the general guidelines for contributing to the Gen AI SDK.
Requirements
Below are the requirements needed to contribute to the Gen AI SDK.
Python 3.11+
Although not required, it is recommended to use Miniconda to manage python environments.
uv 0.5.0+
Please refer to the installation guide. After installing, close and re-open the terminal window for the changes to take effect.
gcloud CLI
Please refer to the installation guide. After installing, please run
gcloud auth loginto authorize gcloud to access the Cloud Platform with Google user credentials.
Getting Started
Below are the step-by-step guideline to setup a development environment for a Gen AI SDK module:
Go to the module directory by running cd libs/gllm-<module_name>. Optionally, the gllm-<module_name> module folder can also be opened using an IDE (e.g. Cursor).
Configure uv permission to access Google Cloud repositories. These permissions can expire. If you get authorization errors after a while, please simply rerun these commands.
export UV_INDEX_GEN_AI_INTERNAL_USERNAME=oauth2accesstoken
export UV_INDEX_GEN_AI_INTERNAL_PASSWORD="$(gcloud auth print-access-token)"
export UV_INDEX_GEN_AI_USERNAME=oauth2accesstoken
export UV_INDEX_GEN_AI_PASSWORD="$(gcloud auth print-access-token)"Install the module dependencies.
make installInstall pre-commit hooks. This will make sure our code is compliant with the style guide before committing.
pre-commit install --config ../../.pre-commit-config.yamlTest Files
The test files for each module are located in the gllm-<module_name>/tests directory, which further contains 2 subdirectories:
unit_tests: Contains the unit tests for the module.integration_tests: Contains the integration tests for the module.
Any prerequisites and setup required to run the integration tests must be put in the respective module's README.md file.
To run the tests, please use:
To see the coverage report, please use:
Dependencies Management
Below are the conventions for the Gen AI SDK modules dependencies management:
Arrangements:
Dependencies must be sorted alphabetically by default.
Dependencies may be grouped if necessary.
Dependencies should be arranged as follows:
To modify the dependencies for the module, either:
Manually update the
pyproject.tomlfile, then runmake updateUse uv commands:
To add package:
uv add <package_name>.To remove package:
uv remove <package_name>.To update package:
uv sync --upgrade.
After using uv commands, please adjust the package ordering accordingly.
After modifying dependencies, please make sure to commit the updated
uv.lock.Versioning:
For stable packages (major version >= 1), please use
^x.y.z, e.g.pandas = "^2.2.3".For unstable packages (major version = 0), please use
>=0.y.z,<0.y+1.z, e.g.fastapi = ">=0.115.0,<0.116.0".If necessary, package can be locked strictly to a specific version, e.g.
transformers = "4.46.1". However, please be careful as this may cause version conflict between modules.
Code Convention
Below are the code convention for the Gen AI SDK:
For general code convention, please refer to the Python Style Guide.
Modules are located in the
libsdirectory. Each module has its own directory with the following structure:<snake_case_module_name>: contains the source code for the module.tests: contains the tests for the module.pyproject.toml: contains the configuration for the module.uv.lock: contains the dependencies for the module.README.md: contains the documentation for the module.
For logging, please use our logger manager:
For function logging, define the logger outside of the function:
For class logging, please set the logger as a protected attribute:
For deprecation, please use our deprecated decorator.
To deprecate a function, simply add the decorator:
To deprecate a class, add the decorator to the constructor:
For optional packages, please use our check optional packages util as follows:
To use an optional package in a function, put the checker and import in the function:
To use an optional package in a class, put the checker and import in the class constructor:
AI Feedback
To enhance tracking of AI usage, facilitate early issue identification, and continuously refine our development process, all future Pull Requests (PRs) are required to contain structured AI Feedback comments from both the author and the reviewer.
Overview
The AI Feedback system tracks:
Author Feedback - Which AI suggestions were True Positives (TP) or False Positives (FP), including impact levels and models/prompts used
Reviewers Feedback - Which AI models were used for review and any issues caught by reviewers that AI missed
Review Responsiveness - Time from PR open until first START REVIEW
Active Review Window - Duration of human review from first START REVIEW to merge
End-to-End PR Cycle Time - Total time from PR open to merge
For detailed guidelines, examples, and complete documentation, please refer to the AI Feedback Guide.
Contributing General Flow
The general steps for contributing to the Gen AI SDK are as follows:
Create a new branch from main.
Work on the branch to apply the changes.
Commit the changes. If any dependency are modified, please dont forget to also commit the uv.lock file.
Push the changes.
Create a PR. The PR description should contain the following:
Description: Brief description on what the PR is about.
Changes: Bulleted list of specific modifications and their purpose.
How to Test: Provide a brief guidelines for the reviewers to verify the changes.
Request for reviews:
At least 2 approval are required in order to merge the PR, 1 on which should be from the Gen AI SDK team. Please communicate with the Gen AI SDK team whenever help is needed for PR reviews.
Merge the PR. Please always use Squash and Merge.
Add AI Feedback comments. To enhance tracking of AI usage, facilitate early issue identification, and continuously refine our development process, all PRs are required to contain structured AI Feedback comments from both the author and the reviewer.
For Author (1 comment per PR):
Add a comment after merging the PR documenting which AI suggestions were True Positives (TP) or False Positives (FP)
Include impact level (High, Medium, Low) for each suggestion
Document the AI models and prompts used during development
Use this for lessons learned and improvement suggestions
Create a release for the merged changes:
Go to the Draft a new release page.
Click on
Choose a Tag.The tag name should follow the following convention:
Format:
gllm_<package_name>-v<major>.<minor>.<patch>.The version should be updated as follows:
If your changes contain breaking changes, please bump the minor version.
Otherwise, please bump the patch version.
For example, say you've just made changes to the GLLM Core module, and its current latest tag is
gllm_core-v0.2.5(The latest tag should be visible when you start typing the tag name):If your changes contain breaking changes, please create
gllm_core-v0.3.0.Otherwise, please create
gllm_core-v0.2.6.
Click on
Generate release noteand adjust the message accordingly.Click on
Publish releaseto create the release.
Verifying build:
After creating the release, go to the Build binary page.
Find the recent release's build.
Please make sure that all jobs are executed successfully, which means the changes are ready to be used.
If there are any failing builds, please consult to the Gen AI SDK team or the DSO team, as unattended failing builds may result in versioning problem in the future due to missing build.
Creating New Package
Coming soon!
Github Issues
For feature request or bug report, feel free to open a Github issue.
Static Code Analysis
When creating a Pull Request and a commit is pushed to GitHub, it will trigger an SCA job.
To request access to the SCA report, please fill out this ticket form by including the project keys of each modules.
You can check the project key in
./sonar-project.propertiesof each module (example: gllm-core).
Last updated
Was this helpful?