The Pinecone Assistant sample app connects a chat interface to your assistant so it can answer complex questions about your own data. Users can upload PDF documents, then ask questions about their content in the chat.
Built with
- Pinecone Assistant
- Next.js and Tailwind CSS
- Node.js 20 or later
Run the sample app
To create the sample app, use thecreate-pinecone-app CLI:Terminal
Get your Pinecone API key
You need an API key to make calls to your Pinecone project:Then copy your generated key:You can also copy an existing key from the API keys page in the Pinecone console.
.env
Create an assistant
Create an assistant in the Pinecone console or with the API, and upload the files you want it to answer questions about. For more information, see Create an assistant.
Install dependencies
The app requires Node.js 20 or later. From the project root directory, install the dependencies:
Terminal
Project structure

- Frontend: Next.js, Tailwind CSS, and custom React components that power the chat interface.
- Backend: Next.js API routes that proxy requests to the Pinecone Assistant API.
Key features
- Connect to an existing assistant: The app connects to an assistant you’ve already created, so you can host a chat experience privately or publicly.
- Streaming responses: The assistant’s answers stream to the frontend in real time.
- Reference highlighting: The app highlights the documents the assistant used to answer each question.
Implementation details
Server action for chat
The server action opens a streaming chat request to the Pinecone Assistant API and passes each event to the client:TypeScript
Chat functionality
TheHome component sends the user’s message to the server action, reads the stream, and updates the UI as content arrives:TypeScript