Pinecone
The Pinecone component lets you keep your documents in a fast, cloud‑based vector database called Pinecone. You can add new documents, search for the most similar ones, or get a retriever that can be used later in your workflow.
How it Works
When you use the component, it connects to your Pinecone account through the API key you provide.
- Add: The component takes the documents you give it, turns each one into a vector using the embedding model you supply, and uploads those vectors to the Pinecone index you specify.
- Search: It sends your search query to Pinecone, which looks for the vectors that are most similar to the query vector. The component then returns the matching documents.
- Retriever: It creates a retriever object that can be reused later in the workflow to fetch relevant documents on demand.
All of this happens behind the scenes, so you only need to fill in a few fields in the dashboard.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Add: Uploads documents to the Pinecone index so they can be searched later.
- Search: Finds the most similar documents to a given query.
- Retriever: Builds a retriever object that can be used in other parts of your workflow to fetch relevant documents.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Note: This component requires a Pinecone API credential.
- Configure the Pinecone API credential in the Credentials section of Nappai.
- In the component, choose that credential in the Credential field.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Embedding: The embedding model that turns text into vectors.
- Visible in: Add, Search, Retriever
-
Ingest Data: The documents you want to add to the index.
- Visible in: Add
-
Operation: The action the component will perform.
- Visible in: Add, Search, Retriever
-
Distance Strategy: How Pinecone measures similarity between vectors.
- Visible in: Add, Search, Retriever
-
Index Name: The name of the Pinecone index you want to use.
- Visible in: Add, Search, Retriever
-
Namespace: A sub‑space within the index to keep data organized.
- Visible in: Add, Search, Retriever
-
Number of Results: How many documents to return when searching.
- Visible in: Add, Search, Retriever
-
Search Query: The text you want to search for. Leave empty to retrieve all documents.
- Visible in: Search
-
Text Key: The key in each record that contains the text to embed.
- Visible in: Add, Search, Retriever
Outputs
- Retriever: A retriever object that can be used later in the workflow to fetch relevant documents.
- Results: The list of documents that matched a search query.
- Vector Store: The underlying Pinecone vector store object, useful if you need to perform advanced operations.
Usage Example
Adding Documents
- Set Operation to Add.
- Choose your Embedding model.
- Upload a file or paste text into Ingest Data.
- Enter the Index Name and optional Namespace.
- Click Run.
The component will store the documents in Pinecone.
Searching for Similar Documents
- Set Operation to Search.
- Choose the same Embedding model used when adding.
- Enter a Search Query (e.g., “machine learning trends”).
- Set Number of Results to 5.
- Click Run.
The component returns the top 5 most similar documents.
Related Components
- FAISS Vector Store – A local vector store for smaller datasets.
- Chroma Vector Store – Another cloud‑based vector store with different pricing.
- OpenAI Embeddings – Generates embeddings that can be used with any vector store.
Tips and Best Practices
- Use the same embedding model for adding and searching to keep results consistent.
- Keep the Index Name short and descriptive; it’s easier to remember.
- If you have many documents, consider adding them in batches to avoid timeouts.
- Use Namespace to separate data from different projects or users.
Security Considerations
- The Pinecone API key is stored securely in Nappai’s credential store.
- Never expose the key in your workflow or share the component configuration publicly.
- Make sure only authorized users have access to the credentials and the component.