Install an SDK
The Pinecone Python SDK and Node.js SDK provide programmatic access to the Assistant API. The Python SDK requires Python 3.10 or later, and the Node.js SDK requires Node.js 22 or later.
Get an API key
You need an API key to make calls to your assistant. Create a new API key in the Pinecone console, or use the widget below to generate one. If you don’t have a Pinecone account, the widget signs you up for the free Starter plan.Your generated API key:If you generate a key with the widget, the code samples on this page include it. Otherwise, replace
YOUR_API_KEY in the samples with your key.Create an assistant
Create an assistant named
example-assistant. The instructions apply to every response the assistant gives, and region sets where the assistant is deployed (us or eu).The Python SDK waits until the assistant is ready before it returns. The Node.js SDK returns right away, so the example checks the assistant’s status until it’s no longer Initializing.Upload a file
Download the sample file, a Netflix 10-K filing, to your local device. Then upload it to your assistant, replacing
/path/to/ with the folder you saved it in. The metadata is optional. It’s returned with each citation, and you can use it to filter which files the assistant uses.The assistant has to process the file before it can answer questions about it, which can take a few minutes. The Python SDK waits until processing finishes. The Node.js SDK returns an operation, so the example checks the operation’s status until it’s Completed.Chat with the assistant
Chat with the assistant by asking it a question about the file:The assistant answers from the uploaded file:The response also includes
Output
citations. Each citation marks a position in the answer and lists the file and pages that support it. The full API response looks like the following:Response
Clean up
When you no longer need
example-assistant, delete it:Next steps
- Evaluate the assistant’s answers against a ground truth answer (Standard and Enterprise plans).
- Choose a model, stream responses, and filter by metadata when you chat with an assistant.
- Retrieve context snippets to use with your own LLM.
- Explore a sample app built on Pinecone Assistant.