Skip to main content

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')
collections = client.list()
print(collections)

Describe Collection

import centaur

client = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')
rsp = client.describe('YOUR-COLLECTION-NAME')
print(rsp)

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()
print(rsp)

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')
match_docs = collection.query([0.1, 0.2, 0.3, 0.4], 
                       topk=100, 
                       include_vector=True)
if match_docs:
    for doc in match_docs:
        print(doc)

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')
fetch_docs = collection.fetch(['YOUR-DOC-ID1', 'YOUR-DOC-ID2'])
if fetch_docs:
    for doc_id in fetch_docs:
        print(fetch_docs[doc_id])

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).

Metadata

Release files for centaur-client 0.0.11

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

Built distribution (wheel)

Table of built distributions (wheels) for centaur-client 0.0.11
File Interpreter ABI Platform
centaur_client-0.0.11-py3-none-any.whl Python 3 none any Details

Release files / centaur_client-0.0.11-py3-none-any.whl

Download URL centaur_client-0.0.11-py3-none-any.whl
Size 71.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0827945bb5d222a0b155f6ac0f92cd79223809da930583a411d2a0845ab0a9cd
BLAKE2b-256 checksum
How to use checksums
1c1c9595fb0ec717f5dba41078593d59afb5d8c9138eb5b841134a626a1fa90c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.16

Release history Release notifications | RSS feed

This release

0.0.11 This release

1 release file

0.0.10

1 release file

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