Fix: Correct API key loading from environment variables (closes #10)#24
Open
Theigrams wants to merge 2 commits intoKylinMountain:master-backupfrom
Open
Fix: Correct API key loading from environment variables (closes #10)#24Theigrams wants to merge 2 commits intoKylinMountain:master-backupfrom
Theigrams wants to merge 2 commits intoKylinMountain:master-backupfrom
Conversation
Owner
|
Would you mind to add a further check if api_key is empty, then raise an Exception? |
Author
Thanks for the suggestion! I've added checks to raise a ValueError if the API keys are empty. |
Owner
|
Don't know is it a good idea to raise exception since lots of people use local llm, what's your opinion? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request addresses an issue where the
llm_params.api_keyandtext_embedding.llm.api_keyvariables were being incorrectly set to the literal string"<API_KEY>"due to a lack of proper validation after reading the environment variableGRAPHRAG_API_KEY. The issue was identified in lines 56 and 58 of the code. The proposed fix includes adding conditional checks to ensure that if the API keys are set to"<API_KEY>", they are replaced with the correct values from the respective configuration files (llm_config['api_key']andembeddings_config['llm']['api_key']).Related Issues
This pull request addresses issue #10.
Proposed Changes
llm_params.api_keyto replace"<API_KEY>"with the correct value fromllm_config['api_key'].text_embedding.llm.api_keyto replace"<API_KEY>"with the correct value fromembeddings_config['llm']['api_key'].llm_params.api_keyortext_embedding.llm.api_keyis empty after loading. If either is empty, a ValueError is raised to notify the user.Checklist
Additional Notes
No additional notes at this time.