aiotcvectordb


Nameaiotcvectordb JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryTencent VectorDB Python Async SDK
upload_time2025-09-15 08:29:40
maintainerNone
docs_urlNone
authorAlvie Zhang
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Alvie Zhang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords aiohttp async database tencent vector vectordb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aiotcvectordb — Tencent VectorDB Python Async SDK

[![CI](https://github.com/alviezhang/aiotcvectordb/actions/workflows/ci.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/ci.yml)
[![TestPyPI](https://github.com/alviezhang/aiotcvectordb/actions/workflows/testpypi.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/testpypi.yml)
[![Publish](https://github.com/alviezhang/aiotcvectordb/actions/workflows/release.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/release.yml)

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

```bash
pip install aiotcvectordb
```

From source (repo root):

```bash
pip install -e .
# or with uv
uv pip install -e .
```

## Quickstart

```python
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

```python
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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aiotcvectordb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "aiohttp, async, database, tencent, vector, vectordb",
    "author": "Alvie Zhang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0f/1f/de42142e7a17fb3f892b0e171765a315f2bf68aeb40ea6c854c2e99b1519/aiotcvectordb-0.1.1.tar.gz",
    "platform": null,
    "description": "# aiotcvectordb \u2014 Tencent VectorDB Python Async SDK\n\n[![CI](https://github.com/alviezhang/aiotcvectordb/actions/workflows/ci.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/ci.yml)\n[![TestPyPI](https://github.com/alviezhang/aiotcvectordb/actions/workflows/testpypi.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/testpypi.yml)\n[![Publish](https://github.com/alviezhang/aiotcvectordb/actions/workflows/release.yml/badge.svg)](https://github.com/alviezhang/aiotcvectordb/actions/workflows/release.yml)\n\nAn asyncio-first client for Tencent Cloud VectorDB built on top of `aiohttp`. It mirrors the official `tcvectordb` SDK\u2019s models and request payloads, while providing non-blocking APIs and REPL-friendly representations.\n\nLooking for Chinese docs? See README_zh.md.\n\n## Features\n\n- Fully async HTTP client using `aiohttp` with connection pooling and proxy support.\n- Type parity with `tcvectordb` (indexes, enums, document types) re-exported under `aiotcvectordb.model`.\n- Convenient async wrappers: `AsyncDatabase`, `AsyncCollection`, `AsyncCollectionView`, `AsyncDocumentSet`.\n- Supports vector search, hybrid search (dense/sparse), text search with server-side embeddings, and full-text search.\n\n## Requirements\n\n- Python 3.9+\n- Dependencies: `tcvectordb`, `aiohttp`, `numpy`\n- Optional: `qcloud_cos` for AI document upload in `CollectionView.upload/load_and_split_text`\n\n## Install\n\n```bash\npip install aiotcvectordb\n```\n\nFrom source (repo root):\n\n```bash\npip install -e .\n# or with uv\nuv pip install -e .\n```\n\n## Quickstart\n\n```python\nimport asyncio\nfrom aiotcvectordb import AsyncVectorDBClient\nfrom aiotcvectordb.model import (\n    Index, VectorIndex, FilterIndex,\n    FieldType, IndexType, MetricType,\n)\n\nasync def main():\n    async with AsyncVectorDBClient(\n        url=\"http://127.0.0.1:8081\",\n        username=\"root\",\n        key=\"<your-api-key>\",\n    ) as client:\n        # Create database if not exists\n        await client.create_database_if_not_exists(\"demo_db\")\n\n        # Define indexes for the collection\n        idx = Index()\n        idx.add(VectorIndex(\n            name=\"vector\",\n            dimension=3,\n            index_type=IndexType.HNSW,\n            metric_type=MetricType.COSINE,\n            params={\"M\": 8, \"efConstruction\": 80},\n        ))\n        idx.add(FilterIndex(\n            name=\"id\",\n            field_type=FieldType.String,\n            index_type=IndexType.PRIMARY_KEY,\n        ))\n\n        # Create collection if not exists\n        await client.create_collection_if_not_exists(\n            database_name=\"demo_db\",\n            collection_name=\"demo_coll\",\n            shard=1,\n            replicas=1,\n            index=idx,\n        )\n\n        # Upsert documents\n        docs = [\n            {\"id\": \"1\", \"vector\": [0.1, 0.2, 0.3], \"tag\": \"hello\"},\n            {\"id\": \"2\", \"vector\": [0.2, 0.3, 0.1], \"tag\": \"world\"},\n        ]\n        await client.upsert(\"demo_db\", \"demo_coll\", documents=docs)\n\n        # Vector similarity search\n        res = await client.search(\n            database_name=\"demo_db\",\n            collection_name=\"demo_coll\",\n            vectors=[[0.1, 0.2, 0.3]],\n            limit=5,\n            retrieve_vector=False,\n        )\n        print(res)\n\nasyncio.run(main())\n```\n\n## Common Operations\n\n- Databases: `create_database`, `create_database_if_not_exists`, `drop_database`, `list_databases`\n- Collections: `create_collection`, `create_collection_if_not_exists`, `describe_collection`, `list_collections`, `truncate_collection`, `set_alias`, `delete_alias`\n- Documents: `upsert`, `query`, `count`, `update`, `delete`\n- Search: `search`, `search_by_id`, `search_by_text` (server-side embedding), `hybrid_search`, `fulltext_search`\n\n## AI Document Database\n\n```python\nfrom aiotcvectordb.model import SplitterProcess\n\naidb = await client.create_ai_database(\"ai_demo\")\ncv = await aidb.create_collection_view(name=\"cv1\")\nds = await cv.load_and_split_text(\"./doc.pdf\", splitter_process=SplitterProcess())\nresults = await cv.search(\"your question\", limit=5)\n```\n\n## Links\n\n- Repo: https://github.com/alviezhang/aiotcvectordb\n- Issues: https://github.com/alviezhang/aiotcvectordb/issues\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Alvie Zhang\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Tencent VectorDB Python Async SDK",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/alviezhang/aiotcvectordb",
        "Issues": "https://github.com/alviezhang/aiotcvectordb/issues",
        "Repository": "https://github.com/alviezhang/aiotcvectordb"
    },
    "split_keywords": [
        "aiohttp",
        " async",
        " database",
        " tencent",
        " vector",
        " vectordb"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b4a2bee051b370062e0148945dcad06a8b4f44c87e6deee602897f9e3fe4a054",
                "md5": "a4c13f5222e9535656385c14b6d10424",
                "sha256": "f921a2dfc94692eb60d3f6f93ee92cd141d6300eee925e1535cb494fc084bc41"
            },
            "downloads": -1,
            "filename": "aiotcvectordb-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4c13f5222e9535656385c14b6d10424",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 29931,
            "upload_time": "2025-09-15T08:29:39",
            "upload_time_iso_8601": "2025-09-15T08:29:39.371358Z",
            "url": "https://files.pythonhosted.org/packages/b4/a2/bee051b370062e0148945dcad06a8b4f44c87e6deee602897f9e3fe4a054/aiotcvectordb-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0f1fde42142e7a17fb3f892b0e171765a315f2bf68aeb40ea6c854c2e99b1519",
                "md5": "75c21217765ef540827eea33e56fcac4",
                "sha256": "cbaf4e816180817dfeee1fb01df42141926e3682a7ce1307cafa5cd148d2f80a"
            },
            "downloads": -1,
            "filename": "aiotcvectordb-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "75c21217765ef540827eea33e56fcac4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 27546,
            "upload_time": "2025-09-15T08:29:40",
            "upload_time_iso_8601": "2025-09-15T08:29:40.490506Z",
            "url": "https://files.pythonhosted.org/packages/0f/1f/de42142e7a17fb3f892b0e171765a315f2bf68aeb40ea6c854c2e99b1519/aiotcvectordb-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-15 08:29:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alviezhang",
    "github_project": "aiotcvectordb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiotcvectordb"
}
        
Elapsed time: 2.92994s