retrieval

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HybridRetriever

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

HybridRetriever implements hybrid search (vector + keyword)

func NewHybridRetriever

func NewHybridRetriever(vectorStore vectorstore.Store, keywordStore KeywordStore, alpha float32) *HybridRetriever

NewHybridRetriever creates a new hybrid retriever

func (*HybridRetriever) KeywordSearch

func (r *HybridRetriever) KeywordSearch(ctx context.Context, query string, topK int) ([]vectorstore.Result, error)

KeywordSearch performs keyword-only search

func (*HybridRetriever) Search

func (r *HybridRetriever) Search(ctx context.Context, query string, embedding []float32, topK int) ([]vectorstore.Result, error)

Search performs hybrid search

type KeywordStore

type KeywordStore interface {
	Search(ctx context.Context, query string, topK int) ([]vectorstore.Result, error)
}

KeywordStore defines the interface for keyword search

type Reranker

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

Reranker implements result reranking using LLM

func NewReranker

func NewReranker(llm llm.Client, topK int) *Reranker

NewReranker creates a new reranker

func (*Reranker) Rerank

func (r *Reranker) Rerank(ctx context.Context, query string, results []vectorstore.Result) ([]vectorstore.Result, error)

Rerank reranks search results based on relevance to the query

func (*Reranker) WithPrompt

func (r *Reranker) WithPrompt(prompt string) *Reranker

WithPrompt sets the rerank prompt

Jump to

Keyboard shortcuts

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