Pinecone
Pinecone stores documents in a Pinecone index and searches it by meaning, with filters on each document’s data.
A vector database stores texts so they can be searched by meaning, not just by exact words. That way an agent can find the paragraph of a manual that answers a question even if it uses different words.
When to use it
- You already use Pinecone and want your flows to store and search in it.
- You want to keep each customer’s or department’s documents in separate spaces of the same index.
- You need to create the index from the flow itself if it does not exist yet.
Configuration
The Operation field decides what the component does, and the fields and outputs change with your choice:
Add(default): stores in the database the documents it receives in Ingest Data.Search: finds the documents closest to the text in Search Query.Retriever: offers the database as a search engine for another component to use, for example an agent or a question-answering chain.
You need a Pinecone API credential with your Pinecone account key. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The Pinecone API credential with the connection details. |
| Operation | What the component does: Add, Search or Retriever. |
| Ingest Data (required) | With Add. The documents to store, usually those coming out of a text splitter or a file loader. |
| Search Query | With Search. The text to search for. If left empty, nothing is returned. |
| Embedding | The connector where you plug the component that turns texts into numbers to compare them by meaning, such as OpenAI Embeddings. Always use the same one to store and to search. |
| Index Name (required) | The Pinecone index. |
| Namespace | A space inside the index, to keep groups of documents apart. Empty, the default one. |
Advanced options
| Field | What it does |
|---|---|
| Number Of Results | How many documents each search returns. Default: 4. |
| Distance Strategy | How similarity is measured: Cosine (default), Euclidean or Dot Product. |
| Text Key | The field that holds each document’s text. Default: text. |
| Create Index If Not Exists | Creates the index if it does not exist. When on, Index Dimension, Cloud Provider and Cloud Region appear. |
| Search Type | How to search: Similarity, Similarity with score threshold, MMR (Max Marginal Relevance). Similarity returns the closest; with a threshold, only those above Search Score Threshold; MMR looks for close but varied results. |
| Search Score Threshold | Minimum similarity score, only with the threshold search. Default: 0.0. |
| Apply Metadata Filter | With Search. Turn it on to search only among documents whose data meet some conditions, for example city equal to Barcelona. When on, Filter Mode (Manual, conditions written here; Dynamic, conditions coming from the flow), Logical Operator (AND, all; OR, any) and Number Of Filters appear. |
Output
The outputs depend on Operation:
- Results: with
AddandSearch. WithSearch, the list of documents found, which you can pass to a prompt or an agent. - Vector Store: with
Add. The database, to connect it to components that work with a vector database. - Retriever: with
Retriever. The search engine, to connect it to components that ask for one.
In tool mode, an agent can use the component to search by itself. See Tool Mode.
Example
A consultancy keeps each client’s reports in its own Pinecone space.
- Add Pinecone with Operation set to
Search, the index and the client’s code in Namespace. - Connect the embeddings component they were stored with.
- Put it in tool mode and connect it to the agent.
Related components
- Recursive Character Text Splitter: cuts documents into pieces before storing them.
- OpenAI Embeddings: converts texts so they can be searched by meaning.