-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
4,940 additions
and
2,662 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,3 @@ | ||
# Golang Qdrant client | ||
# Qdrant-Go V2 | ||
|
||
Go client for Qdrant vector search engine | ||
|
||
## Install | ||
|
||
```bash | ||
go get github.com/qdrant/go-client | ||
``` | ||
|
||
## Usage | ||
|
||
Run Qdrant with enabled gRPC interface: | ||
|
||
```bash | ||
# With env variable | ||
docker run -p 6333:6333 -p 6334:6334 \ | ||
-e QDRANT__SERVICE__GRPC_PORT="6334" \ | ||
qdrant/qdrant | ||
``` | ||
|
||
Or by updating the configuration file: | ||
|
||
```yaml | ||
service: | ||
grpc_port: 6334 | ||
``` | ||
More info about gRPC in [documentation](https://qdrant.tech/documentation/quick-start/#grpc). | ||
### Making requests | ||
```go | ||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"log" | ||
"time" | ||
|
||
pb "github.com/qdrant/go-client/qdrant" | ||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/credentials/insecure" | ||
) | ||
|
||
var ( | ||
addr = flag.String("addr", "localhost:6334", "the address to connect to") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
// Set up a connection to the server. | ||
conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(insecure.NewCredentials())) | ||
if err != nil { | ||
log.Fatalf("did not connect: %v", err) | ||
} | ||
defer conn.Close() | ||
|
||
collections_client := pb.NewCollectionsClient(conn) | ||
|
||
// Contact the server and print out its response. | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second) | ||
defer cancel() | ||
r, err := collections_client.List(ctx, &pb.ListCollectionsRequest{}) | ||
if err != nil { | ||
log.Fatalf("could not get collections: %v", err) | ||
} | ||
log.Printf("List of collections: %s", r.GetCollections()) | ||
} | ||
``` | ||
|
||
> For authenticated request (using API KEY and TLS) to Qdrant Cloud, please refer to the [authenticated](https://github.com/qdrant/go-client/tree/master/examples/authentication/main.go) example. | ||
A full example for uploading, searching and filtering can be found in the [`examples`](https://github.com/qdrant/go-client/tree/master/examples) directory. | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.