Skip to content

Latest commit

 

History

History

README.md

github-ai-chatbot-llamaindex

AI Chatbot (OpenAI + LlamaIndex)

A starter application for an AI-powered chatbot with Next.js, Lakebase Postgres (pgvector), OpenAI, and LlamaIndex.

It implements a chat interface that takes the user's input, embeds it, and retrieves relevant information from the Neon database using similarity search. It then uses the OpenAI chat API to generate a contextually appropriate response based on the retrieved data and chat history.

Prerequisites

To follow along with this guide, you will need:

  • A Neon account. If you do not have one, sign up at Neon. Your Neon project comes with a ready-to-use Postgres database named neondb. We'll use this database in the following examples.
  • An OpenAI API key. If you do not have an OpenAI account, sign up and navigate to the API keys page to create an API key.
  • Node.js and npm installed on your machine.

Clone the repository

npx degit neondatabase/examples/ai/llamaindex/chatbot-nextjs ./chatbot-nextjs

How to use

  1. Create a .env file:
cp .env.example .env
  1. Update the environment variables with your OpenAI API Key and Lakebase Postgres URL.

  2. Install the dependencies:

npm install
  1. Run the application:
npm run dev

Learn more

Authors