Documentation
¶
Index ¶
- Constants
- type InfoParser
- type MatchWeights
- type MultiHopOptions
- type MultiHopQueryDecomposer
- type ParsedFact
- type ParserOptions
- type PostprocessWorkerOptions
- type RankingOptions
- type RerankOptions
- type RetrievalBehaviorOptions
- type RetrievalSearchTuningOptions
- type SearchDebugInfo
- type SearchOptions
- type SearchPlanDebug
- type SearchRankingDebug
- type SearchRetrievalKind
- type Service
- func (s *Service) Delete(ctx context.Context, tenantID, memoryID string) error
- func (s *Service) Get(ctx context.Context, tenantID, memoryID string) (*domain.Memory, error)
- func (s *Service) GetPostprocessJob(ctx context.Context, jobID string) (*domain.MemoryPostprocessJob, error)
- func (s *Service) IngestAsync(ctx context.Context, in StoreInput, maxAttempts int) (domain.MemoryIngestReceipt, error)
- func (s *Service) IngestBatchAsync(ctx context.Context, inputs []StoreInput, maxAttempts int) (domain.MemoryIngestReceipt, error)
- func (s *Service) List(ctx context.Context, tenantID string, limit int) ([]domain.Memory, error)
- func (s *Service) ListPostprocessJobs(ctx context.Context, filter domain.MemoryPostprocessJobFilter) ([]domain.MemoryPostprocessJob, error)
- func (s *Service) Search(ctx context.Context, tenantID, query string, topK int) ([]domain.Memory, error)
- func (s *Service) SearchWithFilters(ctx context.Context, tenantID, query string, topK int, opts SearchOptions) ([]domain.Memory, error)
- func (s *Service) SearchWithFiltersDebug(ctx context.Context, tenantID, query string, topK int, opts SearchOptions) ([]domain.Memory, *SearchDebugInfo, error)
- func (s *Service) StartPostprocessWorkers(parent context.Context, opts PostprocessWorkerOptions) (func(), error)
- func (s *Service) Store(ctx context.Context, in StoreInput) (domain.Memory, error)
- func (s *Service) StoreBatch(ctx context.Context, inputs []StoreInput) ([]domain.Memory, error)
- type ServiceOption
- func WithDebug(verbose bool, progress bool) ServiceOption
- func WithEntityFactRepository(repo domain.EntityFactRepository) ServiceOption
- func WithImplicitCanonicalKindsForEntityFacts(enabled bool) ServiceOption
- func WithInfoParser(parser InfoParser) ServiceOption
- func WithLogger(logger *log.Logger) ServiceOption
- func WithMultiHopQueryDecomposer(decomposer MultiHopQueryDecomposer) ServiceOption
- type StoreInput
- type StructuredMemoryOptions
- type WALWeights
Constants ¶
View Source
const ( // DualWriteDedupeThreshold is the semantic similarity cutoff used to suppress // near-duplicate legacy structured dual-write entries. DualWriteDedupeThreshold = 0.92 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfoParser ¶
type InfoParser interface {
Parse(ctx context.Context, content string, maxFacts int) ([]ParsedFact, error)
}
func NewHeuristicInfoParser ¶
func NewHeuristicInfoParser() InfoParser
func NewOllamaInfoParser ¶
func NewOpenRouterInfoParser ¶
func NewOpenRouterInfoParser(client *openrouterclient.Client, logger *log.Logger, verbose bool) InfoParser
type MatchWeights ¶
type MultiHopOptions ¶
type MultiHopOptions struct {
EntityFactBridgeEnabled bool
LLMDecompositionEnabled bool
MaxDecompositionQueries int
EnablePairwiseRerank bool
TokenExpansionFallback bool
GraphPathEnabled bool
GraphMaxHops int
GraphSeedLimit int
GraphPathLimit int
GraphMinScore float64
GraphWeight float64
GraphTemporalValidity bool
GraphSingletonInvalidation bool
}
type MultiHopQueryDecomposer ¶
type MultiHopQueryDecomposer interface {
Decompose(ctx context.Context, query string, maxQueries int) ([]string, error)
}
func NewLLMMultiHopQueryDecomposer ¶
func NewLLMMultiHopQueryDecomposer( generator llmPromptGenerator, logger *log.Logger, verbose bool, ) MultiHopQueryDecomposer
type ParsedFact ¶
type ParsedFact struct {
Content string
QueryViewText string
Kind domain.MemoryKind
Tags []string
Entity string
Relation string
Value string
AnswerMetadata domain.MemoryAnswerMetadata
}
type ParserOptions ¶
type PostprocessWorkerOptions ¶
type PostprocessWorkerOptions struct {
Enabled bool
PollInterval time.Duration
BatchSize int
WorkerCount int
Lease time.Duration
MaxAttempts int
RetryBase time.Duration
RetryMax time.Duration
}
func DefaultPostprocessWorkerOptions ¶
func DefaultPostprocessWorkerOptions() PostprocessWorkerOptions
type RankingOptions ¶
type RankingOptions struct {
Algorithm string
WAL WALWeights
Match MatchWeights
}
type RerankOptions ¶
type RetrievalSearchTuningOptions ¶
type RetrievalSearchTuningOptions struct {
AdaptiveQueryExpansionEnabled bool
AdaptiveQueryMaxExtraQueries int
AdaptiveQueryWeakLexicalThreshold float64
AdaptiveQueryPlanConfidenceThreshold float64
CandidateWindowMultiplier int
CandidateWindowMin int
CandidateWindowMax int
CandidateWindowTemporalBoost int
CandidateWindowMultiHopBoost int
CandidateWindowFilterBoost int
EarlyRerankBaseWindow int
EarlyRerankMaxWindow int
}
type SearchDebugInfo ¶
type SearchDebugInfo struct {
Plan SearchPlanDebug `json:"plan"`
Ranking []SearchRankingDebug `json:"ranking,omitempty"`
}
type SearchOptions ¶
type SearchOptions struct {
MinScore float64
Tiers []domain.MemoryTier
Kinds []domain.MemoryKind
RetrievalKind SearchRetrievalKind
DisableTouch bool
Debug bool
}
type SearchPlanDebug ¶
type SearchPlanDebug struct {
Intent string `json:"intent"`
Confidence float64 `json:"confidence"`
AnswerType string `json:"answer_type,omitempty"`
Entities []string `json:"entities,omitempty"`
Relations []string `json:"relations,omitempty"`
TimeConstraints []string `json:"time_constraints,omitempty"`
RequiredEvidence string `json:"required_evidence,omitempty"`
FallbackPath []string `json:"fallback_path,omitempty"`
}
type SearchRankingDebug ¶
type SearchRetrievalKind ¶
type SearchRetrievalKind string
const ( SearchRetrievalKindAuto SearchRetrievalKind = "auto" SearchRetrievalKindVector SearchRetrievalKind = "vector" SearchRetrievalKindEntity SearchRetrievalKind = "entity" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( repo domain.MemoryRepository, tenantRepo domain.TenantRepository, vector domain.VectorStore, embedder domain.Embedder, scorer domain.ImportanceScorer, options ...ServiceOption, ) *Service
func (*Service) GetPostprocessJob ¶
func (*Service) IngestAsync ¶
func (s *Service) IngestAsync( ctx context.Context, in StoreInput, maxAttempts int, ) (domain.MemoryIngestReceipt, error)
func (*Service) IngestBatchAsync ¶
func (s *Service) IngestBatchAsync( ctx context.Context, inputs []StoreInput, maxAttempts int, ) (domain.MemoryIngestReceipt, error)
func (*Service) ListPostprocessJobs ¶
func (s *Service) ListPostprocessJobs( ctx context.Context, filter domain.MemoryPostprocessJobFilter, ) ([]domain.MemoryPostprocessJob, error)
func (*Service) SearchWithFilters ¶
func (*Service) SearchWithFiltersDebug ¶
func (s *Service) SearchWithFiltersDebug( ctx context.Context, tenantID, query string, topK int, opts SearchOptions, ) ([]domain.Memory, *SearchDebugInfo, error)
func (*Service) StartPostprocessWorkers ¶
func (s *Service) StartPostprocessWorkers( parent context.Context, opts PostprocessWorkerOptions, ) (func(), error)
func (*Service) StoreBatch ¶
type ServiceOption ¶
type ServiceOption interface {
// contains filtered or unexported methods
}
func WithDebug ¶
func WithDebug(verbose bool, progress bool) ServiceOption
func WithEntityFactRepository ¶
func WithEntityFactRepository(repo domain.EntityFactRepository) ServiceOption
func WithImplicitCanonicalKindsForEntityFacts ¶
func WithImplicitCanonicalKindsForEntityFacts(enabled bool) ServiceOption
func WithInfoParser ¶
func WithInfoParser(parser InfoParser) ServiceOption
func WithLogger ¶
func WithLogger(logger *log.Logger) ServiceOption
func WithMultiHopQueryDecomposer ¶
func WithMultiHopQueryDecomposer(decomposer MultiHopQueryDecomposer) ServiceOption
type StoreInput ¶
type StoreInput struct {
TenantID string
Content string
Tier domain.MemoryTier
Kind domain.MemoryKind
Tags []string
Source string
CreatedBy domain.MemoryCreatedBy
AnswerMetadata domain.MemoryAnswerMetadata
}
type StructuredMemoryOptions ¶
type WALWeights ¶
Source Files
¶
- answer_metadata.go
- delete.go
- entity_facts.go
- fact_quality.go
- get.go
- index_state.go
- info_parser_heuristic.go
- info_parser_ollama.go
- info_parser_openrouter.go
- ingest_async.go
- isolation.go
- list.go
- logging.go
- multi_hop_decomposer.go
- parser_identity.go
- postprocess_worker.go
- query_embedding_cache.go
- query_routing.go
- search.go
- search_expansion.go
- service.go
- store.go
- store_batch_parser.go
- structured_observations.go
- tier_policy.go
Click to show internal directories.
Click to hide internal directories.