Scintirete provides a complete gRPC interface supporting all vector database operations. The gRPC interface offers higher performance and stronger type safety, suitable for production environments with high performance requirements.
Scintirete gRPC service enables server reflection, which means you can use it directly in tools that support gRPC reflection without manually importing proto files.
Supported tools:
Default connection parameters:
localhost:9090
gRPC
(HTTP/2)localhost:9090
After successful import, you will see the following service interfaces:
Advantages of gRPC over HTTP API:
Feature | gRPC | HTTP API |
---|---|---|
Performance | Faster (binary protocol) | Slower (JSON parsing) |
Type Safety | Strong typing (protobuf) | Weak typing (JSON) |
Streaming | Supported | Not supported |
Code Generation | Auto-generate clients | Manual coding |
Debugging Difficulty | Medium | Simple |
Browser Compatibility | Requires gRPC-Web | Native support |
git clone https://github.com/scintirete/scintirete.git cd scintirete make proto-gen
In the gen/go/scintirete/v1
directory, you will see auto-generated protobuf code.
// Use connection pool var ( conn *grpc.ClientConn client pb.ScintireteServiceClient ) func init() { var err error conn, err = grpc.Dial("localhost:9090", grpc.WithInsecure(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 10 * time.Second, Timeout: 3 * time.Second, PermitWithoutStream: true, }), ) if err != nil { panic(err) } client = pb.NewScintireteServiceClient(conn) }
import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) func handleGRPCError(err error) { if st, ok := status.FromError(err); ok { switch st.Code() { case codes.NotFound: fmt.Println("Resource not found") case codes.PermissionDenied: fmt.Println("Permission denied") case codes.InvalidArgument: fmt.Println("Invalid argument") default: fmt.Printf("gRPC error: %v\n", st.Message()) } } }
// Batch insert vectors (recommended) vectors := make([]*pb.Vector, 1000) for i := 0; i < 1000; i++ { vectors[i] = &pb.Vector{ Data: generateRandomVector(768), Metadata: map[string]string{ "id": fmt.Sprintf("doc_%d", i), }, } } _, err := client.InsertVectors(ctx, &pb.InsertVectorsRequest{ DatabaseName: "my_db", CollectionName: "docs", Vectors: vectors, })
Connection failed:
rpc error: code = Unavailable desc = connection error
Authentication failed:
rpc error: code = PermissionDenied desc = invalid token
Parameter error:
rpc error: code = InvalidArgument desc = dimension mismatch
Through the gRPC interface, you can build high-performance vector search applications and enjoy the advantages of strong typing and efficient binary protocols.