Documentation
¶
Index ¶
- func SplitNonPrefixWindows(turns []llm.Message, userStep, maxWindows int) [][]llm.Message
- func SplitPrefixWindows(turns []llm.Message, userStep, maxWindows int) [][]llm.Message
- func SplitWindows(turns []llm.Message, windowTurns int) [][]llm.Message
- type Analyzer
- type Candidate
- type ForkAnalyzer
- type LLM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SplitNonPrefixWindows ¶ added in v0.2.0
SplitNonPrefixWindows slices turns into fixed user-turn groups (every userStep user turns), non-overlapping (unlike prefix windows). Each window covers a distinct transcript segment; the last window carries the trailing turns after the final step boundary.
func SplitPrefixWindows ¶
SplitPrefixWindows slices turns into growing prefix windows, stepping one boundary per userStep user turns. Rationale: the rendered prompt of window k is a strict string prefix of window k+1, so LLM providers with prompt prefix caching (DeepSeek / SiliconFlow context caching) hit the shared prefix and cut token cost. When the transcript has fewer than userStep user turns it returns a single full window (no split — straight into the extraction/verification flow).
maxWindows>0 caps the result by keeping the longest windows (they remain a prefix chain and the longest covers the full transcript).
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer extracts candidate interest points from transcript windows using a side LLM call per window (pipeline step 1). Windows are analyzed concurrently (bounded by maxConcurrency); results are deduplicated across the overlapping prefix windows.
func NewAnalyzer ¶
func NewAnalyzer(client LLM, cfg config.ForkConfig, selective bool) *Analyzer
NewAnalyzer builds an Analyzer from fork config.
func (*Analyzer) Analyze ¶
func (a *Analyzer) Analyze(ctx context.Context, agentID string, windows [][]llm.Message) ([]Candidate, error)
Analyze extracts candidates per route strategy:
- "prefix" prefix-window split, full render (incl. tool output)
- "non_prefix" non-overlapping user-turn windows, compressed render
- "full" single full-context window, compressed render, one pass
- "full2" single full-context window, compressed render, two passes (append)
Windows are re-split internally from the last (full-transcript) window, so the service layer passes the same split output regardless of route.
type Candidate ¶
type Candidate struct {
Topic string `json:"topic"`
Reason string `json:"reason"`
Confidence float64 `json:"confidence"`
Tags []string `json:"tags"`
TurnRange [2]int `json:"turn_range"` // [start_turn, end_turn] 1-indexed
Subjective bool `json:"subjective"` // subjective preference/opinion (exempt from verify's web fact-check)
// WikiWorthy is the LLM's verdict (selective mode) on whether this topic
// deserves its own wiki page. nil = not judged (treated as worthy).
WikiWorthy *bool `json:"wiki_worthy,omitempty"`
// EventTime is the session event time, set by the service layer after
// extraction (LLM never sees this field).
EventTime time.Time `json:"-"`
}
Candidate is one interest point extracted from a conversation window. Aligned with my-agent-core's InterestPoint shape (topic/reason/confidence/ tags/turn_range).