Skip to main content
SAMPLE APP

Pinecone Assistant

A chat interface for your Pinecone Assistant to answer complex questions on your proprietary data
The Pinecone Assistant sample app demonstrates how to connect a chat interface to your Pinecone Assistant to answer complex questions on your proprietary data. 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:
  1. Open the Pinecone console.
  2. Select your project.
  3. Go to API Keys.
  4. 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 clientThe frontend uses Next.js, Tailwind CSS, and custom React components to power the chat interface.Backend serverThis project uses Next.js API routes to proxy requests to the Pinecone Assistant API.Pinecone Assistant

Key features

  1. Connect to existing Pinecone Assistant: Connect to an existing Pinecone Assistant to provide a chat experience that can be hosted privately or publicly.
  2. Streaming responses: Ask questions of the assistant and get responses streamed to the frontend in real-time.
  3. Reference highlighting: Documents that were used in answering user questions are highlighted as references.

Implementation details

Server action for chatThe server action creates a stream with Pinecone Assistants:
Chat functionalityThe 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!