Skip to content
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

Add Type Validation for API Key and Auth Token to Prevent Common Configuration Errors #408

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MikeSoft
Copy link

While integrating the Anthropic API client, I encountered an issue where I mistakenly passed the api_key as a list instead of a string. This led to several hours of debugging to identify the root cause of the issue, as the current implementation does not explicitly validate the type of api_key and auth_token upon instantiation of the Anthropic client class.

To prevent such issues for other developers and to enhance the usability of the API client, I propose adding explicit type validation for both api_key and auth_token parameters within the init method of the Anthropic class. This small yet impactful change ensures that developers are immediately alerted with a clear and informative error message if the types of these parameters do not match the expected string type.

The proposed change has been implemented as follows:

@MikeSoft MikeSoft requested a review from a team as a code owner March 21, 2024 05:30
@rattrayalex
Copy link
Collaborator

Thank you for sharing your experience and putting up a PR! We'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants