* Get the API response id for an assistant message with real (non-synthetic) usage. * Used to identify split assistant records that came from the same API response — * when parallel tool calls are streamed, each content block becomes a separate * AssistantMessage record, but they all share the sa
(message: Message)
| 26 | * AssistantMessage record, but they all share the same message.id. |
| 27 | */ |
| 28 | function getAssistantMessageId(message: Message): string | undefined { |
| 29 | if ( |
| 30 | message?.type === 'assistant' && |
| 31 | 'id' in message.message && |
| 32 | message.message.model !== SYNTHETIC_MODEL |
| 33 | ) { |
| 34 | return message.message.id |
| 35 | } |
| 36 | return undefined |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Calculate total context window tokens from an API response's usage data. |
no outgoing calls
no test coverage detected