retrieval

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package retrieval implements RAG search logic for Creel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextFetcher added in v0.1.4

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

ContextFetcher retrieves chunks from a single document in sequence order, with ACL enforcement.

func NewContextFetcher added in v0.1.4

func NewContextFetcher(chunkStore *store.ChunkStore, authorizer auth.Authorizer) *ContextFetcher

NewContextFetcher creates a new ContextFetcher.

func (*ContextFetcher) GetContext added in v0.1.4

func (f *ContextFetcher) GetContext(ctx context.Context, principal *auth.Principal, documentID string, lastN int, since time.Time) ([]*store.Chunk, error)

GetContext returns active chunks for a document in sequence order. It validates that the principal has read access to the document's topic.

type Result

type Result struct {
	Chunk    *store.Chunk
	TopicID  string
	Score    float64
	Document *store.Document
}

Result represents a single search result with context.

type Searcher

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

Searcher performs ACL-filtered vector similarity search.

func NewSearcher

func NewSearcher(chunkStore *store.ChunkStore, docStore *store.DocumentStore, authorizer auth.Authorizer, backend vector.Backend) *Searcher

NewSearcher creates a new Searcher.

func (*Searcher) Search

func (s *Searcher) Search(ctx context.Context, principal *auth.Principal, topicIDs []string, queryEmbedding []float64, topK int, metadataFilter map[string]any, excludeDocIDs []string) ([]Result, error)

Search performs an ACL-filtered similarity search. If topicIDs is empty, it searches all topics accessible to the principal.

Jump to

Keyboard shortcuts

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