Repository navigation
fix: let LogBatcherParser fall back to OPENAI_API_KEY - #360
Open
viktorbeck98 wants to merge 1 commit into
Open
viktorbeck98 wants to merge 1 commit into
viktorbeck98 wants to merge 1 commit into
Conversation
The parser passed its api_key setting to the OpenAI client as is. The default is an empty string, and the client only reads OPENAI_API_KEY when api_key is None. So the environment variable was never used, and LogBatcherParser() failed on creation unless the key was in the config. An empty api_key is now passed as None, the same way base_url already is. A key set in the config still takes precedence. Closes #356 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Task
Closes #356
Description
LogBatcherParserpassed itsapi_keysetting straight to the OpenAI client. The default is an empty string, and the client only readsOPENAI_API_KEYwhenapi_keyisNone. So the environment variable was never used, andLogBatcherParser()failed on creation unless the key was written into the config.An empty
api_keyis now passed asNone, the same waybase_urlalready is. A key set in the config still takes precedence over the environment variable.Not changed here: the docs example still says to put the key in the YAML.
How Has This Been Tested?
prek ran locally but skipped both changed files. The top-level
exclude: '.*.log'in.pre-commit-config.yamlalso matches paths that only contain "log", such asparsers/logbatcher/, so no linter checked this change.Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.