TechnologyApril 10, 2024

Gemini Code Assist + Astra DB: Build Generative AI Apps Faster

The Gemini Code Assist integration, a collaboration with Google Cloud, will enable developers to build applications that use Astra DB faster.
Alan Ho
Alan HoVP Product, AI
Gemini Code Assist + Astra DB: Build Generative AI Apps Faster

Today at Google Cloud Next, DataStax is showcasing its integration with Gemini Code Assist to allow for automatic generation of Apache Cassandra compliant CQL. This integration, a collaboration with Google Cloud, will enable developers to build applications that use Astra DB faster.

Developers frequently have large numbers of tables, and usually need some code assistance to create the correct cassandra queries. Gemini Code Assist is not only able to create the correct CQL statement, but can also provide additional context on how to use the generated CQL for developers in their application. Developers can use Gemini Code Assist from the Google Cloud console.

Example of generating CQL compliant code within the Google Cloud Console

Get Started Today 

Gemini Code Assist for Astra DB is now generally available. 

1. Log into your Google Cloud console, and click on the “Open Gemini” icon at the top right toolbar



2. Paste into the Gemini Chat Widget your schema of your database. e.g.

CREATE TABLE performers (
  name TEXT PRIMARY KEY,
  type TEXT,
  country TEXT,
  born INT,
  died INT,
  founded INT
);


CREATE TABLE albums_by_performer (
  performer TEXT,
  year INT,
  title TEXT,
  genre TEXT,
  PRIMARY KEY (performer, year, title)
) WITH CLUSTERING ORDER BY (year DESC, title ASC);

CREATE TABLE albums_by_title (
  title TEXT,
  year INT,
  performer TEXT,
  genre TEXT,
  PRIMARY KEY (title, year)
);

CREATE TABLE albums_by_genre (
  genre TEXT,
  year INT,
  title TEXT,
  performer TEXT,
  PRIMARY KEY (genre, year, title)
) WITH CLUSTERING ORDER BY (year DESC);


CREATE TABLE tracks_by_title (
  title TEXT,
  album_year INT,
  album_title TEXT,
  number INT,
  length INT,
  genre TEXT,
  PRIMARY KEY (title, album_year, number)
);


CREATE TABLE tracks_by_album (
  album_title TEXT,
  album_year INT,
  number INT,
  title TEXT,
  length INT,
  genre TEXT STATIC,
  PRIMARY KEY ((album_title, album_year), number)
) WITH CLUSTERING ORDER BY (number ASC);

CREATE TABLE users (
  id UUID PRIMARY KEY,
  name TEXT
);

CREATE TABLE tracks_by_user (
  id UUID,
  month DATE,
  timestamp TIMESTAMP,
  album_title TEXT,
  album_year INT,
  number INT,
  title TEXT,
  length INT,
  PRIMARY KEY ((id, month), timestamp)
) WITH CLUSTERING ORDER BY (timestamp ASC);

3. Ask to generate a CQL Statement. e.g. 

Given the above CQL data model, please answer the following question 
with a query if possible. If not possible from the current data model, 
explain why.How many tracks are in 'The Slow Rush' album, 
and how can I listen to them?

 

Discover more
DataStax Astra DB
Share
JUMP TO SECTION

Get Started Today

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.