vald-client-python
A Python gRPC client library for Vald.
Install
Using pip,
pip install vald-client-python
Usage
To use v1 APIs,
import grpc
from vald.v1.vald import insert_pb2_grpc
from vald.v1.vald import search_pb2_grpc
from vald.v1.vald import update_pb2_grpc
from vald.v1.vald import remove_pb2_grpc
from vald.v1.vald import flush_pb2_grpc
from vald.v1.payload import payload_pb2
## create a channel by passing "{host}:{port}"
channel = grpc.insecure_channel("gateway.vald.vdaas.org:80")
## create stubs for calling RPCs
istub = insert_pb2_grpc.InsertStub(channel)
sstub = search_pb2_grpc.SearchStub(channel)
ustub = update_pb2_grpc.UpdateStub(channel)
rstub = remove_pb2_grpc.RemoveStub(channel)
fstub = flush_pb2_grpc.FlushStub(channel)
## call RPCs: Insert
vec = payload_pb2.Object.Vector(id='vector_id_1', vector=[0.1, 0.2, 0.3])
icfg = payload_pb2.Insert.Config(skip_strict_exist_check=True)
istub.Insert(payload_pb2.Insert.Request(vector=vec, config=icfg))
## call RPCs: Search
### num: number of results
### timeout: 3 seconds
scfg = payload_pb2.Search.Config(num=10, radius=-1.0, epsilon=0.01, timeout=3000000000)
res = sstub.Search(payload_pb2.Search.Request(vector=[0.1, 0.2, 0.3], config=scfg))
## call RPCs: Update
uvec = payload_pb2.Object.Vector(id='vector_id_1', vector=[0.1, 0.2, 0.3])
ucfg = payload_pb2.Update.Config(skip_strict_exist_check=True)
ustub.Update(payload_pb2.Update.Request(vector=uvec, config=ucfg))
## call RPCs: Remove
rcfg = payload_pb2.Remove.Config(skip_strict_exist_check=True)
rid = payload_pb2.Object.ID(id='vector_id_1')
rstub.Remove(payload_pb2.Remove.Request(id=rid, config=rcfg))
## call RPCs: Flush
fstub.Flush(payload_pb2.Flush.Request())
## close channel
channel.close()
Metadata
Release files for vald-client-python 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vald_client_python-1.8.0.tar.gz | 47.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vald_client_python-1.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.9 kB
Release files / vald_client_python-1.8.0.tar.gz
| Download URL | vald_client_python-1.8.0.tar.gz |
|---|---|
| Size | 47.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc3d9377257730b466e082228543b96646d9386ad41066340b9c35419f533283
|
|
BLAKE2b-256 checksum How to use checksums |
529aed881155ea0c74e5caeec5d18340fc80aa0a39e1693c2df3aa74f7d10055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / vald_client_python-1.8.0-py3-none-any.whl
| Download URL | vald_client_python-1.8.0-py3-none-any.whl |
|---|---|
| Size | 74.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea2b34c34e1a5e31c436656fe80d469bd90d80957929004e1007eddf79cb1e18
|
|
BLAKE2b-256 checksum How to use checksums |
6afa37f38f567b8772a1b69b2c806705bb042a7616268f1f991b73a25394f258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|