custom

package
v0.0.0-...-2ec7614 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Index_Query_FullMethodName = "/index.index/Query"
)

Variables

View Source
var File_index_proto protoreflect.FileDescriptor
View Source
var Index_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "index.index",
	HandlerType: (*IndexServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Query",
			Handler:    _Index_Query_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "index.proto",
}

Index_ServiceDesc is the grpc.ServiceDesc for Index service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterIndexServer

func RegisterIndexServer(s grpc.ServiceRegistrar, srv IndexServer)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(url string, options ...Option) (*Client, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, ids ...string) error

func (*Client) Index

func (c *Client) Index(ctx context.Context, documents ...index.Document) error

func (*Client) List

func (c *Client) List(ctx context.Context, options *index.ListOptions) ([]index.Document, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, options *index.QueryOptions) ([]index.Result, error)

type Document

type Document struct {
	Id        string            `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title     string            `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Content   string            `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
	Location  string            `protobuf:"bytes,4,opt,name=location,proto3" json:"location,omitempty"`
	Metadata  map[string]string `` /* 157-byte string literal not displayed */
	Embedding []float32         `protobuf:"fixed32,6,rep,packed,name=embedding,proto3" json:"embedding,omitempty"`
	// contains filtered or unexported fields
}

func (*Document) Descriptor deprecated

func (*Document) Descriptor() ([]byte, []int)

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetContent

func (x *Document) GetContent() string

func (*Document) GetEmbedding

func (x *Document) GetEmbedding() []float32

func (*Document) GetId

func (x *Document) GetId() string

func (*Document) GetLocation

func (x *Document) GetLocation() string

func (*Document) GetMetadata

func (x *Document) GetMetadata() map[string]string

func (*Document) GetTitle

func (x *Document) GetTitle() string

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

type IndexClient

type IndexClient interface {
	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*Results, error)
}

IndexClient is the client API for Index service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewIndexClient

func NewIndexClient(cc grpc.ClientConnInterface) IndexClient

type IndexServer

type IndexServer interface {
	Query(context.Context, *QueryRequest) (*Results, error)
	// contains filtered or unexported methods
}

IndexServer is the server API for Index service. All implementations must embed UnimplementedIndexServer for forward compatibility

type Option

type Option func(*Client)

type QueryRequest

type QueryRequest struct {
	Query    string            `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	Limit    *int32            `protobuf:"varint,2,opt,name=limit,proto3,oneof" json:"limit,omitempty"`
	Distance *float32          `protobuf:"fixed32,3,opt,name=distance,proto3,oneof" json:"distance,omitempty"`
	Filters  map[string]string `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*QueryRequest) Descriptor deprecated

func (*QueryRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.

func (*QueryRequest) GetDistance

func (x *QueryRequest) GetDistance() float32

func (*QueryRequest) GetFilters

func (x *QueryRequest) GetFilters() map[string]string

func (*QueryRequest) GetLimit

func (x *QueryRequest) GetLimit() int32

func (*QueryRequest) GetQuery

func (x *QueryRequest) GetQuery() string

func (*QueryRequest) ProtoMessage

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) ProtoReflect

func (x *QueryRequest) ProtoReflect() protoreflect.Message

func (*QueryRequest) Reset

func (x *QueryRequest) Reset()

func (*QueryRequest) String

func (x *QueryRequest) String() string

type Result

type Result struct {
	Document *Document `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
	Distance float32   `protobuf:"fixed32,2,opt,name=distance,proto3" json:"distance,omitempty"`
	// contains filtered or unexported fields
}

func (*Result) Descriptor deprecated

func (*Result) Descriptor() ([]byte, []int)

Deprecated: Use Result.ProtoReflect.Descriptor instead.

func (*Result) GetDistance

func (x *Result) GetDistance() float32

func (*Result) GetDocument

func (x *Result) GetDocument() *Document

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) ProtoReflect

func (x *Result) ProtoReflect() protoreflect.Message

func (*Result) Reset

func (x *Result) Reset()

func (*Result) String

func (x *Result) String() string

type Results

type Results struct {
	Results []*Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

func (*Results) Descriptor deprecated

func (*Results) Descriptor() ([]byte, []int)

Deprecated: Use Results.ProtoReflect.Descriptor instead.

func (*Results) GetResults

func (x *Results) GetResults() []*Result

func (*Results) ProtoMessage

func (*Results) ProtoMessage()

func (*Results) ProtoReflect

func (x *Results) ProtoReflect() protoreflect.Message

func (*Results) Reset

func (x *Results) Reset()

func (*Results) String

func (x *Results) String() string

type UnimplementedIndexServer

type UnimplementedIndexServer struct {
}

UnimplementedIndexServer must be embedded to have forward compatible implementations.

func (UnimplementedIndexServer) Query

type UnsafeIndexServer

type UnsafeIndexServer interface {
	// contains filtered or unexported methods
}

UnsafeIndexServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to IndexServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL