Skip to content

Fix: google grounding is not working#105

Merged
Plytas merged 2 commits intogoogle-gemini-php:mainfrom
maximetassy:hotfix/grounding
May 12, 2025
Merged

Fix: google grounding is not working#105
Plytas merged 2 commits intogoogle-gemini-php:mainfrom
maximetassy:hotfix/grounding

Conversation

@maximetassy
Copy link
Contributor

@maximetassy maximetassy commented May 12, 2025

Google grounding is not working

Problem

Google Grounding tool does not work with model >= 2.0.
The implementation use googleSearch tool which does not seem to be the way google wants to go with this tool.
As stated here, we should use google_search with an empty object.

Also, some attributes of GroundingMetadata are nullable in the documentation and the app crash if they are not defined.

Solution

  • Update GoogleGrounding class to use the new way of GoogleGrounding tool declaration.
  • Make groundingChunks, groundingSupports, webSearchQueries and retrievalMetadata nullable

@Plytas Plytas merged commit 4d55221 into google-gemini-php:main May 12, 2025
10 checks passed
@Plytas
Copy link
Collaborator

Plytas commented May 12, 2025

Thanks for this @maximetassy!

@maximetassy maximetassy deleted the hotfix/grounding branch May 12, 2025 15:59
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

Successfully merging this pull request may close these issues.

2 participants