rag

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractedTopic

type ExtractedTopic struct {
	Summary    string `json:"summary"`
	StartMsgID int64  `json:"start_msg_id"`
	EndMsgID   int64  `json:"end_msg_id"`
}

type FactVectorItem

type FactVectorItem struct {
	FactID    int64
	Embedding []float32
}

type RetrievalDebugInfo

type RetrievalDebugInfo struct {
	OriginalQuery    string
	EnrichedQuery    string
	EnrichmentPrompt string
	EnrichmentTokens int
	Results          []TopicSearchResult
}

RetrievalDebugInfo contains trace data for RAG debugging

type RetrievalOptions

type RetrievalOptions struct {
	History        []storage.Message
	SkipEnrichment bool
}

type SearchResult

type SearchResult struct {
	Message storage.Message
	Score   float32
}

SearchResult kept for backward compatibility if needed, but we are moving to TopicSearchResult. We remove it to force type errors in other files to fix them.

type Service

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

func NewService

func NewService(logger *slog.Logger, cfg *config.Config, topicRepo storage.TopicRepository, factRepo storage.FactRepository, factHistoryRepo storage.FactHistoryRepository, msgRepo storage.MessageRepository, logRepo storage.LogRepository, client openrouter.Client, memoryService *memory.Service, translator *i18n.Translator) *Service

func (*Service) FindSimilarFacts

func (s *Service) FindSimilarFacts(ctx context.Context, userID int64, embedding []float32, threshold float32) ([]storage.Fact, error)

func (*Service) ForceProcessUser

func (s *Service) ForceProcessUser(ctx context.Context, userID int64) (int, error)

func (*Service) ReloadVectors

func (s *Service) ReloadVectors() error

func (*Service) Retrieve

func (s *Service) Retrieve(ctx context.Context, userID int64, query string, opts *RetrievalOptions) ([]TopicSearchResult, *RetrievalDebugInfo, error)

func (*Service) RetrieveFacts

func (s *Service) RetrieveFacts(ctx context.Context, userID int64, query string) ([]storage.Fact, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Stop

func (s *Service) Stop()

func (*Service) TriggerConsolidation

func (s *Service) TriggerConsolidation()

type TopicSearchResult

type TopicSearchResult struct {
	Topic    storage.Topic
	Score    float32
	Messages []storage.Message
}

TopicSearchResult represents a matched topic with its messages

type TopicVectorItem

type TopicVectorItem struct {
	TopicID   int64
	Embedding []float32
}

Jump to

Keyboard shortcuts

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