index

package
v0.0.9-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 18 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 WithFilter added in v0.0.9

func WithFilter(filter interface{}) Option

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 Qdrant added in v0.0.8

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

func NewQdrant added in v0.0.8

func NewQdrant(options QdrantOptions, embedder Embedder) *Qdrant

func (*Qdrant) IsEmpty added in v0.0.8

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

func (*Qdrant) LoadFromDocuments added in v0.0.8

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

func (*Qdrant) SimilaritySearch added in v0.0.8

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

func (*Qdrant) WithAPIKeyAndEdpoint added in v0.0.8

func (q *Qdrant) WithAPIKeyAndEdpoint(apiKey, endpoint string) *Qdrant

type QdrantCreateCollectionOptions added in v0.0.8

type QdrantCreateCollectionOptions struct {
	Dimension uint64
	Distance  QdrantDistance
	OnDisk    bool
}

type QdrantDistance added in v0.0.8

type QdrantDistance string

type QdrantOptions added in v0.0.8

type QdrantOptions struct {
	CollectionName   string
	IncludeContent   bool
	BatchUpsertSize  *int
	CreateCollection *QdrantCreateCollectionOptions
}

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)

type SimpleVectorIndexFilterFn added in v0.0.9

type SimpleVectorIndexFilterFn func([]SearchResponse) []SearchResponse

Jump to

Keyboard shortcuts

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