Open Theigrams opened 3 months ago
Would you mind to add a further check if api_key is empty, then raise an Exception?
Would you mind to add a further check if api_key is empty, then raise an Exception?
Thanks for the suggestion! I've added checks to raise a ValueError if the API keys are empty. Let me know if anything else needs adjustment.
Don't know is it a good idea to raise exception since lots of people use local llm, what's your opinion?
Description
This pull request addresses an issue where the
llm_params.api_key
andtext_embedding.llm.api_key
variables 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_key
to replace"<API_KEY>"
with the correct value fromllm_config['api_key']
.text_embedding.llm.api_key
to replace"<API_KEY>"
with the correct value fromembeddings_config['llm']['api_key']
.llm_params.api_key
ortext_embedding.llm.api_key
is empty after loading. If either is empty, a ValueError is raised to notify the user.Checklist
Additional Notes
No additional notes at this time.