Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fetch LLM API keys from user env variables (#102)
<!-- Suggested PR Title: [feat/fix/refactor/perf/test/ci/docs/chore] brief description of the change --> <!-- Please follow Conventional Commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Description This pull request fixes the handling of API keys for LLMs in the code. It adds a JavaScript script to handle the API keys for LLMs and initializes the LLM secrets in the MAIDR instance. The script injects the LLM API keys into the MAIDR instance and sets the appropriate settings based on the presence of the Gemini and OpenAI API keys. This ensures that the LLM functionality works correctly with the updated API key handling. closes #76 ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] Any dependent changes have been merged and published in downstream modules # Pull Request ## Description 1. Added a new method called `initialize_llm_secrets()` in environment.py which fetches the keys from the environment variable. 2. Injected the script when the maidr iframe loads initially. ## Checklist <!-- Please select all applicable options. --> <!-- To select your options, please put an 'x' in the all boxes that apply. --> - [x] I have read the [Contributor Guidelines](../CONTRIBUTING.md). - [x] I have performed a self-review of my own code and ensured it follows the project's coding standards. - [x] I have tested the changes locally following `ManualTestingProcess.md`, and all tests related to this pull request pass. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation, if applicable. - [x] I have added appropriate unit tests, if applicable. ## Additional Notes <!-- Add any additional notes or comments here. --> <!-- Template credit: This pull request template is based on Embedded Artistry {https://github.com/embeddedartistry/templates/blob/master/.github/PULL_REQUEST_TEMPLATE.md}, Clowder {https://github.com/clowder-framework/clowder/blob/develop/.github/PULL_REQUEST_TEMPLATE.md}, and TalAter {https://github.com/TalAter/open-source-templates} templates. -->
- Loading branch information