index

package
v0.0.8-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternal = "internal index error"
)

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	Embed(ctx context.Context, texts []string) ([]embedder.Embedding, error)
}

type Option added in v0.0.5

type Option func(*options)

func WithTopK added in v0.0.5

func WithTopK(topK int) Option

type Pinecone

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

func NewPinecone

func NewPinecone(options PineconeOptions, embedder Embedder) *Pinecone

func (*Pinecone) IsEmpty added in v0.0.5

func (p *Pinecone) IsEmpty(ctx context.Context) (bool, error)

func (*Pinecone) LoadFromDocuments

func (p *Pinecone) LoadFromDocuments(ctx context.Context, documents []document.Document) error

func (*Pinecone) SimilaritySearch

func (p *Pinecone) SimilaritySearch(ctx context.Context, query string, opts ...Option) (SearchResponses, error)

func (*Pinecone) WithAPIKeyAndEnvironment added in v0.0.5

func (p *Pinecone) WithAPIKeyAndEnvironment(apiKey, environment string) *Pinecone

type PineconeCreateIndexOptions added in v0.0.5

type PineconeCreateIndexOptions struct {
	Dimension int
	Replicas  int
	Metric    string
	PodType   string
}

type PineconeOptions added in v0.0.4

type PineconeOptions struct {
	IndexName       string
	Namespace       string
	IncludeContent  bool
	BatchUpsertSize *int
	CreateIndex     *PineconeCreateIndexOptions
}

type SearchResponse

type SearchResponse struct {
	ID       string
	Document document.Document
	Score    float64
}

type SearchResponses added in v0.0.5

type SearchResponses []SearchResponse

func (SearchResponses) ToDocuments added in v0.0.5

func (s SearchResponses) ToDocuments() []document.Document

type SimpleVectorIndex

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

func NewSimpleVectorIndex

func NewSimpleVectorIndex(name string, outputPath string, embedder Embedder) *SimpleVectorIndex

func (*SimpleVectorIndex) IsEmpty added in v0.0.5

func (s *SimpleVectorIndex) IsEmpty() (bool, error)

func (*SimpleVectorIndex) LoadFromDocuments

func (s *SimpleVectorIndex) LoadFromDocuments(ctx context.Context, documents []document.Document) error

func (*SimpleVectorIndex) SimilaritySearch

func (s *SimpleVectorIndex) SimilaritySearch(ctx context.Context, query string, opts ...Option) (SearchResponses, error)

Jump to

Keyboard shortcuts

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