Open RrNn opened 4 months ago
Second on this. I have the same issue. @RrNn FYI I fixed this issue by editing the following file: vendor/openai-php/client/src/Testing/Responses/Fixtures/Images/CreateResponseFixture.php and adding the 'b64_json' => 'test_string' by myself in the fixture.
Description
Awesome package, thanks for it!! One issue am facing is that I could not mock the response from the images-resource to return me
b64_json
encoded image. It instead returns me a response with aurl
no matter what i pass inSteps To Reproduce
My steps are; I have a class
In my controller, I just call something like (real time facade)
which works fine - ie, it returns me an image in the format
b64_json
& I get that base 64 string as expected, do some magic & save the image to laravel local disk storageHowever, in my tests, i have the following; (i've shown the relevant imports here)
In the
dd($response)
I added there in the test, the response has theurl
&b64_json
properties that have the following valuesurl
="https://openai.com/fake-image.png"
&b64_json
=""
The
dd
generally looks like this;I was able to have the response have the
b64_json
that i passed by looking at the logic here in this foreach & tweaking the CreateResponseFixture ATTRIBUTES to have theb64_json
included as anything, just made itnull
for my source diving - to see how it goes& after doing this tweak, I could get my mock
b64_json
string returned.Not sure whether thats the fix or whether I am missing something, but thats the issue I am facing rn
OpenAI PHP Client Version
v0.8.0-beta.1
PHP Version
8.2.16
Notes
No response