Comments (27)
Please hurry, I found some issues with v1
from client.
Going to add support for v2 asap.
from client.
@gehrisandro, we are looking forward to its completion :D Is there any platform where we can buy you a coffee?
from client.
Folks; be sure to sponsor Sandro's work here: gehrisandro.
from client.
in files:
/vendor/openai-php/client/src/Responses/Assistants/AssistantResponse.php
/vendor/openai-php/client/src/Responses/Threads/Messages/ThreadMessageResponse.php
/vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunResponse.php
replace this line
$attributes['file_ids']
with this one
$attributes['file_ids'] ?? []
from client.
Can you also make sure to add 'attachments' to create messages endpoints? 🙏
from client.
You can create client manually with beta header:
$client = OpenAI::factory()
->withApiKey($apiKey)
->withOrganization($organization)
->withHttpHeader('OpenAI-Beta', 'assistants=v2')
->make();
but it won't help because the class doesn't match the request/response
from client.
Do we have any kind of ETA on when these changes might be getting implemented? I'm in the middle of a big upgrade of our AI code and want to utilize this asap. I second @subet request too.
from client.
Thanks @nunomaduro ! We will...
from client.
in files: /vendor/openai-php/client/src/Responses/Assistants/AssistantResponse.php /vendor/openai-php/client/src/Responses/Threads/Messages/ThreadMessageResponse.php bitrix/vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunResponse.php replace this line
$attributes['file_ids']
with this one
$attributes['file_ids'] ?? []
This works !!! Thank you so much @agmike77 !!
from client.
I'm getting the same thing as @ehsanwwe. Hope you can upgrade it :)
from client.
On line 18 of ](https://github.com/openai-php/client/blob/main/src/OpenAI.php line 18:
->withHttpHeader('OpenAI-Beta', 'assistants=v1') to ->withHttpHeader('OpenAI-Beta', 'assistants=v2')
Just a quick fix and my code runs. but there still need to fix migration issues.
from client.
when i migrate to V2 by below way
->withHttpHeader('OpenAI-Beta', 'assistants=v2')
i'll get this error in each of request by Assistant
Undefined array key "file_ids"
at this code
$responseCharacters = OpenAI::threads()->createAndRun( [ 'assistant_id' => 'asst_oths*****************', 'thread' => [ 'messages' => [ [ 'role' => 'user', 'content' => "read below screenplay text carefully and return a list each of character in there is in the below screenplay in english language with this column names : Name, gender , age , description , ID in JSON format ".$request->input('screenplay_text'), ], [ 'role' => 'user', 'content' => "append all location with ID ,Time_of_date , is_exterior ,atmosphere_mood , atmosphere_visuals , description to above JSON" ], [ 'role' => 'user', 'content' => "append sequence with ID , charachters IDs (available in sequence) , location ID to above JSON" ], [ 'role' => 'user', 'content' => "append sequence_action for characters in each of sequence with id ,character_id ,dialog ,is_walking ,is_talking, is_stand ,is_ride_a_hors ,is_armed ,is_bow_active ,is_bow_hold ,is_angry ,is_normal ,is_happy ,is_friendly ,is_enemy ,start_positon_in_x_y_z (estimate it) ,end_positon_in_x_y_z (estimate it) ,start_rotation_in_x_y_z (estimate it) ,end_rotation_in_x_y_z (estimate it) ,head_look_at_point_in_x_y_z (estimate it) to above JSON" ], ], ], ]);;
from client.
getting the same ! Thanks for the effort guys
from client.
I am also having issues when working with assistants configured for GPT 4. It doesn't seem to work with the assistants v1 API so need a work around.
Also, I tried to just change the HTTP header so it uses assistants v2 but that resulted in some new errors. I think this upgrade would not be overly complex, although I am not sure if anyone is actively maintaining this project.
That said, this fix would be largely helpful to me and any others looking to use the newer APIs.
If theres anything I can do to make this happen let me know.
I look forward to when you integrate this to the library.
from client.
I have now resolved the file_ids issue, but a new issue has emerged: Unhandled match case '...' {"exception":"[object] (UnhandledMatchError(code: 0): Unhandled match case '...' at .../vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunResponse.php:64)"},
I also printed out the type, and I found that in version v2, the type values have changed. The type now includes file_search, so I modified it as follows:
$tools = array_map(
function (array $tool): ThreadRunResponseToolCodeInterpreter|ThreadRunResponseToolRetrieval|ThreadRunResponseToolFunction {
return match ($tool['type']) {
'code_interpreter' => ThreadRunResponseToolCodeInterpreter::from($tool),
'retrieval' => ThreadRunResponseToolRetrieval::from($tool),
'function' => ThreadRunResponseToolFunction::from($tool),
'file_search' => ThreadRunResponseToolRetrieval::from($tool),
default => throw new UnhandledMatchError("Unhandled match case '{$tool['type']}'"),
};
},
$attributes['tools'],
);
Additionally, I need to modify line 38 in vendor/openai-php/client/src/Responses/Threads/Messages/ThreadMessageResponseContentTextAnnotationFileCitation.php to:
$attributes['quote'] ?? ''
Now it works, but I'm not sure if it's correct.
from client.
I've just created a $12,000 a month tier, on my sponsors page, in case there a company truly relying on this package and it needs this feature urgently: https://github.com/sponsors/nunomaduro.
from client.
Is this feature being held hostage?
from client.
Related Issues (20)
- 提问我该如何结束发起的http请求呢
- Constant HTTP 500 Server errors HOT 3
- [Enhancement] streaming support for assistant api HOT 7
- [Bug]: Images (Dall-e 3) method not working with Azure HOT 1
- How to set the frequency_penalty? HOT 1
- [Bug]: Warning: Undefined array key "code" in Responses/FineTuning/RetrieveJobResponseError.php on line 42 HOT 2
- [Bug]: local.ERROR: 'json_object' is not of type 'object' - 'response_format' {"exception":"[object] (OpenAI\Exceptions\ErrorException(code: 0): 'json_object' is not of type 'object' - 'response_format' at /app/vendor/openai-php/client/src/Transporters/HttpTransporter.php:131) HOT 7
- [Bug]: JSON format is not supported
- [Improvement]: `dd` is not a PHP function, the first image of readme.md needs to be changed. use `var_dump` or `print_r` HOT 1
- [Bug]: HOT 1
- Fatal error: Cannot declare class OpenAI, because the name is already in use in E:\Xampp_8.2\htdocs\ia\vendor\openai-php\client\src\OpenAI.php on line 8 [Bug]: HOT 2
- [Feature]: Compatibility with assistants v2 HOT 4
- Usage stats are now available when using streaming in the Chat Completions API HOT 11
- [file_search]: Do we have to wait for the v2 API to get file_search? HOT 5
- Undefined array key "file_ids"[Bug]: HOT 4
- API V2 Library? HOT 2
- Support Stream for Thread using Assistant HOT 4
- How to use data but not share with others people HOT 1
- [Bug]: MistralAI- Undefined array key "type" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client.