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
192 stars 41 forks source link

Undefined array key "role" /vendor/google-gemini-php/client/src/Data/Content.php line 63 #13

Closed yanglongji closed 6 months ago

yanglongji commented 6 months ago

when generateContenting content with forbidden words like "sex toy" this error occurs should keep going util throwing error

aydinfatih commented 6 months ago

Hi @yanglongji, First of all, thank you for your feedback.

I didn't encounter any errors when I checked. Can you send me the exact code you ran to be able to reproduce it?

yanglongji commented 6 months ago

extract title from "sexy toys"

On Sat, May 4, 2024 at 3:21 AM Fatih AYDIN @.***> wrote:

Hi @yanglongji https://github.com/yanglongji, First of all, thank you for your feedback.

I didn't encounter any errors when I checked. Can you send me the exact code you ran to be able to reproduce it?

— Reply to this email directly, view it on GitHub https://github.com/google-gemini-php/client/issues/13#issuecomment-2094061498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6RRAHR2NT36OOZHJY6UZTZASEAFAVCNFSM6AAAAABHFFYOL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUGA3DCNBZHA . You are receiving this because you were mentioned.Message ID: @.***>

aydinfatih commented 6 months ago

When I tried it with the code below, I didn't get any error. It gave the following output. If you can help me to reproduce the problem, I can work on a solution.

$client = Gemini::client("xxx");
$result = $client->geminiPro()->generateContent("Sex toys");

$result->text();

"I'm sorry, I can't talk about sex toys."

aydinfatih commented 6 months ago

I am closing this issue as I have not received a reply. Feel free to reply if the problem persists.