in

Generative AI pulling data directly from your database


Intro

Can you actually put generative AI to use at work? Or is it just good for half-baked demos that we play with for the sake of amusement?

In banking, retail, and entertainment, just to name a few industries, AI can give you a different angle on your operational data or increase productivity by offloading certain types of work. A lot of routine work traditionally done by people can be simplified and streamlined by the new technology. And generative AI has become much easier to build into applications, now that models are readily available and can be used directly from the tools you already know, whether they’re developer tools or the database’s native interface. Let’s take a look at an example of using AlloyDB Omni, a PostgreSQL-compatible relational database, with the AlloyDB AI capabilities we recently announced in preview.

How AI Can Help

Let’s say you’re selling online and want to add extra info to data to give your customers a better experience, provide more details about your products, or add a quick summary of a product description. This isn’t hard for a small number of items, but it can be a lot of work for thousands of products or titles in an inventory. How can you improve the process and make it more efficient? Sounds like a great use case for generative AI.

What if I told you that you can call AI models from your database to achieve these goals? And that with AlloyDB, you can do this in your own data center or any cloud using a downloadable version – AlloyDB Omni? Yes, you can make these calls directly from the database using AlloyDB AI, a set of generative AI capabilities in AlloyDB. Let me explain how it works.

In our example, we have our AlloyDB Omni database as a backend for a rental and streaming service where one of the tables – called titles – represents a list of available shows. The table has columns called title and description. The descriptions are rather short and we’d like to expand the descriptions to give more details about each show. We are going to use one of our Vertex AI foundation models for generative AI – the “text-bison” Large Language Model (LLM) – to write the expanded descriptions, and we’ll call the model directly from the AlloyDB Omni database using our title and original description as a prompt.

Deploy and Install

We start from the deployment of AlloyDB Omni. The process of installing and setting it up is easy and thoroughly described in the documentation so we don’t need to repeat it here. But before running the final “database-server install” command we need to take some extra steps to enable the Vertex AI integration.

From the high-level point of view the AlloyDB Omni instance has to be able to call the Vertex AI API and it requires authentication and authorization in Google Cloud. The steps are described in the AlloyDB Omni documentation.

  • You need a service account in the Google Cloud Project where the Vertex AI API is enabled.
  • Then you grant permissions to the service account to use Vertex AI.
  • You create a service account key in JSON format and store it on the AlloyDB Omni database server.
  • Then you can use the key location in your alloydb cli “database-server install” command to enable Vertex AI integration for your instance.

Here’s a high level diagram of the architecture.

Ep. 84: Cory Hymel, How ChatGPT Will Impact The Freelance Economy

Late Nights, Club Booths & ChatGPT – Ft. Alexandre | 178