countMessagePairs
countMessagePairs(
history):number
Defined in: conversation-history.ts:131
Count message pairs in history (excluding system messages)
Parameters
Section titled “Parameters”history
Section titled “history”readonly IRMessage[]
Conversation history
Returns
Section titled “Returns”number
Number of user/assistant pairs
Example
Section titled “Example”const history = [ { role: 'system', content: 'You are helpful' }, { role: 'user', content: 'Hi' }, { role: 'assistant', content: 'Hello!' },];
countMessagePairs(history); // 1