(
generator: AsyncGenerator<TChunk, TResult, void>,
)
| 84 | } |
| 85 | |
| 86 | async function collectGeneratorOutput<TChunk, TResult>( |
| 87 | generator: AsyncGenerator<TChunk, TResult, void>, |
| 88 | ): Promise<{ |
| 89 | chunks: Array<TChunk> |
| 90 | result: TResult |
| 91 | }> { |
| 92 | const chunks: Array<TChunk> = [] |
| 93 | let next = await generator.next() |
| 94 | while (!next.done) { |
| 95 | chunks.push(next.value) |
| 96 | next = await generator.next() |
| 97 | } |
| 98 | return { chunks, result: next.value } |
| 99 | } |
| 100 | |
| 101 | it('should accumulate tool call events', () => { |
| 102 | const manager = new ToolCallManager([mockWeatherTool]) |
no test coverage detected