Skip to main content

aiotcvectordb — Tencent VectorDB Python Async SDK

CI TestPyPI Publish

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 aiohttp with connection pooling and proxy support.
  • Type parity with tcvectordb (indexes, enums, document types) re-exported under aiotcvectordb.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_cos for AI document upload in CollectionView.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

License

MIT

Metadata

Release files for aiotcvectordb 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiotcvectordb 0.1.1
File Size Uploaded
aiotcvectordb-0.1.1.tar.gz 27.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiotcvectordb 0.1.1
File Interpreter ABI Platform
aiotcvectordb-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 57.5 kB

Release files / aiotcvectordb-0.1.1.tar.gz

Download URL aiotcvectordb-0.1.1.tar.gz
Size 27.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cbaf4e816180817dfeee1fb01df42141926e3682a7ce1307cafa5cd148d2f80a
BLAKE2b-256 checksum
How to use checksums
0f1fde42142e7a17fb3f892b0e171765a315f2bf68aeb40ea6c854c2e99b1519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2025.

Transparency log

Release files / aiotcvectordb-0.1.1-py3-none-any.whl

Download URL aiotcvectordb-0.1.1-py3-none-any.whl
Size 29.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f921a2dfc94692eb60d3f6f93ee92cd141d6300eee925e1535cb494fc084bc41
BLAKE2b-256 checksum
How to use checksums
b4a2bee051b370062e0148945dcad06a8b4f44c87e6deee602897f9e3fe4a054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page