GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - vdaas/vald-client-python: A Python gRPC client library for Vald

BranchesTags
Open more actions menu

Latest commit

 

History

473 Commits
473 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
Makefile.d
Makefile.d
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
PYTHON_VERSION
PYTHON_VERSION
 
 
README.md
README.md
 
 
VALD_CLIENT_PYTHON_VERSION
VALD_CLIENT_PYTHON_VERSION
 
 
VALD_SHA
VALD_SHA
 
 
buf.gen.yaml
buf.gen.yaml
 
 
buf.lock
buf.lock
 
 
buf.yaml
buf.yaml
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

vald-client-python

PyPI version Vald version Build version

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

About

A Python gRPC client library for Vald

pypi.org/project/vald-client-python/

Topics

vald

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

18 stars

Watchers

4 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.