Pinecone Assistant quickstart
This guide shows you how to set up and use Pinecone Assistant, a service that allows you to upload documents, ask questions, and receive responses that reference your documents.
1. Install the Python SDK
You can use the Assistant API directly or via the Pinecone Python SDK.
To interact with Pinecone Assistant using the Python SDK, install the client and the pinecone-plugin-assistant
package as follows:
2. 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 a key. If you don’t have a Pinecone account, the widget will sign you up for the free Starter plan.
Your generated API key:
3. Create an assistant
To create an assistant, use the create_assistant
operation as in the following example:
4. Upload a file to the assistant
With Pinecone Assistant, you can upload documents, ask questions, and receive responses that reference your documents. This is known as retrieval-augmented generation (RAG).
For this quickstart, download a sample 10-k filing file to your local device.
Next, use the upload_file
operation to upload the file to your assistant:
5. Chat with the assistant
With the sample file uploaded, you can now ask the assistant questions about your document.
To chat with a Pinecone assistant, use the chat_assistant
endpoint. It returns either a JSON object or a text stream.
The following example requests a JSON response to the message, “How many employees did Netflix have by the end of 2023?”:
The example above returns a response like the following:
6. Clean up
When you no longer need the example-assistant
, use the delete_assistant
operation to delete it:
Deleting an assistant also deletes all files uploaded to the assistant.
Next steps
- Learn more about Pinecone Assistant
- Learn about additional assistant features
- Evaluate the assistant’s responses
- View a sample app that uses Pinecone Assistant
Was this page helpful?