query

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEntityExtractor

func NewEntityExtractor(llm chat.Client, opts ...EntityExtractorOption) *entityExtractor

NewEntityExtractor creates a new entity extractor.

func NewIntentRouter

func NewIntentRouter(llm chat.Client, opts ...IntentRouterOption) *intentRouter

NewIntentRouter creates a new intent router.

Types

type Decomposer

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

Decomposer is the implementation of core.QueryDecomposer.

func NewDecomposer

func NewDecomposer(llm chat.Client, opts ...DecomposerOption) *Decomposer

NewDecomposer creates a new query decomposer.

func (*Decomposer) Decompose

func (d *Decomposer) Decompose(ctx context.Context, query *core.Query) (*core.DecompositionResult, error)

Decompose breaks down a complex query into simpler sub-queries.

type DecomposerOption

type DecomposerOption func(*Decomposer)

DecomposerOption configures a Decomposer instance.

func WithDecomposerCollector

func WithDecomposerCollector(collector observability.Collector) DecomposerOption

WithDecomposerCollector sets an observability collector.

func WithDecomposerLogger

func WithDecomposerLogger(logger logging.Logger) DecomposerOption

WithDecomposerLogger sets a structured logger.

func WithDecompositionPromptTemplate

func WithDecompositionPromptTemplate(tmpl string) DecomposerOption

WithDecompositionPromptTemplate overrides the default decomposition prompt.

func WithMaxSubQueries

func WithMaxSubQueries(max int) DecomposerOption

WithMaxSubQueries sets the maximum number of sub-queries to generate.

type EntityExtractorOption

type EntityExtractorOption func(*entityExtractor)

EntityExtractorOption configures an entityExtractor instance.

func WithEntityExtractionPromptTemplate

func WithEntityExtractionPromptTemplate(tmpl string) EntityExtractorOption

WithEntityExtractionPromptTemplate overrides the default extraction prompt.

func WithEntityExtractorCollector

func WithEntityExtractorCollector(collector observability.Collector) EntityExtractorOption

WithEntityExtractorCollector sets an observability collector.

func WithEntityExtractorLogger

func WithEntityExtractorLogger(logger logging.Logger) EntityExtractorOption

WithEntityExtractorLogger sets a structured logger.

type HyDE

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

HyDE generates hypothetical answers to improve search results.

func NewHyDE

func NewHyDE(llm chat.Client) *HyDE

NewHyDE creates a new HyDE generator.

func (*HyDE) Generate

func (h *HyDE) Generate(ctx context.Context, query *core.Query) (string, error)

Generate implements core.HyDEGenerator.

func (*HyDE) GenerateHypotheticalDocument

func (h *HyDE) GenerateHypotheticalDocument(ctx context.Context, query *core.Query) (string, error)

GenerateHypotheticalDocument implements core.HyDEGenerator compatibility.

type IntentRouterOption

type IntentRouterOption func(*intentRouter)

IntentRouterOption configures an intentRouter instance.

func WithDefaultIntent

func WithDefaultIntent(intent core.IntentType) IntentRouterOption

WithDefaultIntent sets the fallback intent when LLM confidence is low.

func WithIntentPromptTemplate

func WithIntentPromptTemplate(tmpl string) IntentRouterOption

WithIntentPromptTemplate overrides the default intent classification prompt.

func WithIntentRouterCollector

func WithIntentRouterCollector(collector observability.Collector) IntentRouterOption

WithIntentRouterCollector sets an observability collector.

func WithIntentRouterLogger

func WithIntentRouterLogger(logger logging.Logger) IntentRouterOption

WithIntentRouterLogger sets a structured logger.

func WithMinConfidence

func WithMinConfidence(v float32) IntentRouterOption

WithMinConfidence sets the minimum confidence threshold.

type Rewriter

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

Rewriter uses an LLM to rewrite and expand the user's query.

func NewRewriter

func NewRewriter(llm chat.Client) *Rewriter

NewRewriter creates a new query rewriter.

func (*Rewriter) Rewrite

func (r *Rewriter) Rewrite(ctx context.Context, query *core.Query) (*core.Query, error)

Rewrite rewrites the user's query to improve search quality.

type StepBack

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

StepBack abstracts queries into higher-level background questions.

func NewStepBack

func NewStepBack(llm chat.Client) *StepBack

NewStepBack creates a new StepBack generator.

func (*StepBack) GenerateStepBackQuery

func (s *StepBack) GenerateStepBackQuery(ctx context.Context, query *core.Query) (*core.Query, error)

GenerateStepBackQuery generates a step-back query.

type StepBackGenerator

type StepBackGenerator interface {
	GenerateStepBackQuery(ctx context.Context, query *core.Query) (*core.Query, error)
}

StepBackGenerator abstracts specific questions into broader background questions.

Jump to

Keyboard shortcuts

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