Skip to main content

Centaur Client Python Sdk Library

Project description

Centaur Client Python Library

Centaur provides fully-managed, serverless, scalable vector-database service for building various machine learning applications. The Centaur client SDK is your gateway to access the Centaur service.

Installation

To install the Centaur client Python SDK, simply run:

pip install centaur-client

QuickStart

You can use Client api to communicate with Centaur service.

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")

Sample Code

Create a Collection

Client host various Collection APIs for interacting with Centaur service.

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
client.create("YOUR-COLLECTION-NAME", dimension=4)

List Collections

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
rsp = client.list()
if rsp:
    collection_list = rsp.output
    print("collection_list:", collection_list)

Describe Collection

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
rsp = client.describe("YOUR-COLLECTION-NAME")
if rsp:
    collection_meta = rsp.output
    print("collection_meta:", collection_meta)

Delete Collection

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
client.delete("YOUR-COLLECTION-NAME")

Get a Collection Instance

Collection provides APIs for accessing Doc and Partition

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
if collection:
    print("collection:", collection)

Describe Collection Statistics

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
rsp = collection.stats()
if rsp:
    collection_stats = rsp.output
    print("collection_stats:", collection_stats)

Insert/Update/Upsert Docs

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
collection.upsert(("YOUR-DOC-ID", [0.1, 0.2], {'price': 100, 'type': "dress"}))

Query a Collection

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
rsp = collection.query([0.1, 0.2], 
                       topk=100, 
                       output_fields=["price"], 
                       include_vector=True)
if rsp:
    doc_list = rsp.output
    print("doc_list:", doc_list)

Delete Docs

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
collection.delete("YOUR-DOC-ID")

Fetch Docs

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
rsp = collection.fetch("YOUR-DOC-ID")
if rsp:
    doc_dict = rsp.output
    print("doc_dict:", doc_dict)

Create a Collection Partition

import centaur

client = centaur.Client(api_key="YOUR-CENTAUR-API-KEY")
collection = client.get("YOUR-COLLECTION-NAME")
collection.create_partition("YOUR-PARTITION-NAME")

Centaur Response

from centaur import CentaurCode

@dataclasses
class CentaurResponse(object):
    code: CentaurCode
    message: str
    request_id: str
    output: Any

License

This project is licensed under the Apache License (Version 2.0).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

centaur_client-0.0.10-py3-none-any.whl (70.8 kB view details)

Uploaded Python 3

File details

Details for the file centaur_client-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for centaur_client-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 6eace934d2eb481f417ef6500e23fe0a61aaf4b1a6271320b90f176c8a7e62de
MD5 3bab036fcd4522276d7301ac6c2d988e
BLAKE2b-256 2c1be7b6ce4f5c5b023159b143233185412be1abec344542b8560f2dd6f15370

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page