-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
OpenAI.beta.threads.retrieve does not validate the "thread_id" input.
Invoking
t = client.beta.threads.retrieve(thread_id="")
Throws "APIStatusError" with the following message:
Exception has occurred: APIStatusError
Error code: 307
httpx.HTTPStatusError: Redirect response '307 Temporary Redirect' for url 'https://api.openai.com/v1/threads/'
Redirect location: 'http://api.openai.com/v1/threads'
The expected behavior would be to fail validation at the library level. Another possible behavior would be to return a list with all the threads, as returned by the https://api.openai.com/v1/threads
endpoint, but in that case it would be cleaner to implement something like client.beta.threads.retrieve_all()
To Reproduce
Run the following code:
from openai import OpenAI
client = OpenAI(api_key="sk-*****")
t = client.beta.threads.retrieve(thread_id="")
print(t)
This was tested with version 1.2.0 of the python library on 2023-11-09 9:16 UTC.
Code snippets
No response
OS
Ubuntu 22.04 Linux
Python version
Python 3.11.5 (conda)
Library version
openai v1.2.0
Tarolrr and ashbuilds
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request