Lambdua / openai4j

Java client library for OpenAI API.Full support for all OpenAI API models including Completions, Chat, Edits, Embeddings, Audio, Files, Assistants-v2, Images, Moderations, Batch, and Fine-tuning.
MIT License
301 stars 25 forks source link

Implement list of threads #16

Closed gastaldelloa closed 5 months ago

gastaldelloa commented 5 months ago

Is it possible to implement GET in the threads API to find out all the threads you created.

It seems to be possible also if not officially documented using the following example:

def list_threads(api_key): response = requests.get( 'https://api.openai.com/v1/threads?order=desc&limit=20', headers={ 'Content-Type': 'application/json', 'Authorization': f'Bearer {api_key}', 'OpenAI-Beta': 'assistants=v1' } ) if response.status_code == 200: return response.json()['data'] return None

Please consider this new feature in the next release. Thanks

Lambdua commented 5 months ago

Okay

Lambdua commented 5 months ago

GET /v1/threads must be made with a session key (that is, it can only be made from the browser). At present, the OpenAI API does not support obtaining Threads lists through api