Illustration Image

Building a Cassandra Todolist ChatGPT Plugin: A Step-by-Step Guide

Nicholas Brackley on September 12, 2023

Building a Cassandra Todolist ChatGPT Plugin: A Step-by-Step Guide

ChatGPT plugins offer a way to extend the capabilities of OpenAI’s ChatGPT by integrating custom functionalities directly into the conversational AI interface. These plugins enable users to interact with specialized features, transforming ChatGPT into a versatile tool for various tasks. Think of a ChatGPT plugin as a handy tool belt that equips OpenAI’s ChatGPT with specialized superpowers. Just like adding a new gadget to your arsenal, a plugin empowers ChatGPT to perform specific tasks seamlessly within the conversation. 

In this blog, we’ll dive into implementing the Cassandra Todolist ChatGPT plugin (though we are implementing it on DataStax Astra for simplicity), which acts as a virtual personal assistant for managing your to-do list. It’s like having a dedicated task organizer right beside you during your AI-powered conversations. With this plugin, you can effortlessly create, view, and delete tasks, bringing a new level of productivity and organization to your chat-based interactions with ChatGPT.

Introduction:

The Cassandra Todolist ChatGPT plugin offers a seamless integration of a to-do list functionality within the ChatGPT interface. If you want to add items to a todo list stored in DataStax Astra using your ChatGPT interface, or use the CassioML repo as a starting point for another project, then this blog is a great place to start. 

The plugin is designed to work hand-in-hand with the ChatGPT Plugins and DataStax Astra Documentation, enabling users to enhance their conversational AI experience and get introduced to the world of ChatGPT plugins. In this blog, we will walk you through the process of setting up and utilizing the Cassandra Todolist ChatGPT plugin.

While this particular blog is just providing a demo for basic functionality. with the Astra – GPT Plugin, you could use Astra as a knowledge base, adding links, concepts, and ideas to an Astra Database. You could also create a list of articles to read or videos to watch; you could create a modern Rolodex on Astra, having GPT store contact information, notes, and instruction; or have GPT store its output in an Astra database for later reference. With a little imagination, you can extend this service to many use cases.

Prerequisites for ChatGPT Plugins with Astra:

To get started, you’ll need plugin developer access from OpenAI. If you haven’t already joined the waitlist, you can do so here. You’ll also need an Astra Account from DataStax, or to be familiar enough with Cassandra to use an alternative Cassandra database. Sign up for a Free Tier Astra account here. For an effortless setup, we have provided a Gitpod quickstart option– though you’ll still need to fill in your own credentials before it will run seamlessly. Simply click on the “Open in Gitpod” button found in our GitHub repository to get started.

Getting Started with the Repo:

Cloning the Repository:

Begin by cloning the Cassandra Todolist ChatGPT plugin repository to your local machine. Open your terminal and execute the following command:

git clone https://github.com/CassioML/cassandra-todolist-chatgpt-plugin

Once the repository is cloned, navigate into the directory using the command:

cd cassandra-todolist-chatgpt-plugin

Installing Prerequisites:

Install the necessary packages for the plugin by running the following command:

pip install -r requirements.txt

This will ensure that all the required dependencies are installed and ready for use.

Note that if you use the Gitpod deployment method, you’ll deploy a cloud coding environment with all of these steps completed already.

Database and API Setup:

To use the Cassandra Todolist ChatGPT plugin, you need to set up the Astra database and configure the API spec. Please refer to our comprehensive documentation on database setup and API configuration for detailed instructions. Note that having a Cassandra server or DataStax Astra DB is essential for the plugin to function properly. Instructions for how to create an AstraDB are included in detail below and with an alternate method in the CassioML documentation.

Setting up your Astra DB

There is a ton of great documentation for how to create an Astra Database which is included in the Knowledge Resources at the bottom of this STACK page.

