autogen.agentchat.contrib.vectordb.couchbase.CouchbaseVectorDB
CouchbaseVectorDB
A vector database implementation that uses Couchbase as the backend.
Initialize the vector database.
Name | Description |
---|---|
connection_string | Type: str Default: ‘couchbase |
username | Type: str Default: ‘Administrator’ |
password | Type: str Default: ‘password’ |
bucket_name | Type: str Default: ‘vector_db’ |
embedding_function | Type: Callable Default: None |
scope_name | Type: str Default: ‘_default’ |
collection_name | Type: str Default: ‘_default’ |
index_name | Type: str Default: None |
Class Attributes
active_collection
embedding_function
type
Instance Methods
create_collection
Create a collection in the vector database and create a vector search index in the collection.
Name | Description |
---|---|
collection_name | The name of the collection. Type: str |
overwrite | Whether to overwrite the collection if it exists. Default is False. Type: bool Default: False |
get_or_create | Whether to get or create the collection. Default is True Type: bool Default: True |
create_index_if_not_exists
Creates a vector search index on the specified collection in Couchbase.
Name | Description |
---|---|
index_name | The name of the vector search index to create. Defaults to “vector_search_index”. Type: str Default: ‘vector_index’ |
collection | The Couchbase collection to create the index on. Defaults to None. Type: ForwardRef(‘Collection’) | None Default: None |
create_vector_search_index
Create a vector search index in the collection.
Parameters:Name | Description |
---|---|
collection | |
index_name | Type: str | None Default: ‘vector_index’ |
similarity | Type: Literal[‘l2_norm’, ‘dot_product’] Default: ‘dot_product’ |
delete_collection
Delete the collection from the vector database.
Name | Description |
---|---|
collection_name | The name of the collection. Type: str |
delete_docs
Delete documents from the collection of the vector database.
Parameters:Name | Description |
---|---|
ids | Type: list[str | int] |
collection_name | Type: str Default: None |
batch_size | Type: int Default: 1000 |
**kwargs |
get_collection
Get the collection from the vector database.
Name | Description |
---|---|
collection_name | The name of the collection. Default is None. If None, return the current active collection. Type: str | None Default: None |
Type | Description |
---|---|
Collection | The collection object (Collection) |
get_docs_by_ids
Retrieve documents from the collection of the vector database based on the ids.
Parameters:Name | Description |
---|---|
ids | Type: list[str | int] | None Default: None |
collection_name | Type: str Default: None |
include | Type: list[str] | None Default: None |
**kwargs | Type: Any |
insert_docs
Insert Documents and Vector Embeddings into the collection of the vector database. Documents are upserted in all cases.
Parameters:Name | Description |
---|---|
docs | Type: list[Document] |
collection_name | Type: str Default: None |
upsert | Type: bool Default: False |
batch_size | Type: int Default: 1000 |
**kwargs | Type: Any |
retrieve_docs
Retrieve documents from the collection of the vector database based on the queries.
Note: Distance threshold is not supported in Couchbase FTS.
Name | Description |
---|---|
queries | Type: list[str] |
collection_name | Type: str Default: None |
n_results | Type: int Default: 10 |
distance_threshold | Type: float Default: -1 |
**kwargs | Type: Any |
search_index_exists
Check if the specified index is ready
Parameters:Name | Description |
---|---|
index_name | Type: str |
update_docs
Update documents, including their embeddings, in the Collection.
Parameters:Name | Description |
---|---|
docs | Type: list[Document] |
collection_name | Type: str Default: None |
batch_size | Type: int Default: 1000 |
**kwargs | Type: Any |
upsert_docs
Name | Description |
---|---|
docs | Type: list[Document] |
collection | Type: Collection |
batch_size | Type: int Default: 1000 |
**kwargs | Type: Any |