custom

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

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Index_List_FullMethodName   = "/index.index/List"
	Index_Delete_FullMethodName = "/index.index/Delete"
	Index_Index_FullMethodName  = "/index.index/Index"
	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: "List",
			Handler:    _Index_List_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Index_Delete_Handler,
		},
		{
			MethodName: "Index",
			Handler:    _Index_Index_Handler,
		},
		{
			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 DeleteRequest

type DeleteRequest struct {
	Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetIds

func (x *DeleteRequest) GetIds() []string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

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 Documents

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

func (*Documents) Descriptor deprecated

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

Deprecated: Use Documents.ProtoReflect.Descriptor instead.

func (*Documents) GetDocuments

func (x *Documents) GetDocuments() []*Document

func (*Documents) ProtoMessage

func (*Documents) ProtoMessage()

func (*Documents) ProtoReflect

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

func (*Documents) Reset

func (x *Documents) Reset()

func (*Documents) String

func (x *Documents) String() string

type IndexClient

type IndexClient interface {
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*Documents, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	Index(ctx context.Context, in *IndexRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	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 IndexRequest

type IndexRequest struct {
	Documents []*Document `protobuf:"bytes,1,rep,name=documents,proto3" json:"documents,omitempty"`
	// contains filtered or unexported fields
}

func (*IndexRequest) Descriptor deprecated

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

Deprecated: Use IndexRequest.ProtoReflect.Descriptor instead.

func (*IndexRequest) GetDocuments

func (x *IndexRequest) GetDocuments() []*Document

func (*IndexRequest) ProtoMessage

func (*IndexRequest) ProtoMessage()

func (*IndexRequest) ProtoReflect

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

func (*IndexRequest) Reset

func (x *IndexRequest) Reset()

func (*IndexRequest) String

func (x *IndexRequest) String() string

type IndexServer

type IndexServer interface {
	List(context.Context, *ListRequest) (*Documents, error)
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	Index(context.Context, *IndexRequest) (*emptypb.Empty, error)
	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 ListRequest

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

func (*ListRequest) Descriptor deprecated

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

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

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

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

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"`
	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) 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"`
	Score    float32   `protobuf:"fixed32,2,opt,name=score,proto3" json:"score,omitempty"`
	// contains filtered or unexported fields
}

func (*Result) Descriptor deprecated

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

Deprecated: Use Result.ProtoReflect.Descriptor instead.

func (*Result) GetDocument

func (x *Result) GetDocument() *Document

func (*Result) GetScore

func (x *Result) GetScore() float32

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.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedIndexServer) Delete

func (UnimplementedIndexServer) Index

func (UnimplementedIndexServer) List

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