feat(llm): add replay token metering (PR2 round 1)
This commit is contained in:
@@ -118,8 +118,8 @@ function validateEvent(trace: SessionTrace, event: SessionEvent): SessionTraceTr
|
||||
}
|
||||
}
|
||||
if (se.sourceEventSeqs !== undefined) {
|
||||
if (se.sourceEventSeqs.length === 0) {
|
||||
throw new InvariantError('sourceEventSeqs must not be empty when present')
|
||||
if (se.sourceEventSeqs.length === 0 && event.type !== 'assistant/message') {
|
||||
throw new InvariantError('sourceEventSeqs must not be empty except on assistant/message')
|
||||
}
|
||||
const unique = new Set(se.sourceEventSeqs)
|
||||
if (unique.size !== se.sourceEventSeqs.length) {
|
||||
|
||||
Reference in New Issue
Block a user