Documentation
¶
Index ¶
- Constants
- func RecordFactOperation(userID int64, operation string)
- func RecordMemoryExtraction(durationSeconds float64)
- func RecordTopicProcessing(durationSeconds float64)
- func SetTopicsTotal(userID int64, count int)
- type FactStats
- type MemoryUpdate
- type PeopleStats
- type Service
- func (s *Service) ProcessSession(ctx context.Context, userID int64, messages []storage.Message, ...) error
- func (s *Service) ProcessSessionWithStats(ctx context.Context, userID int64, messages []storage.Message, ...) (FactStats, error)
- func (s *Service) SetAgentLogger(logger *agentlog.Logger)
- func (s *Service) SetArchivistAgent(a agent.Agent)
- func (s *Service) SetPeopleRepository(pr storage.PeopleRepository)
- func (s *Service) SetTopicRepository(tr storage.TopicRepository)
- func (s *Service) SetVectorSearcher(vs VectorSearcher)
- type VectorSearcher
Constants ¶
const ( OperationAdd = "add" OperationUpdate = "update" OperationDelete = "delete" )
Константы для операций
Variables ¶
This section is empty.
Functions ¶
func RecordFactOperation ¶ added in v0.3.0
RecordFactOperation записывает операцию с фактом.
func RecordMemoryExtraction ¶ added in v0.3.0
func RecordMemoryExtraction(durationSeconds float64)
RecordMemoryExtraction записывает время извлечения фактов.
func RecordTopicProcessing ¶ added in v0.3.0
func RecordTopicProcessing(durationSeconds float64)
RecordTopicProcessing записывает время обработки топика.
func SetTopicsTotal ¶ added in v0.3.0
SetTopicsTotal устанавливает количество топиков для пользователя.
Types ¶
type FactStats ¶ added in v0.3.0
type FactStats struct {
Created int
Updated int
Deleted int
// People stats (v0.5.1)
PeopleAdded int
PeopleUpdated int
PeopleMerged int
// Usage tracking from API calls
PromptTokens int
CompletionTokens int
EmbeddingTokens int
Cost *float64
}
FactStats contains statistics about fact processing.
func (*FactStats) AddChatUsage ¶ added in v0.3.0
AddChatUsage adds usage from a chat completion response.
func (*FactStats) AddEmbeddingUsage ¶ added in v0.3.0
AddEmbeddingUsage adds usage from an embedding response.
type MemoryUpdate ¶
type MemoryUpdate struct {
Added []struct {
Relation string `json:"relation"`
Content string `json:"content"`
Category string `json:"category"`
Type string `json:"type"`
Importance int `json:"importance"`
Reason string `json:"reason"`
} `json:"added"`
Updated []struct {
ID int64 `json:"id"`
Content string `json:"content"`
Type string `json:"type,omitempty"`
Importance int `json:"importance"`
Reason string `json:"reason"`
} `json:"updated"`
Removed []struct {
ID int64 `json:"id"`
Reason string `json:"reason"`
} `json:"removed"`
}
MemoryUpdate represents the changes returned by the LLM
type PeopleStats ¶ added in v0.5.1
type PeopleStats struct {
Added int
Updated int
Merged int
EmbeddingTokens int
EmbeddingCost *float64
}
PeopleStats contains statistics about people processing.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(logger *slog.Logger, cfg *config.Config, factRepo storage.FactRepository, userRepo storage.UserRepository, factHistoryRepo storage.FactHistoryRepository, orClient openrouter.Client, translator *i18n.Translator) *Service
func (*Service) ProcessSession ¶
func (*Service) ProcessSessionWithStats ¶ added in v0.3.0
func (s *Service) ProcessSessionWithStats(ctx context.Context, userID int64, messages []storage.Message, referenceDate time.Time, topicID int64) (FactStats, error)
ProcessSessionWithStats processes a session and returns statistics about fact changes.
func (*Service) SetAgentLogger ¶ added in v0.4.8
func (*Service) SetArchivistAgent ¶ added in v0.5.0
SetArchivistAgent sets the fact extraction agent.
func (*Service) SetPeopleRepository ¶ added in v0.5.1
func (s *Service) SetPeopleRepository(pr storage.PeopleRepository)
SetPeopleRepository sets the people repository for person extraction.
func (*Service) SetTopicRepository ¶ added in v0.4.8
func (s *Service) SetTopicRepository(tr storage.TopicRepository)
func (*Service) SetVectorSearcher ¶
func (s *Service) SetVectorSearcher(vs VectorSearcher)