https://github.com/vdaas/vald-client-go
A Go gRPC client library for Vald
https://github.com/vdaas/vald-client-go
vald
Last synced: about 1 month ago
JSON representation
A Go gRPC client library for Vald
- Host: GitHub
- URL: https://github.com/vdaas/vald-client-go
- Owner: vdaas
- License: apache-2.0
- Created: 2019-11-16T09:07:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T01:11:45.000Z (about 1 month ago)
- Last Synced: 2025-04-10T02:26:37.420Z (about 1 month ago)
- Topics: vald
- Language: Go
- Homepage:
- Size: 1000 KB
- Stars: 10
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vald-client-go
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/vdaas/vald-client-go/releases/latest)
[](https://pkg.go.dev/github.com/vdaas/vald-client-go)
[](https://github.com/vdaas/vald-client-go/blob/main/go.mod#L3)
[](https://www.codacy.com/app/i.can.feel.gravity/vald?utm_source=github.com&utm_medium=referral&utm_content=vdaas/vald&utm_campaign=Badge_Grade)
[](https://goreportcard.com/report/github.com/vdaas/vald-client-go)
[](https://depshield.github.io)
[](https://app.fossa.com/projects/custom%2B21465%2Fvald-client-go?ref=badge_small)
[](https://deepsource.io/gh/vdaas/vald-client-go/?ref=repository-badge)
[](https://cla-assistant.io/vdaas/vald-client-go)
[](https://join.slack.com/t/vald-community/shared_invite/zt-db2ky9o4-R_9p2sVp8xRwztVa8gfnPA)
[](https://twitter.com/vdaas_vald)### example code
```go
// Create a Vald clien connection for Vald cluster.
conn, err := grpc.DialContext(ctx, "addr to cluster", grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}// Creates Vald client for gRPC.
client := vald.NewValdClient(conn)// Insert sample vector.
_, err := client.Insert(ctx, &payload.Insert_Request{
Vector: &payload.Object_Vector{
Id: "id of vector",
Vector: []float32{0.1, 0.2, 0.3}, // some feature dense vector here.
}})
if err != nil {
log.Fatal(err)
}// WARN you may need to wait a minutes until index creation.
// Search sample vector.
res, err := client.Search(ctx, &payload.Search_Request{
Vector: vec,
// Conditions for hitting the search.
Config: &payload.Search_Config{
Num: 10, // the number of search results
Radius: -1, // Radius is used to determine the space of search candidate radius for neighborhood vectors. -1 means infinite circle.
Epsilon: 0.1, // Epsilon is used to determines how much to expand from search candidate radius.
Timeout: 100000000, // Timeout is used for search time deadline. The unit is nano-seconds.
}})
if err != nil {
log.Fatal(err)
}// Remove vector.
_, err := client.Remove(ctx, &payload.Remove_Request{
Id: &payload.Object_ID{
Id: "id of vector",
}})
if err != nil {
log.Fatal(err)
}
```[](https://app.fossa.com/projects/custom%2B21465%2Fvald-client-go?ref=badge_large)