Couchbase
The Couchbase component lets you store text documents in a Couchbase database and then find the most similar ones using vector embeddings. It works with the Nappai automation system so you can add, search, or retrieve data without writing code.
How it Works
When you use this component, Nappai connects to your Couchbase cluster with the credentials you set up.
- Add: The component takes the documents you give it, turns them into vectors with an embedding model, and writes them into a specified bucket, scope, and collection.
- Search: It runs a similarity search against the stored vectors and returns the top‑N documents that best match your query.
- Retriever: It builds a retriever object that can be passed to other components (like a language model) so they can fetch relevant documents on demand.
All of this happens inside Nappai, so you only need to provide the connection details and the data you want to work with.
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: Ingest documents into the Couchbase vector store.
- Search: Find the most similar documents to a given query.
- Retriever: Create a retriever object that can be used by other components to fetch relevant documents.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Credential
This component requires a Couchbase API credential.
- In the Nappai dashboard, go to Credentials and create a new Couchbase API credential.
- Enter the Couchbase Cluster connection string, Couchbase username, and Couchbase password.
- Back in the component, choose that credential from the Credential dropdown.
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 vector store.
- Visible in: Add
-
Operation: Choose which action the component should perform.
- Visible in: Add, Search, Retriever
-
Bucket Name: The name of the Couchbase bucket where data will be stored.
- Visible in: Add, Search, Retriever
-
Collection Name: The name of the collection inside the bucket.
- Visible in: Add, Search, Retriever
-
Index Name: The name of the vector index to use for similarity search.
- Visible in: Add, Search, Retriever
-
Number of Results: How many documents to return when searching.
- Visible in: Add, Search, Retriever
-
Scope Name: The scope inside the bucket that contains the collection.
- Visible in: Add, Search, Retriever
-
Search Query: The text you want to search for. Leave empty to retrieve all documents.
- Visible in: Search
Outputs
- Retriever: A retriever object that can be passed to other components to fetch relevant documents.
- Results: A list of documents that match the search query.
- Vector Store: The underlying Couchbase vector store object (useful for advanced configurations).
Usage Example
Adding Documents
- Set Operation to Add.
- Choose an Embedding model.
- Upload or paste your documents into Ingest Data.
- Fill in Bucket Name, Scope Name, Collection Name, and Index Name.
- Click Run. The component will store the documents in Couchbase.
Searching for Similar Documents
- Set Operation to Search.
- Choose the same Embedding model used for 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 in the Results output.
Related Components
- OpenAI Embeddings – Generate embeddings that can be used with this component.
- Retriever – Use the retriever output from this component in a language model workflow.
Tips and Best Practices
- Use the same embedding model for both adding and searching to ensure consistent vector space.
- Keep the Number of Results reasonable (e.g., 4–10) to avoid overwhelming downstream components.
- Store documents in a dedicated bucket to keep your data organized and secure.
Security Considerations
- Store your Couchbase credentials in Nappai’s secure credential store, not in the component’s input fields.
- Ensure the Couchbase user has only the permissions needed for the bucket, scope, and collection you are using.
- Regularly rotate credentials and monitor access logs for unusual activity.