feat(qa): support synthesis-wide chat context (#63)
This commit is contained in:
11
backend/internal/summaryqa/context.go
Normal file
11
backend/internal/summaryqa/context.go
Normal file
@ -0,0 +1,11 @@
|
||||
package summaryqa
|
||||
|
||||
// ContextBytes measures the original UTF-8 content, not rune count or JSON
|
||||
// escaping. Both adapters use the same bound and must never trim chat context.
|
||||
func (r StatelessRequest) ContextBytes() int {
|
||||
size := len(r.Summary) + len(r.Passage) + len(r.Question)
|
||||
for _, turn := range r.History {
|
||||
size += len(turn.Passage) + len(turn.Question) + len(turn.Answer)
|
||||
}
|
||||
return size
|
||||
}
|
||||
Reference in New Issue
Block a user