GoogleCloudPlatform / generative-ai

Sample code and notebooks for Generative AI on Google Cloud, with Gemini on Vertex AI
https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview
Apache License 2.0
6.23k stars 1.6k forks source link

[Bug]: Grounding with Gemini doesn't work, no metadata is returned #688

Open sanjanalreddy opened 1 month ago

sanjanalreddy commented 1 month ago

File Name

https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/grounding/intro-grounding-gemini.ipynb

What happened?

Grounding with Gemini doesn't work. Gemini model doesn't seem to be using the grounding source to answer the prompt. The same datasource with Palm however returns grounded responses and grounding metadata.

Screenshot 2024-05-09 at 4 27 36 PM

Relevant log output

No response

Code of Conduct

holtskinner commented 1 month ago

Can you provide details about the specific queries and data source you're using for grounding?

sanjanalreddy commented 1 month ago

I'm using the same data source that is mentioned in the notebook that points to cloud.google.com/* and the prompt is When should I use an object table in BigQuery? And how does it store data?

maralm commented 4 weeks ago

Similar experience here. The grounding_metadata contains the retrieval_queries property only, but nothing that looks like citations or attributions. For example, the method print_grounding_response in the grounding example indicates that there should be attributions available, but I'm consistently not getting any.

I'm a bit perplexed in general because I can set up a prompt and grounding source in the Vertex AI UI, try it out and it works okay, then click "Get Code" and execute that code and get no results. In general, results seem to be much worse using latest SDK and Gemini models, compared to the previous way of doing it and with text-bison.