Skip to main content

Couchbase

Distributed NoSQL database with vector search capabilities.

Setup

pip install couchbase

Docker

docker run -d --name couchbase \
  -p 8091-8096:8091-8096 \
  -p 11210-11211:11210-11211 \
  couchbase:latest

Quick Start (Agent with Knowledge)

Use Couchbase as a knowledge store with an agent:
from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant with access to documents.",
    knowledge=["./docs/guide.pdf"],
    knowledge_config={
        "vector_store": "couchbase",
        "connection_string": "couchbase://localhost",
        "username": "Administrator",
        "password": "password",
        "bucket_name": "praisonai"
    }
)

agent.chat("What does the guide say?")

Advanced Usage (Direct Store)

from praisonai.persistence.factory import create_knowledge_store

store = create_knowledge_store(
    "couchbase",
    connection_string="couchbase://localhost",
    username="Administrator",
    password="password",
    bucket_name="praisonai"
)

Configuration

OptionDescription
connection_stringCouchbase connection string
usernameCouchbase username
passwordCouchbase password
bucket_nameBucket name
scope_nameScope name (default: _default)
collection_nameCollection name (default: vectors)
index_nameVector search index name
embedding_dimEmbedding dimension (default: 1536)

Vector Search Index

Create a vector search index via Couchbase UI or API:
{
  "type": "fulltext-index",
  "name": "vector_index",
  "sourceType": "couchbase",
  "sourceName": "praisonai",
  "planParams": {
    "indexPartitions": 1
  },
  "params": {
    "mapping": {
      "types": {
        "vectors": {
          "properties": {
            "embedding": {
              "enabled": true,
              "dynamic": false,
              "fields": [{
                "dims": 1536,
                "similarity": "dot_product",
                "type": "vector"
              }]
            }
          }
        }
      }
    }
  }
}

Best For

  • High-performance distributed deployments
  • Multi-model database needs
  • Edge computing scenarios