-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter errors from environment information output #857
Conversation
} | ||
if (!token && !/^http:\/\//i.test(base)) | ||
// localhost typically requires no key | ||
throw new Error("OPENAI_API_KEY missing") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code throws an error if the OPENAI_API_KEY
is missing, but it doesn't check if the base
is a valid URL before this. This could lead to an error being thrown for the wrong reason. Consider checking the validity of base
before throwing an error for a missing API key. 🔑
generated by pr-review-commit
missing_key_check
@@ -237,16 +248,6 @@ export const MODEL_PROVIDERS = Object.freeze([ | |||
detail: "LiteLLM proxy", | |||
url: DOCS_CONFIGURATION_LITELLM_URL, | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MODEL_PROVIDERS
array contains duplicate entries for MODEL_PROVIDER_ANTHROPIC
and MODEL_PROVIDER_HUGGINGFACE
. This could lead to confusion or unexpected behavior when iterating over providers. Please ensure each provider is listed only once. 🔄
generated by pr-review-commit
duplicate_model_providers
res.providers.push({ | ||
provider: modelProvider.id, | ||
error: errorMessage(e), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling logic inside the envInfo
function only pushes errors to the result if the error
option is set. This might lead to silent failures if the option is not set. Consider logging or handling errors in a way that ensures they are not completely ignored. 🚨
generated by pr-review-commit
error_handling
The changes in the GIT_DIFF include:
These changes enhance the functionality by providing more control over CLI options, improve code readability, and ensure the system supports additional model providers. LGTM 🚀
|
Introduce an option to display errors when showing environment information, enhancing the command-line interface for better error visibility.
-e, --error
to the CLI command for showing.env
information, allowing users to display errors encountered during the operation.envInfo
function to handle the newerror
option, capturing and storing any errors related to provider information.parseTokenFromEnv
function by removing redundant code for improved readability.MODEL_PROVIDERS
constant list to include “Anthropic models” and “Hugging Face models” in a more consistent order.