Couchbase
Couchbase stores documents in a Couchbase collection and searches it by meaning with a search index.
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
- Your application already uses Couchbase and you want to add search by meaning.
- You want an agent to consult documents stored in Couchbase.
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 Couchbase API credential with the connection string, user and password. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The Couchbase 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. |
| Bucket Name (required) | The Couchbase bucket. |
| Scope Name (required) | The scope inside the bucket. |
| Collection Name (required) | The collection where documents are stored. |
| Index Name (required) | That collection’s search index. |
Advanced options
| Field | What it does |
|---|---|
| Number Of Results | How many documents each search returns. Default: 4. |
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 travel agency keeps its package descriptions in Couchbase.
- Add Couchbase with Operation set to
Searchand fill in bucket, scope, collection and index. - Connect the embeddings component they were stored with.
- Put it in tool mode so the agent searches trips by what the customer asks.
Related components
- Recursive Character Text Splitter: cuts documents into pieces before storing them.
- OpenAI Embeddings: converts texts so they can be searched by meaning.