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

Use kwargs #236

Merged
merged 1 commit into from
Mar 7, 2023
Merged

Use kwargs #236

merged 1 commit into from
Mar 7, 2023

Conversation

tanpinxi
Copy link
Contributor

@tanpinxi tanpinxi commented Mar 1, 2023

Related to #231

When Completion is incorrectly used, the error suggests an bug in the codebase:

openai.api_key = "openai-key"
id_ = "cmpl-id"
result = openai.Completion.retrieve(id_chat)
# EngineAPIResource.init() takes from 1 to 2 positional arguments but 3 are given

With kwargs used, the params are passed correctly and a clearer error is thrown:

# InvalidRequestError: Invalid URL (GET /v1/completions/cmpl-id)

Copy link
Collaborator

@hallacy hallacy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you

@hallacy hallacy merged commit 8470953 into openai:main Mar 7, 2023
davedittrich pushed a commit to davedittrich/openai-python that referenced this pull request Nov 14, 2023
cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
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.

2 participants