log_analysis_multi_agent_rag: Support API key environment variables from main documentation #366
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.
Firstly, thanks for giving this example! We want to use this kind of approach to triage our logs and this is a great start.
I have been reading these docs and also some references elsewhere to configure my API keys. I initially set
NGC_API_KEYand thenNVIDIA_API_KEYexpecting the underlying libraries to use these automatically if present but I kept getting unauthorized responses from the API endpoints.Digging into the libraries in the
log_analysis_multi_agent_ragexample, I saw that the.envenvironment variableAPI_KEYis the only one supported. In order to prevent confusion for others in the future, I have extendedutils.pyto also support querying the standard environment variables if present. If not present then the old behaviour is preserved.Finally, adding API keys to a file managed in Git is a security risk because it is easy to accidentally commit
.envand push it up. By allowing the user to set their own environment variables outside of the repo we can avoid that risk.