centaur-client


Namecentaur-client JSON
Version 0.0.11 PyPI version JSON
download
home_pagehttps://github.com/alibaba/proxima
SummaryCentaur Client Python Sdk Library
upload_time2023-07-06 09:24:57
maintainer
docs_urlNone
authorAlibaba
requires_python>=3.7.0
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:
```shell
pip install centaur-client
```

## QuickStart
You can use `Client` api to communicate with Centaur service.

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

```python
import centaur

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

### List Collections

```python
import centaur

client = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')
collections = client.list()
print(collections)
```

### Describe Collection

```python
import centaur

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

### Delete Collection
```python
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`

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

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

### Fetch Docs
```python
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
```python
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
```python
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).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alibaba/proxima",
    "name": "centaur-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alibaba",
    "author_email": "centaur@alibaba-inc.com",
    "download_url": "",
    "platform": "Posix; MacOS X; Windows",
    "description": "# Centaur Client Python Library\n\nCentaur 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.\n\n## Installation\nTo install the Centaur client Python SDK, simply run:\n```shell\npip install centaur-client\n```\n\n## QuickStart\nYou can use `Client` api to communicate with Centaur service.\n\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\n```\n\n## Sample Code\n\n### Create a Collection\n`Client` host various `Collection` APIs for interacting with Centaur service.\n\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\nclient.create('YOUR-COLLECTION-NAME', dimension=4)\n```\n\n### List Collections\n\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollections = client.list()\nprint(collections)\n```\n\n### Describe Collection\n\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\nrsp = client.describe('YOUR-COLLECTION-NAME')\nprint(rsp)\n```\n\n### Delete Collection\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\nclient.delete('YOUR-COLLECTION-NAME')\n```\n\n### Get a Collection Instance\n\n`Collection` provides APIs for accessing `Doc` and `Partition`\n\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\nif collection:\n    print('collection:', collection)\n```\n\n### Describe Collection Statistics\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\nrsp = collection.stats()\nprint(rsp)\n```\n\n### Insert/Update/Upsert Docs\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\ncollection.upsert(('YOUR-DOC-ID', [0.1, 0.2], {'price': 100, 'type': 'dress'}))\n```\n\n### Query a Collection\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\nmatch_docs = collection.query([0.1, 0.2, 0.3, 0.4], \n                       topk=100, \n                       include_vector=True)\nif match_docs:\n    for doc in match_docs:\n        print(doc)\n```\n\n### Delete Docs\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\ncollection.delete('YOUR-DOC-ID')\n```\n\n### Fetch Docs\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\nfetch_docs = collection.fetch(['YOUR-DOC-ID1', 'YOUR-DOC-ID2'])\nif fetch_docs:\n    for doc_id in fetch_docs:\n        print(fetch_docs[doc_id])\n```\n\n### Create a Collection Partition\n```python\nimport centaur\n\nclient = centaur.Client(api_key='YOUR-CENTAUR-API-KEY')\ncollection = client.get('YOUR-COLLECTION-NAME')\ncollection.create_partition('YOUR-PARTITION-NAME')\n```\n\n## Centaur Response\n```python\nfrom centaur import CentaurCode\n\n@dataclasses\nclass CentaurResponse(object):\n    code: CentaurCode\n    message: str\n    request_id: str\n    output: Any\n```\n\n## License\nThis project is licensed under the Apache License (Version 2.0).\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Centaur Client Python Sdk Library",
    "version": "0.0.11",
    "project_urls": {
        "Homepage": "https://github.com/alibaba/proxima"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c1c9595fb0ec717f5dba41078593d59afb5d8c9138eb5b841134a626a1fa90c",
                "md5": "bbc6405af22912791f1549adf3b5d6db",
                "sha256": "0827945bb5d222a0b155f6ac0f92cd79223809da930583a411d2a0845ab0a9cd"
            },
            "downloads": -1,
            "filename": "centaur_client-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bbc6405af22912791f1549adf3b5d6db",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.0",
            "size": 71181,
            "upload_time": "2023-07-06T09:24:57",
            "upload_time_iso_8601": "2023-07-06T09:24:57.574187Z",
            "url": "https://files.pythonhosted.org/packages/1c/1c/9595fb0ec717f5dba41078593d59afb5d8c9138eb5b841134a626a1fa90c/centaur_client-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 09:24:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alibaba",
    "github_project": "proxima",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "centaur-client"
}
        
Elapsed time: 0.08201s