Skip to content

Instantly share code, notes, and snippets.

@rinx
Created May 11, 2021 10:27
Show Gist options
  • Save rinx/7ac31911a6917f2809f41e897a0bcdc7 to your computer and use it in GitHub Desktop.
Save rinx/7ac31911a6917f2809f41e897a0bcdc7 to your computer and use it in GitHub Desktop.
;; https://github.com/vdaas/vald-client-python
(import grpc)
(import [vald.v1.vald [insert_pb2_grpc
search_pb2_grpc
update_pb2_grpc
remove_pb2_grpc]])
(import [vald.v1.payload [payload_pb2]])
(setv channel (grpc.insecure-channel "localhost:8080"))
(setv istub (insert-pb2-grpc.InsertStub channel))
(setv sstub (search-pb2-grpc.SearchStub channel))
(setv ustub (update-pb2-grpc.UpdateStub channel))
(setv vec (payload-pb2.Object.Vector :id "vector-id1" :vector [0.1 0.2 0.3]))
(setv icfg (payload-pb2.Insert.Config :skip-strict-exist-check True))
(istub.Insert (payload-pb2.Insert.Request :vector vec :config icfg))
(channel.close)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment