openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

Use kwargs

Open tanpinxi opened this issue 1 year ago • 0 comments

Related to https://github.com/openai/openai-python/issues/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)

tanpinxi avatar Mar 01 '23 07:03 tanpinxi