Tencent VectorDB Python Async SDK
Project description
aiotcvectordb — Tencent VectorDB Python Async SDK
An asyncio-first client for Tencent Cloud VectorDB built on top of aiohttp. It mirrors the official tcvectordb SDK’s models and request payloads, while providing non-blocking APIs and REPL-friendly representations.
Looking for Chinese docs? See README_zh.md.
Features
- Fully async HTTP client using
aiohttpwith connection pooling and proxy support. - Type parity with
tcvectordb(indexes, enums, document types) re-exported underaiotcvectordb.model. - Convenient async wrappers:
AsyncDatabase,AsyncCollection,AsyncCollectionView,AsyncDocumentSet. - Supports vector search, hybrid search (dense/sparse), text search with server-side embeddings, and full-text search.
Requirements
- Python 3.9+
- Dependencies:
tcvectordb,aiohttp,numpy - Optional:
qcloud_cosfor AI document upload inCollectionView.upload/load_and_split_text
Install
pip install aiotcvectordb
From source (repo root):
pip install -e .
# or with uv
uv pip install -e .
Quickstart
import asyncio
from aiotcvectordb import AsyncVectorDBClient
from aiotcvectordb.model import (
Index, VectorIndex, FilterIndex,
FieldType, IndexType, MetricType,
)
async def main():
async with AsyncVectorDBClient(
url="http://127.0.0.1:8081",
username="root",
key="<your-api-key>",
) as client:
# Create database if not exists
await client.create_database_if_not_exists("demo_db")
# Define indexes for the collection
idx = Index()
idx.add(VectorIndex(
name="vector",
dimension=3,
index_type=IndexType.HNSW,
metric_type=MetricType.COSINE,
params={"M": 8, "efConstruction": 80},
))
idx.add(FilterIndex(
name="id",
field_type=FieldType.String,
index_type=IndexType.PRIMARY_KEY,
))
# Create collection if not exists
await client.create_collection_if_not_exists(
database_name="demo_db",
collection_name="demo_coll",
shard=1,
replicas=1,
index=idx,
)
# Upsert documents
docs = [
{"id": "1", "vector": [0.1, 0.2, 0.3], "tag": "hello"},
{"id": "2", "vector": [0.2, 0.3, 0.1], "tag": "world"},
]
await client.upsert("demo_db", "demo_coll", documents=docs)
# Vector similarity search
res = await client.search(
database_name="demo_db",
collection_name="demo_coll",
vectors=[[0.1, 0.2, 0.3]],
limit=5,
retrieve_vector=False,
)
print(res)
asyncio.run(main())
Common Operations
- Databases:
create_database,create_database_if_not_exists,drop_database,list_databases - Collections:
create_collection,create_collection_if_not_exists,describe_collection,list_collections,truncate_collection,set_alias,delete_alias - Documents:
upsert,query,count,update,delete - Search:
search,search_by_id,search_by_text(server-side embedding),hybrid_search,fulltext_search
AI Document Database
from aiotcvectordb.model import SplitterProcess
aidb = await client.create_ai_database("ai_demo")
cv = await aidb.create_collection_view(name="cv1")
ds = await cv.load_and_split_text("./doc.pdf", splitter_process=SplitterProcess())
results = await cv.search("your question", limit=5)
Links
- Repo: https://github.com/alviezhang/aiotcvectordb
- Issues: https://github.com/alviezhang/aiotcvectordb/issues
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiotcvectordb-0.1.1.tar.gz.
File metadata
- Download URL: aiotcvectordb-0.1.1.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbaf4e816180817dfeee1fb01df42141926e3682a7ce1307cafa5cd148d2f80a
|
|
| MD5 |
75c21217765ef540827eea33e56fcac4
|
|
| BLAKE2b-256 |
0f1fde42142e7a17fb3f892b0e171765a315f2bf68aeb40ea6c854c2e99b1519
|
Provenance
The following attestation bundles were made for aiotcvectordb-0.1.1.tar.gz:
Publisher:
release.yml on alviezhang/aiotcvectordb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotcvectordb-0.1.1.tar.gz -
Subject digest:
cbaf4e816180817dfeee1fb01df42141926e3682a7ce1307cafa5cd148d2f80a - Sigstore transparency entry: 517854148
- Sigstore integration time:
-
Permalink:
alviezhang/aiotcvectordb@861676b0b1385a805453acdd4e74313c97cd22e0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/alviezhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861676b0b1385a805453acdd4e74313c97cd22e0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiotcvectordb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aiotcvectordb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f921a2dfc94692eb60d3f6f93ee92cd141d6300eee925e1535cb494fc084bc41
|
|
| MD5 |
a4c13f5222e9535656385c14b6d10424
|
|
| BLAKE2b-256 |
b4a2bee051b370062e0148945dcad06a8b4f44c87e6deee602897f9e3fe4a054
|
Provenance
The following attestation bundles were made for aiotcvectordb-0.1.1-py3-none-any.whl:
Publisher:
release.yml on alviezhang/aiotcvectordb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotcvectordb-0.1.1-py3-none-any.whl -
Subject digest:
f921a2dfc94692eb60d3f6f93ee92cd141d6300eee925e1535cb494fc084bc41 - Sigstore transparency entry: 517854172
- Sigstore integration time:
-
Permalink:
alviezhang/aiotcvectordb@861676b0b1385a805453acdd4e74313c97cd22e0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/alviezhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861676b0b1385a805453acdd4e74313c97cd22e0 -
Trigger Event:
release
-
Statement type: