rag

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer added in v0.0.8

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

Indexer ...

func NewIndexer added in v0.0.8

func NewIndexer(name string, config any) (*Indexer, error)

NewIndexer ...

func (*Indexer) Index added in v0.0.8

func (r *Indexer) Index(ctx context.Context, docs []*vdb.Document, opts *Options) ([]KnowledgeEntity, error)

func (*Indexer) Retrieve added in v0.0.8

func (r *Indexer) Retrieve(ctx context.Context, query string, opts *Options) ([]KnowledgeEntity, error)

Retrieve TODO: 实现检索逻辑

type KnowledgeEntity

type KnowledgeEntity struct {
	ID        int64   `json:"id"`
	LibraryID int64   `json:"lib_id,omitempty"`
	Question  string  `json:"question"`
	Answer    string  `json:"answer"`
	Score     float64 `json:"score"`
}

KnowledgeEntity TODO

type Options

type Options struct {
	LibraryID      int64   `json:"id"`
	Kind           string  `json:"kind"`
	IndexID        int32   `json:"index_id"`
	TopK           int32   `json:"top_k"`
	ScoreThreshold float64 `json:"score_threshold"`
}

Options ...

type Retrival added in v0.0.8

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

Retrival ...

func NewRetrival added in v0.0.8

func NewRetrival(name string, config any) (*Retrival, error)

NewRetrival ...

func (*Retrival) Retrieve added in v0.0.8

func (r *Retrival) Retrieve(ctx context.Context, query string, opts *Options) ([]KnowledgeEntity, error)

Retrieve TODO: 实现检索逻辑

type ScalarDB

type ScalarDB interface {
	Fetch(context.Context, string, *Options) (*KnowledgeEntity, error)
}

ScalarDB ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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