Open History to see the last commit
1import { test, expect } from './fixtures'
2
3for (const stream of [false, true]) {
4 test(`compatible summarize forwards maxLength (stream=${stream})`, async ({
5 request,
6 aimockPort,
7 testId,
8 }) => {
9 const response = await request.post('/api/summarize', {
10 data: {
11 provider: 'openai-compatible',
12 text: '[summarize] The Fender Stratocaster is a versatile electric guitar',
13 maxLength: 73,
14 stream,
15 aimockPort,
16 testId,
17 },
18 })
19 expect(response.ok()).toBe(true)
20 expect(await response.text()).toContain('Stratocaster')
21
22 const journal = await request.get(
23 `http://127.0.0.1:${aimockPort}/v1/_requests`,
24 )
25 const entries = (await journal.json()) as Array<{
26 headers?: Record<string, string>
27 body?: Record<string, unknown>
28 }>
29 const calls = entries.filter(
30 (entry) => entry.headers?.['x-test-id'] === testId,
31 )
32 expect(calls).toHaveLength(1)
33 expect(calls[0]?.body?.max_tokens).toBe(73)
34 expect(calls[0]?.body).not.toHaveProperty('max_output_tokens')
35 })
36}