Pinecone Assistant
Pinecone Assistant
Connect a chat interface to your Pinecone Assistant for retrieval augmented generation (RAG)-based question answering on your uploaded documents.
$ npx create-pinecone-app@latest --template pinecone-assistant
The Pinecone Assistant sample app demonstrates how to connect a chat interface to your Pinecone Assistant for retrieval augmented generation (RAG)-based question answering on your uploaded documents. This app allows users to upload PDF documents, process them, and then ask questions about the content using a chat interface.
Built with
- Pinecone Assistant API
- Next.js + tailwind
- Node version 20 or higher
Run the sample app
The fastest way to get started is to use the create-pinecone-app
CLI tool to get up and running:
Get your API key
You need an API key to make API calls to your Pinecone project:
Then copy your generated key:
Alternatively, follow these steps:
- Open the Pinecone console.
- Select your project.
- Go to API Keys.
- Copy your API key.
Create a Pinecone Assistant
You can create a Pinecone Assistant in the console, or by following the instructions here.
Start the project
Requires Node version 20+
Dependency installation
From the project root directory, run the following command:
Make sure you have populated the .env
file with relevant keys:
Start the app:
Project structure
This project uses a standard Next.js application structure with API routes for backend functionality.
Frontend client
The frontend uses Next.js, Tailwind CSS, and custom React components to power the chat interface.
Backend server
This project uses Next.js API routes to proxy requests to the Pinecone Assistant API.
Key features
-
Connect to existing Pinecone Assistant: Connect to an existing Pinecone Assistant to provide a chat experience that can be hosted privately or publicly.
-
Streaming responses: Ask questions of the assistant and get responses streamed to the frontend in real-time.
-
Reference highlighting: Documents that were used in answering user questions are highlighted as references.
Implementation details
Server action for chat
The server action creates a stream with Pinecone Assistants:
Chat functionality
The chat functionality in the Home component consumes the stream from the server action and updates the UI in real-time:
Troubleshooting
Experiencing any issues with the sample app? Submit an issue, create a PR, or post in our community forum!
Was this page helpful?