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')
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).
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for centaur_client-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0827945bb5d222a0b155f6ac0f92cd79223809da930583a411d2a0845ab0a9cd |
|
MD5 | bbc6405af22912791f1549adf3b5d6db |
|
BLAKE2b-256 | 1c1c9595fb0ec717f5dba41078593d59afb5d8c9138eb5b841134a626a1fa90c |