Skip to content
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

Undefined array key "content" #7

Open
netbbe opened this issue Jan 2, 2024 · 1 comment
Open

Undefined array key "content" #7

netbbe opened this issue Jan 2, 2024 · 1 comment
Assignees

Comments

@netbbe
Copy link

netbbe commented Jan 2, 2024

Similar to our Undefined array key "safetyRatings" issue, we see some calls to the sendMessage function fail. Again, we cannot reproduce this consistently, but it happens in roughly 10% of our calls. A bit more than the safetyRatings issue. And this seems to be more random.

[2024-01-02 14:50:57] local.ERROR: Undefined array key "content" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"content\" at /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/Resources/Candidate.php:65)
[stacktrace]
#0 /home/vagrant/code/site/admin/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/Resources/Candidate.php(65): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/Responses/GenerateContentResponse.php(95): GeminiAPI\\Resources\\Candidate::fromArray()
#3 [internal function]: GeminiAPI\\Responses\\GenerateContentResponse::GeminiAPI\\Responses\\{closure}()
#4 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/Responses/GenerateContentResponse.php(94): array_map()
#5 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/Client.php(76): GeminiAPI\\Responses\\GenerateContentResponse::fromArray()
#6 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/GenerativeModel.php(58): GeminiAPI\\Client->generateContent()
#7 /home/vagrant/code/site/admin/vendor/gemini-api-php/client/src/ChatSession.php(38): GeminiAPI\\GenerativeModel->generateContentWithContents()
#8 /home/vagrant/code/site/admin/vendor/gemini-api-php/laravel/src/ChatSession.php(25): GeminiAPI\\ChatSession->sendMessage()
#9 /home/vagrant/code/site/admin/app/Jobs/AISummary.php(168): GeminiAPI\\Laravel\\ChatSession->sendMessage()
@erdemkose erdemkose self-assigned this Jan 5, 2024
@ducdevtlu
Copy link

ducdevtlu commented Mar 13, 2024

@erdemkose
when "finishReason": "SAFETY" response does not have key "content"
contents my case:
User: Chào bạn, tôi tên là Đức. Hãy nhớ tên tôi nhé
Model: Chào Đức, tôi sẽ nhớ tên của bạn.
User: Nhắc lại tên tôi nhé
--> "finishReason": "SAFETY"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants