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.99k stars 1.88k forks source link

[Bug]: SQLTalk demo is using VertexAI SDK, not Gemini SDK but is branded as GeminiAI #756

Closed nileshtrivedi closed 4 months ago

nileshtrivedi commented 4 months ago

Description of the Bug:

SQLTalk, a sample Streamlit app demonstrating Vertex AI's function calling with BigQuery was recently shared by Google: Video, Tutorial, Code, Live demo.

Even though the code lives in Gemini directory (see the full path), it is actually using Vertex AI SDK, not Gemini SDK. The Github page actually says that this repo is for Vertex AI:

image

But, the Tutorial and Video mention Gemini AI, not Vertex AI.

In summary, A sample app, which was branded as Gemini AI in the video and docs , is actually using vertexai SDK but is present under "gemini" folder in a repo that is for VertexAI only.

Describe the solution you'd like

Provide a version of SQLTalk app that uses Gemini SDK, not VertexAI SDK;

This is not a simple matter of renaming vertexai.generative_models to google.generativeai because there are subtle differences in both the SDKs.

While this line from SQLTalk app sample code works fine:

from vertexai.generative_models import FunctionDeclaration, GenerativeModel, Part, Tool

This fails:

from google.generativeai import FunctionDeclaration, GenerativeModel, Part, Tool

because the GeminiSDK does not have FunctionDeclaration, Part and Tool but does have GenerativeModel.

To someone new to GeminiAI/VertexAI, all this is highly confusing.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

nileshtrivedi commented 4 months ago

Cross-posted this to GeminiAI organization's repo: https://github.com/google-gemini/generative-ai-python/issues/381

nileshtrivedi commented 4 months ago

I think only @koverholt can clear up this whole confusion.

koverholt commented 4 months ago

Hi @nileshtrivedi!

Thanks for opening this issue. You are correct that there are many different references to Gemini and the Gemini API in AI Studio, Vertex AI, and other Google and Google Cloud products. The SQL Talk sample app in its current form in this repo is using Vertex AI, which all of the code samples in this repo are scoped to.

It should be possible for you to take the concepts and structure of the SQL Talk app and rework it to use the Gemini API in AI Studio. The SDK for the Gemini API in AI Studio has FunctionDeclarations as part of its lower-level API, and you can also find methods for tools, Part, etc. in the API documentation and code samples.

And we're always looking for ways to improve the experience for users working with both AI Studio and Vertex AI, in fact you might enjoy this session from Google I/O from my colleague related to The Gemini API: From prototype to production that talks about moving between AI Studio and Vertex AI in scenarios like this.