In brief, go to astra.datastax.com, create/sign in to your account, create a new DB– they are free for most users– then create a keyspace and run the schema creation script (located at setup/create_schema.cql in the CassioML repo) in the CLI for your database.

For this demo, we use a database called cassio_db and a keyspace named cassio_tutorials. To create that database, select the “Databases” tab (shown on the left menu) then click on the “Create Database button” (shown on the right) and fill out the needed information for your database:

Generating your Tokens and SCBs

Once you’ve created your database, you’ll need to generate the Token or Secure Connect bundle to connect to your database with the connect tab. Choose the permissions that make the most sense for your use case. For this demo, there’s nothing wrong with choosing Database Administrator, but you can also go as simple as a Read/Write Service account to get the functionality you need.

Never share your token or bundle with anyone.

You’ll need to store your token_path in the .env or gitignore file in your repo. Alternatively, you can place the bundle in your Gitpod’s filepath and reference it in your main.py file. Astra has great documentation about different ways to connect to your database in their docs here and referenced in our resources in the Knowledge Management section.

Setting Up The Schema for Your Database

Finally, using the CQL Console Tab (or the CLI installed on your Gitpod), run the script to create your schema using the setup/create_schema.cql script. Note the screenshot below uses an earlier version of the create_schema.cql file. There’s a sneaky problem with the schema this file defines. Can you see it?

Running the API:

To start the Cassandra Todolist ChatGPT plugin, execute the following command in your terminal:

python main.py

This will initialize the plugin with connection to your localhost machine as the server server and prepare it for interaction with the ChatGPT interface.

Plugin Installation and Usage:

Open your web browser and navigate to https://chat.openai.com.

In the Model dropdown, select “Plugins” (if it’s not visible, you might need plugin developer access).

Choose “Plugin store” from the menu.

Select “Develop your own plugin” and enter localhost:5003 as the URL for the locally running server.

Plugin Access

If you don’t have Plugin Developer Access

The Plugin store will display a number of options for approved plugins that OpenAI has certified and approved for widespread use.

Note that this user’s account hasn’t had approval from the OpenAI team to develop custom plugins. 

In an account where Plugin Development has been enabled, there will be an additional option at the bottom of the Plugin Store popup.

Enabling the Plugin once you have permission

If you have been granted permission to create a plugin, you’ll see these options below the verified plugins:

Click the “Develop your own plugin” option.

Next you’ll be asked to submit your domain. Enter localhost:5003 as the URL for the locally running server.

Note that this method works for a deployment generated with a git clone command running on your local machine. If you want to use a deployment from Gitpod, you’ll need to copy the port information from your Gitpod > Ports tab, and then change the values of your server and API URLs in your Plugin Manifest and in your OpenAPI specification file. 

Click “Find manifest file” to discover the plugin. Chat GPT will try to detect it. If it isn’t able to do so you may not have made the port public.

Conclusion:

Congratulations! The Cassandra Todolist ChatGPT plugin is now installed and enabled. Start exploring its capabilities by asking questions like “What is on my to-do list?” and adding new tasks with commands like “Add ‘Buy groceries’ to my to-do list.”

Note that there is a significantly more detailed discussion of how to enable the plugin in the Setup > Enabling your plugin section of the STACK knowledge base below.

Getting Help:

In this blog, we have provided you with a step-by-step guide to build and utilize the Cassandra Todolist ChatGPT plugin. By following these instructions, you can seamlessly integrate a powerful to-do list functionality into your ChatGPT experience. We encourage you to explore the endless possibilities of ChatGPT plugins and create your own custom plugins tailored to your unique needs.

You can reach out to us on the Planet Cassandra Discord Server to get specific support for this demo. You can also reach out to the Astra team through the chat on Astra’s website. Enhance your conversational AI capabilities with ChatGPT plugins and unlock a whole new level of productivity and engagement. Happy coding!

Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation. Sponsored by Anant Corporation and Datastax, and Developed by Anant Corporation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?