fix: correct loose config string check #147
Open
+8
−6
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.
What kind of change does this PR introduce?
[x ] Bugfix
[] Feature
[] Code update (local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
What is the current behavior?
If the user has no config file, and has only set their api key as an environment variable, Anthropic is always being set as the default model. If you print out the viper config after setting OPENAI_API_KEY you will see this:
If using an OpenAI api key, this results in the following error because the max_token size is defaulting to Claude's (see #140):
It is happening because in config.go,
viper.Get(...)
returns an interface{}, and comparing that to""
is not reliable.What is the new behavior?
Using viper.GetString, models are now correctly set based on environment variable api keys and
max_tokens
is no longer set to 50000 by default.