-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
[0.8.x] Add Assistant API #243
Conversation
The Assistant / Threads API has a nested structured and I am currently trying to figure out, how we should access the API. Here are lists of some of the endpoints in three different variations:
$client->assistants()->create(parameters: [/* ... */]);
$client->assistants()->files()->retrieve(assistantId: 'asst_123', fileId: 'file_123');
$client->threads()->create(parameters: [/* ... */]);
$client->threads()->runs()->create(threadId: 'thread_123', parameters: [/* ... */]);
$client->threads()->runs()->submitToolOutputs(threadId: 'thread_123', runId: 'run_123', parameters: [/* ... */]);
$client->threads()->runs()->steps()->retrieve(threadId: 'thread_123', runId: 'run_123', stepId: 'step_123');
$client->threads()->runs()->steps()->list(threadId: 'thread_123', runId: 'run_123');
$client->assistants()->create(parameters: [/* ... */]);
$client->assistant(assistantId: 'asst_123')->retrieve(fileId: 'file_123');
$client->threads()->create(parameters: [/* ... */]);
$client->thread(threadId: 'thread_123')->runs()->create(parameters: [/* ... */]);
$client->thread(threadId: 'thread_123')->run(runId: 'run_123')->submitToolOutputs(parameters: [/* ... */]);
$client->thread(threadId: 'thread_123')->run(runId: 'run_123')->steps()->retrieve(stepId: 'step_123');
$client->thread(threadId: 'thread_123')->run(runId: 'run_123')->steps()->list();
$client->assistants()->create(parameters: [/* ... */]);
$client->assistantFiles()->retrieve(assistantId: 'asst_123', fileId: 'file_123');
$client->threads()->create(parameters: [/* ... */]);
$client->threadRuns()->create(threadId: 'thread_123', parameters: [/* ... */]);
$client->threadRuns()->submitToolOutputs(threadId: 'thread_123', runId: 'run_123', parameters: [/* ... */]);
$client->threadRunSteps()->retrieve(threadId: 'thread_123', runId: 'run_123', stepId: 'step_123');
$client->threadRunSteps()->list(threadId: 'thread_123', runId: 'run_123'); @nunomaduro What do you think? ATM I would probably go for variation 1. |
I would pick from variation 1 or 2. |
I'd go for version 2 simply because of the "RESTful" approach of it. You define what resource you're working with as you chain the functions together. I wonder if there's a non-chaining approach so that you basically go for variation 1 but with a specific "fetch" function. I.e ...->fetchAssistantStep(threadId, runId, stepId) (or something in that nature). Just my 2 cents, I haven't deep dived into the beta API just yet :) |
@gehrisandro Thanks for kicking of 👍 Already running your PR locally and trying it out 👏 |
@gehrisandro 👏 👏 👏 Thank you |
You are welcome! And thanks for supporting me! |
Nice work @gehrisandro ! |
Good job @gehrisandro 👏 Thank you ! |
Well done @gehrisandro 🎉 |
Thank you @gehrisandro, is it possible to upload the new API somehow? I see the docs show that you can, but don't see it in the PHP wrapper |
Can you explain by what you mean by "new API" |
Hey, sorry I meant - using the files API, how would we upload a file to OpenAI? Is it possible to upload a temp file? |
Thanks |
https://platform.openai.com/docs/api-reference/assistants