[go: nahoru, domu]

Skip to content

Latest commit

 

History

History

sql-talk-app

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SQL Talk: Natural Language to BigQuery with Gemini's Function Calling

Author(s) Kristopher Overholt

Overview

This app demonstrates the power of Gemini's Function Calling capabilities, enabling users to query and understand their BigQuery databases using natural language. Forget complex SQL syntax – interact with your data conversationally.

Function Calling in Gemini lets developers create a description of a function in their code, then pass that description to a language model in a request. The response from the model includes the name of a function that matches the description and the arguments to call it with.

Try using the demo app now! https://sql-talk-r5gdynozbq-uc.a.run.app/

SQL Talk Demo App

AI Data Agent with Gemini API | Build with Google AI

Prerequisites

  • A Google Cloud project with billing enabled
  • A BigQuery dataset (we used the thelook_ecommerce public dataset)
  • APIs for Vertex AI, BigQuery, BigQuery Data Transfer, and Cloud Run enabled
  • Familiarity with Python and SQL concepts

Run and modify the app in Cloud Shell Editor

After you've tried out the live demo app, you can also run your own version of the SQL Talk app and make changes to the live app using the Cloud Shell Editor in your own Google Cloud project.

Open this repository and the sample app in the Cloud Shell Editor, then follow the steps displayed in the tutorial in the sidebar.

Additional resources

You can learn more about Function Calling in Gemini with these guides and resources:

(Optional) Deploy the app to Cloud Run

When deploying this app to Cloud Run, a best practice is to create a service account to attach the following roles to, which are the permissions required for the app to read data from BigQuery, run BigQuery jobs, and use resources in Vertex AI:

To deploy this app to Cloud Run, run the following command to have the app built with Cloud Build and deployed to Cloud Run, replacing the service-account and project values with your own values, similar to:

gcloud run deploy sql-talk --allow-unauthenticated --region us-central1 --service-account SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com --source .

After deploying your app, you should can visit the app URL, which should be similar to:

https://sql-talk-r5gdynozbq-uc.a.run.app/

Congratulations, you've successfully deployed the SQL Talk demo app!