* Fake text adapter that records the `modelOptions` it is handed and yields a * trivial summary stream. `name` is irrelevant here — the summarize wrapper * keys off its OWN `name` (set via the constructor) to resolve the provider's * max-tokens spelling.
()
| 14 | * max-tokens spelling. |
| 15 | */ |
| 16 | function createRecordingTextAdapter(): { |
| 17 | textAdapter: ChatStreamCapable |
| 18 | lastModelOptions: () => Record<string, unknown> | undefined |
| 19 | } { |
| 20 | let recorded: Record<string, unknown> | undefined |
| 21 | const textAdapter: ChatStreamCapable = { |
| 22 | chatStream(opts: TextOptions<any>): AsyncIterable<StreamChunk> { |
| 23 | recorded = opts.modelOptions as Record<string, unknown> | undefined |
| 24 | return (async function* () { |
| 25 | yield ev.textContent('summary') |
| 26 | yield ev.runFinished('stop') |
| 27 | })() |
| 28 | }, |
| 29 | } |
| 30 | return { textAdapter, lastModelOptions: () => recorded } |
| 31 | } |
| 32 | |
| 33 | describe('ChatStreamSummarizeAdapter — maxLength reaches the wrapped adapter under the native key', () => { |
| 34 | it('OpenAI-style adapter receives maxLength as max_output_tokens', async () => { |
no outgoing calls
no test coverage detected