メインコンテンツまでスキップ

AsyncMilvusClient
Private Preview

Addedv2.5.x

An AsyncMilvusClient instance represents an asynchronous Python client that connects to a specific Zilliz Cloud cluster. It provides the same parameter sets and behaviors as MilvusClient, and the only difference lies in the way you call them.

pymilvus.AsyncMilvusClient

Constructor

Constructs a client for common use cases.

📘Notes
  • This interface is still in its early stage and may change significantly in future releases. You are advised not to use it in production.

  • To call AsyncMilvusClient, you need to get an event loop from asyncio to manage request handling. For details, refer to Tutorial: Use AsyncMilvusClient with asyncio.

AsyncMilvusClient(
uri: str,
user: str,
password: str,
db_name: str,
token: str,
timeout=None,
**kwargs
)

PARAMETERS:

  • uri (string) -

    The URI of the Zilliz Cloud cluster. For example:

    https://inxx-xxxxxxxxxxxxxxxxx.aws-us-west-2.vectordb-uat3.zillizcloud.com:19540
  • user (string) -

    A valid username used to connect to the specified Zilliz Cloud cluster.

    This should be used along with password.

  • password (string) -

    A valid password used to connect to the specified Zilliz Cloud cluster.

    This should be used along with user.

  • db_name (string) -

    The name of the database to which the target Milvus instance belongs.

  • token (string) -

    A valid access token to access the specified Zilliz Cloud cluster.

    This can be used as a recommended alternative to setting user and password separately.

    When setting this field, notice that:

    A valid token should be either

    • An API key with sufficient permissions, or

    • A pair of username and password used to access the target cluster, joined by a colon (:). For example, you can set this to username:p@ssw0rd.

  • timeout (float | None)

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

Examples

import asyncio
from pymilvus import MilvusClient

# Get an event loop from asyncio
loop = asyncio.get_event_loop()

# Authentication enabled with a cluster user
client = AsyncMilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password", # replace this with your token,
db_name="default"
)
📘Notes

Set uri to your cluster endpoint. The token parameter can be a Zilliz Cloud API key with sufficient permissions or the credentials of a cluster user in the format of username:p@ssw0rd.