DEV Community

Cover image for Quick tip: Using SingleStoreDB with LlamaIndex
Akmal Chaudhri for SingleStore

Posted on • Updated on

Quick tip: Using SingleStoreDB with LlamaIndex

Abstract

In a previous article, we saw an example of the integration of SingleStoreDB with LangChain. Another emerging framework is LlamaIndex. In this short article, we'll take an example from the LlamaIndex documentation and apply it to SingleStoreDB.

The notebook file used in this article is available on GitHub.

Introduction

In this short article, we'll test the ability of SingleStoreDB to work with LlamaIndex using an example from the documentation. This should be very straightforward. In later articles, we'll see if we can achieve tighter integration.

As described in a previous article, we'll follow the instructions to create a SingleStoreDB Cloud account, Workspace Group, Workspace, and Notebook.

Create the Database

From the left nav in our SingleStoreDB Cloud account, we'll select the DEVELOP > Data Studio > Open SQL Editor and run the following commands:

CREATE DATABASE IF NOT EXISTS demo_db;

USE demo_db;

DROP TABLE IF EXISTS city_stats;
Enter fullscreen mode Exit fullscreen mode

Fill out the Notebook

We'll follow the example described in the documentation and modify it, where required, to work with the SingleStore Portal. The modified notebook can be found on GitHub.

We’ll run the notebook code and enter the OpenAI API Key when prompted. The code execution results should be identical to the original LlamaIndex example.

Summary

In this quick example, we have seen how to use LlamaIndex with SingleStoreDB. Only a few minor code modifications were required to the example from the LlamaIndex documentation.

Top comments (0)