google-gemini-php / client

⚡️ Gemini PHP is a community-maintained PHP API client that allows you to interact with the Gemini AI API.
MIT License
183 stars 30 forks source link

Undefined array key "content"[52] in /vendor/google-gemini-php/client/src/Data/Candidate.php #8

Closed yanglongji closed 5 months ago

yanglongji commented 5 months ago

key "content" may not return, should fix this

yanglongji commented 5 months ago

Undefined array key "parts"[58] in /vendor/google-gemini-php/client/src/Data/Content.php also this key

aydinfatih commented 5 months ago

Hello @yanglongji , Thanks for your feedback. I was able to reproduce the problem locally. As far as I understand, it seems to be a general problem with gemini ai. Gemini returns the following response in some requests other than the normal api response.
https://github.com/google/generative-ai-docs/issues/257

{ 
    "finishReason":  "RECITATION",
    "index" :  0,
} 

We have a new fix for this issue. Can you update the package and check again? https://github.com/google-gemini-php/client/releases/tag/1.0.4