internal/compaction/material.go
internal/compaction · 60 lines · 7 declarations · source
Declarations
type Material
type Material struct {
Level int
From int64
To int64
Turns []TurnText
Units []UnitText
}
Material is what one segment is written from: either the turns it covers, as they were said, or the segments of the level below it. Exactly one of the two is set.
type TurnText
type TurnText struct {
Offset int64
OccurredAt time.Time
Messages []MessageText
}
TurnText is one turn as the summariser sees it: when it happened and who said what, in order.
type MessageText
type MessageText struct {
Role string
Content string
}
MessageText is one message with the role of whoever said it.
type UnitText
type UnitText struct {
From int64
To int64
Covered int
Summary string
}
UnitText is one lower-level segment's summary, with the range it covers.
type Summary
type Summary struct {
Text string
}
Summary is what the summariser returns: the prose, and nothing else.
method Material.Size
func (m Material) Size() int
Size is what the material costs a context, in characters: the words a model reads.
const MaxMaterialCharacters
const MaxMaterialCharacters = 48000
MaxMaterialCharacters bounds what one summary is written from. A level-1 segment covers Branch turns of at most the message ceiling each, which is more than a model attends to; material over the bound is cut from the oldest turn, and the cut is reported by the pass rather than hidden.