Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

meta.test.ts

662 lines22.4 KB

1import { requestUrl } from '#/lib/text.ts'
2import { evaluateCard } from '@modelschemas/rate-card'
3import { afterEach, describe, expect, it } from 'vitest'
4import fixtures from '../fixtures/meta-docs.json'
5import { provider } from './meta.ts'
6import { classifyAndBundle } from '../../ingest/sync.ts'
7import {
8 META_MODELS,
9 META_PRICING,
10 META_REFERENCE,
11 parseMetaModels,
12 parseMetaPricing,
13 parseMetaSchemas,
14} from '../meta-docs.ts'
15​
16const originalFetch = globalThis.fetch
17const docs = fixtures as Record<string, string>
18const SPARK = 'https://dev.meta.ai/docs/muse-spark'
19const WONDER = 'https://dev.meta.ai/docs/muse-wonder'
20const pages = {
21 'muse-spark': docs[SPARK] ?? '',
22 'muse-wonder': docs[WONDER] ?? '',
24function serve(overrides: Record<string, string> = {}) {
25 const urls: Array<string> = []
26 globalThis.fetch = async (input) => {
27 const url = requestUrl(input)
28 urls.push(url)
29 const body = overrides[url] ?? docs[url]
30 if (body === undefined) throw new Error(`unexpected source ${url}`)
31 return new Response(body)
32 }
33 return urls
35afterEach(() => {
36 globalThis.fetch = originalFetch
37})
38describe('Meta native docs', () => {
39 it('refreshes all nine hosted IDs and their own modes without a key', async () => {
40 const urls = serve()
41 const { models, skipped } = await provider.listModels({})
42 expect(skipped).toBeUndefined()
43 expect(models.map((m) => m.rawId)).toEqual([
44 'muse-wonder-1.0',
45 'muse-spark-1.3',
46 'muse-spark-1.3-contributor',
47 'muse-spark-1.2',
48 'muse-spark-1.2-contributor',
49 'muse-spark-1.1',
50 'muse-image-1.0',
51 'muse-voice-transcribe-1.0',
52 'sam-3.1',
53 ])
54 const spark = models.find((m) => m.rawId === 'muse-spark-1.3')
55 const contributor = models.find(
56 (m) => m.rawId === 'muse-spark-1.3-contributor',
57 )
58 const wonder = models.find((m) => m.rawId === 'muse-wonder-1.0')
59 expect(spark).toMatchObject({
60 displayName: 'Muse Spark 1.3',
61 activity: 'chat',
62 modalities: {
63 input: ['text', 'image', 'video', 'audio', 'pdf'],
64 output: ['text'],
65 },
66 contextWindow: 1048576,
67 maxOutput: null,
68 capabilities: ['reasoning', 'tools', 'structured_outputs'],
69 providerMetadata: { family: 'Muse Spark', tier: 'Standard' },
70 reasoning: {
71 mandatory: true,
72 efforts: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'],
73 },
74 })
75 expect(contributor?.providerMetadata).toEqual({
76 family: 'Muse Spark',
77 tier: 'Contributor',
78 })
79 expect(contributor?.reasoning?.efforts).not.toContain('max')
80 expect(
81 models.find((m) => m.rawId === 'muse-spark-1.2')?.reasoning?.efforts,
82 ).not.toContain('max')
83 expect(wonder).toMatchObject({
84 displayName: 'Muse Wonder',
85 activity: 'chat',
86 contextWindow: 1048576,
87 providerMetadata: { family: 'Muse Wonder', tier: 'Standard' },
88 reasoning: {
89 mode: 'effort',
90 mandatory: true,
91 efforts: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'],
92 },
93 })
94 expect(wonder?.pricing).toMatchObject({
95 tables: {
96 rate: {
97 base: {
98 input_tokens: 4 / 1e6,
99 output_tokens: 20 / 1e6,
100 cache_read_tokens: 0.2 / 1e6,
101 },
102 },
103 },
104 })
105 expect(spark?.pricing).toMatchObject({
106 tables: {
107 rate: {
108 base: {
109 input_tokens: 1.25 / 1e6,
110 output_tokens: 4.25 / 1e6,
111 cache_read_tokens: 0.15 / 1e6,
112 },
113 },
114 },
115 })
116 expect(contributor?.pricing).toMatchObject({
117 tables: {
118 rate: {
119 base: {
120 input_tokens: 0.1 / 1e6,
121 output_tokens: 0.2 / 1e6,
122 cache_read_tokens: 0.002 / 1e6,
123 },
124 },
125 },
126 })
127 expect(models.find((m) => m.rawId === 'muse-spark-1.1')?.pricing).toEqual(
128 spark?.pricing,
129 )
130 expect(
131 models
132 .filter((m) => m.activity !== 'chat')
133 .map((m) => [m.rawId, m.displayName]),
134 ).toEqual([
135 ['muse-image-1.0', 'Muse Image'],
136 ['muse-voice-transcribe-1.0', 'Muse Voice Transcribe'],
137 ['sam-3.1', 'Segment Anything Model'],
138 ])
139 expect(
140 models.find((m) => m.rawId === 'muse-image-1.0')?.pricing,
141 ).toMatchObject({ tables: { rate: { base: { generated_images: 0.01 } } } })
142 expect(
143 models.find((m) => m.rawId === 'muse-voice-transcribe-1.0')?.pricing,
144 ).toMatchObject({
145 tables: { rate: { base: { audio_seconds: 0.18 / 3600 } } },
146 })
147 expect(models.find((m) => m.rawId === 'sam-3.1')?.pricing).toMatchObject({
148 tables: {
149 rate: {
150 base: { segmented_images: 2.5 / 1000, video_frames: 0.2 / 1000 },
151 },
152 },
153 })
154 expect(
155 urls.every((url) => url.startsWith('https://dev.meta.ai/docs/')),
156 ).toBe(true)
157 })
158 it('reads native chat, image and ASR schema resources and POST references', async () => {
159 const urls = serve()
160 const fetched = await provider.fetchSpec({})
161 expect(fetched.skipped).toBeUndefined()
162 expect(fetched.specs).toHaveLength(6)
163 expect(fetched.sources).toHaveLength(6)
164 const bundled = classifyAndBundle(provider, fetched)
165 expect(bundled.warnings).toEqual([])
166 expect(bundled.endpoints).toHaveLength(6)
167 expect(
168 bundled.endpoints.every((endpoint) => endpoint.input && endpoint.output),
169 ).toBe(true)
170 expect(fetched.specs.map((s) => Object.keys(s.paths ?? {}))).toEqual([
171 ['/v1/chat/completions'],
172 ['/v1/responses'],
173 ['/v1/messages'],
174 ['/v1/images/generations'],
175 ['/v1/images/edits'],
176 ['/v1/asr/transcribe'],
177 ])
178 expect(
179 urls.every((url) => url.startsWith('https://dev.meta.ai/docs/')),
180 ).toBe(true)
181 })
182 it('preserves nested array fields, explicit required markers, enums and constraints', () => {
183 const schemas = parseMetaSchemas(
184 docs[`${META_REFERENCE}chat-completions/schemas`] ?? '',
185 )
186 expect(schemas['create-chat-completion-request']).toMatchObject({
187 required: ['messages', 'model'],
188 properties: {
189 messages: { type: 'array', minItems: 1 },
190 top_logprobs: { minimum: 0, maximum: 20 },
191 },
192 })
193 expect(schemas['create-chat-completion-response']).toMatchObject({
194 properties: {
195 choices: {
196 items: {
197 properties: {
198 finish_reason: {
199 enum: [
200 'stop',
201 'length',
202 'tool_calls',
203 'content_filter',
204 'function_call',
205 ],
206 },
207 },
208 },
209 },
210 },
211 })
212 const response = parseMetaSchemas(
213 docs[`${META_REFERENCE}responses/schemas`] ?? '',
214 )
215 expect(
216 Object.values(response).some((schema) =>
217 JSON.stringify(schema).includes('"x-source-type":null'),
218 ),
219 ).toBe(true)
220 })
221 it('preserves native multipart content and marks ASR unpublished fields unknown', async () => {
222 serve()
223 const fetched = await provider.fetchSpec({})
224 const edits = fetched.specs[4]?.paths?.['/v1/images/edits']?.post
225 expect(edits?.requestBody).toMatchObject({
226 content: {
227 'application/json': {
228 schema: { $ref: '#/components/schemas/edit-image-body-json-param' },
229 },
230 'multipart/form-data': {
231 schema: { $ref: '#/components/schemas/create-image-edit-request' },
232 },
233 },
234 })
235 const asr = fetched.specs[5]?.paths?.['/v1/asr/transcribe']?.post
236 expect(asr?.requestBody).toMatchObject({
237 content: {
238 'multipart/form-data': {
239 schema: { type: 'object', 'x-source-fields': null },
240 },
241 },
242 })
243 expect(
244 provider.generationEndpointId?.({
245 activity: 'audio',
246 rawId: 'muse-voice-transcribe-1.0',
247 }),
248 ).toBe('v1/asr/transcribe')
249 })
250​
251 it('fails an empty source instead of removing stored rows', async () => {
252 serve({ [META_MODELS]: '<h1>Models</h1>' })
253 await expect(provider.listModels({})).rejects.toThrow(
254 'model table listed no models',
255 )
256 })
257 it('leaves pricing null when the provider publishes no quote for a newly listed model', () => {
258 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
259 models.push({
260 rawId: 'synthetic-unsourced',
261 providerMetadata: { family: 'Synthetic' },
262 })
263 const prices = parseMetaPricing(docs[META_PRICING] ?? '', models, {
264 url: META_PRICING,
265 hash: 'fixture',
266 extractedAt: '2026-10-09',
267 })
268 expect(prices.has('synthetic-unsourced')).toBe(false)
269 })
270 it('fails unknown types and structurally missing schema cells', () => {
271 const source = docs[`${META_REFERENCE}chat-completions/schemas`] ?? ''
272 expect(() =>
273 parseMetaSchemas(
274 source.replace('integer (unixtime)', 'undocumented-primitive'),
275 ),
276 ).toThrow('unknown schema type')
277 expect(() =>
278 parseMetaSchemas(source.replace(/<td\b[^>]*>[\s\S]*?<\/td>/, '')),
279 ).toThrow('schema field row changed')
280 })
281 it('rejects malformed published quotes rather than filling old amounts', () => {
282 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
283 expect(() =>
284 parseMetaPricing(
285 (docs[META_PRICING] ?? '').replace('$1.25', '$unknown'),
286 models,
287 { url: META_PRICING, hash: 'fixture', extractedAt: '2026-10-09' },
288 ),
289 ).toThrow('unreadable token price')
290 expect(() =>
291 parseMetaPricing(
292 (docs[META_PRICING] ?? '').replace('$0.01 per image', '$0.01'),
293 models,
294 { url: META_PRICING, hash: 'fixture', extractedAt: '2026-10-12' },
295 ),
296 ).toThrow('unreadable image price')
297 })
298 it('fails a models page whose chat tables it cannot read instead of dropping them', async () => {
299 const models = docs[META_MODELS] ?? ''
300 const spark = docs[SPARK] ?? ''
301 for (const [overrides, error] of [
302 [
303 {
304 [SPARK]: spark.replace(
305 '<th>Version</th><th>Model API (pay-as-you-go)</th>',
306 '<th>Version</th><th>Model API</th>',
307 ),
308 },
309 'model availability headers changed',
310 ],
311 [
312 { [SPARK]: spark.replace('<th>Version</th>', '<th>Edition</th>') },
313 'missing model availability table',
314 ],
315 [
316 {
317 [META_MODELS]: models.replace(
318 '<code>muse-spark-1.1</code>',
319 '<code>muse-spark-1.0</code>',
320 ),
321 },
322 'Muse Spark page disagrees with the model table',
323 ],
324 [
325 {
326 [META_MODELS]: models
327 .replaceAll('<th>Context window</th>', '')
328 .replaceAll('<td>1,048,576 tokens</td>', '')
329 .replace(
330 ', <code>muse-spark-1.2</code>, <code>muse-spark-1.1</code>',
331 '',
332 ),
333 },
334 'model page listed no chat models',
335 ],
336 [
337 {
338 [SPARK]: spark.replace(
339 '<td><strong>Input</strong></td>',
340 '<td><strong>Inputs</strong></td>',
341 ),
342 },
343 'missing model modalities',
344 ],
345 [
346 { [SPARK]: spark.replace('1,048,576 tokens', 'about a million') },
347 'unreadable model context',
348 ],
349 [
350 {
351 [SPARK]: spark.replace(
352 '<td>Contributor mode</td>',
353 '<td>Discounted mode</td>',
354 ),
355 },
356 'unreadable model availability',
357 ],
358 ] as const) {
359 serve(overrides)
360 await expect(provider.listModels({})).rejects.toThrow(error)
361 }
362 })
363 it('reads every output modality the line page states', () => {
364 const models = parseMetaModels(docs[META_MODELS] ?? '', {
365 ...pages,
366 'muse-wonder': pages['muse-wonder'].replace(
367 '<td><strong>Output</strong></td><td>Text</td>',
368 '<td><strong>Output</strong></td><td>Text and images</td>',
369 ),
370 })
371 expect(
372 models.find((m) => m.rawId === 'muse-wonder-1.0')?.modalities,
373 ).toEqual({
374 input: ['text', 'image', 'video', 'audio', 'pdf'],
375 output: ['text', 'images'],
376 })
377 })
378 it('fails token prices whose mode is unstated, ambiguous or contradicts the model tier', () => {
379 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
380 const page = docs[META_PRICING] ?? ''
381 for (const [html, error] of [
382 [
383 page.replace(' in Contributor mode', ' as variants'),
384 'token price mode unstated',
385 ],
386 [
387 page.replace(
388 ' in Contributor mode',
389 ' in Contributor mode or in Standard mode',
390 ),
391 'ambiguous token price mode',
392 ],
393 [
394 page.replace(' in Contributor mode', ' in Standard mode'),
395 'token price mode disagrees with model tier',
396 ],
397 [
398 page.replace(
399 'and <code>muse-spark-1.1</code> in Standard mode',
400 'and <code>muse-spark-1.1</code> in Standard mode; <code>muse-spark-1.1</code> in Standard mode',
401 ),
402 'duplicate model price',
403 ],
404 [page.replace('$0.10', 'Not available'), 'incomplete token pricing'],
405 ] as const)
406 expect(() =>
407 parseMetaPricing(html, models, {
408 url: META_PRICING,
409 hash: 'fixture',
410 extractedAt: '2026-10-12',
411 }),
412 ).toThrow(error)
413 })
414 it('fails a family price table it does not recognise instead of clearing the price', () => {
415 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
416 const page = docs[META_PRICING] ?? ''
417 const wonder = page.indexOf('<p>Model: <code>muse-wonder-1.0</code>')
418 expect(() =>
419 parseMetaPricing(
420 page.slice(0, wonder) +
421 page
422 .slice(wonder)
423 .replace(
424 '<th>Standard mode (per 1M tokens)</th>',
425 '<th>Standard (per 1M tokens)</th>',
426 ),
427 models,
428 { url: META_PRICING, hash: 'fixture', extractedAt: '2026-10-12' },
429 ),
430 ).toThrow('unknown pricing table in Muse Wonder')
431 })
432 it('reads token prices when Contributor is the first column', () => {
433 // Trimmed from https://dev.meta.ai/docs/pricing-rate-limits on 2026-11-10.
434 // Decorative attributes removed; cell text is the live table.
435 const html = `<h1 id="pricing">Pricing</h1>
436<h3 id="muse-wonder-pricing">Muse Wonder</h3>
437<p>Model: <code>muse-wonder-1.0</code>.</p>
438<table><thead><tr><th>Usage</th><th>Contributor mode (per 1M tokens)</th><th>Standard mode (per 1M tokens)</th></tr></thead><tbody>
439<tr><td>Cached input</td><td>Not available</td><td>$0.20</td></tr>
440<tr><td>Input</td><td>Not available</td><td>$4.00</td></tr>
441<tr><td>Output</td><td>Not available</td><td>$20.00</td></tr>
442</tbody></table>
443<h3 id="muse-spark-pricing">Muse Spark</h3>
444<p>Models: <code>muse-spark-1.3</code>, <code>muse-spark-1.2</code>, and <code>muse-spark-1.1</code> in Standard mode; <code>muse-spark-1.3-contributor</code> and <code>muse-spark-1.2-contributor</code> in Contributor mode. Muse Spark 1.1 is Standard mode only.</p>
445<table><thead><tr><th>Usage</th><th>Contributor mode (per 1M tokens)</th><th>Standard mode (per 1M tokens)</th></tr></thead><tbody>
446<tr><td>Cached input</td><td>$0.002</td><td>$0.15</td></tr>
447<tr><td>Input</td><td>$0.10</td><td>$1.25</td></tr>
448<tr><td>Output</td><td>$0.20</td><td>$4.25</td></tr>
449</tbody></table>`
450 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
451 const cards = parseMetaPricing(html, models, {
452 url: META_PRICING,
453 hash: 'live-2026-11-10',
454 extractedAt: '2026-11-10',
455 })
456 expect(cards.get('muse-wonder-1.0')).toMatchObject({
457 tables: {
458 rate: {
459 base: {
460 input_tokens: 4 / 1e6,
461 output_tokens: 20 / 1e6,
462 cache_read_tokens: 0.2 / 1e6,
463 },
464 },
465 },
466 })
467 expect(cards.get('muse-spark-1.3')).toMatchObject({
468 tables: {
469 rate: {
470 base: {
471 input_tokens: 1.25 / 1e6,
472 output_tokens: 4.25 / 1e6,
473 cache_read_tokens: 0.15 / 1e6,
474 },
475 },
476 },
477 })
478 expect(cards.get('muse-spark-1.3-contributor')).toMatchObject({
479 tables: {
480 rate: {
481 base: {
482 input_tokens: 0.1 / 1e6,
483 output_tokens: 0.2 / 1e6,
484 cache_read_tokens: 0.002 / 1e6,
485 },
486 },
487 },
488 })
489 expect(cards.get('muse-spark-1.1')).toEqual(cards.get('muse-spark-1.3'))
490 expect(cards.get('muse-spark-1.2-contributor')).toEqual(
491 cards.get('muse-spark-1.3-contributor'),
492 )
493 })
494 // Trimmed from https://dev.meta.ai/docs/pricing-rate-limits on 2026-11-10.
495 // Decorative attributes removed; the prose and cell text are the live page.
496 const museEmberPricing = `<h1 id="pricing">Pricing</h1>
497<h3 id="muse-ember-pricing">Muse Ember</h3>
498<p>Model: <code>muse-ember-1.0</code>, in Standard mode only.</p>
499<p>Muse Ember has two price tiers, and the input tokens in your API request set the tier, cached tokens included. When a request continues a stored conversation with <code>previous_response_id</code>, its input includes that conversation. A request with up to 200K input tokens is billed at the rates in the first column. A request with more is billed at the long-context rates in full, not only for the tokens past 200K. Your invoice and usage dashboard list the two tiers separately.</p>
500<table><thead><tr><th>Usage</th><th>Up to 200K input tokens (per 1M tokens)</th><th>Over 200K input tokens (per 1M tokens)</th></tr></thead><tbody>
501<tr><td>Cached input</td><td>$0.004</td><td>$0.012</td></tr>
502<tr><td>Input</td><td>$0.10</td><td>$0.30</td></tr>
503<tr><td>Output</td><td>$0.50</td><td>$1.50</td></tr>
504</tbody></table>`
505 const emberModel = (tier: string) => ({
506 rawId: 'muse-ember-1.0',
507 providerMetadata: { family: 'Muse Ember', tier },
508 })
509 const emberSource = {
510 url: META_PRICING,
511 hash: 'live-2026-11-10',
512 extractedAt: '2026-11-10',
513 }
514 it('reads Muse Ember as one card with a 200K prompt-size tier', () => {
515 const cards = parseMetaPricing(
516 museEmberPricing,
517 [emberModel('Standard')],
518 emberSource,
519 )
520 const card = cards.get('muse-ember-1.0')
521 expect(card).toMatchObject({
522 tables: {
523 rate: {
524 base: {
525 cache_read_tokens: 0.004 / 1e6,
526 input_tokens: 0.1 / 1e6,
527 output_tokens: 0.5 / 1e6,
528 },
529 '200000': {
530 cache_read_tokens: 0.012 / 1e6,
531 input_tokens: 0.3 / 1e6,
532 output_tokens: 1.5 / 1e6,
533 },
534 },
535 },
536 })
537 if (!card) throw new Error('missing muse-ember-1.0 card')
538 // 200K exactly stays on the first column. One token over bills the
539 // whole request at the long-context column. Cached input counts
540 // toward the threshold and is priced on its own lever.
541 expect(
542 evaluateCard(card, {
543 usage: { input_tokens: 200_000, output_tokens: 100 },
544 }).amount,
545 ).toBeCloseTo(200_000 * (0.1 / 1e6) + 100 * (0.5 / 1e6), 10)
546 expect(
547 evaluateCard(card, {
548 usage: { input_tokens: 200_001, output_tokens: 100 },
549 }).amount,
550 ).toBeCloseTo(200_001 * (0.3 / 1e6) + 100 * (1.5 / 1e6), 10)
551 expect(
552 evaluateCard(card, {
553 usage: {
554 input_tokens: 199_000,
555 cache_read_tokens: 1_000,
556 output_tokens: 0,
557 },
558 }).amount,
559 ).toBeCloseTo(199_000 * (0.1 / 1e6) + 1_000 * (0.004 / 1e6), 10)
560 expect(
561 evaluateCard(card, {
562 usage: {
563 input_tokens: 199_000,
564 cache_read_tokens: 2_000,
565 output_tokens: 0,
566 },
567 }).amount,
568 ).toBeCloseTo(199_000 * (0.3 / 1e6) + 2_000 * (0.012 / 1e6), 10)
569 expect(() =>
570 parseMetaPricing(
571 museEmberPricing,
572 [emberModel('Contributor')],
573 emberSource,
574 ),
575 ).toThrow('token price mode disagrees with model tier')
576 })
577 it('fails when the two prompt-size thresholds disagree', () => {
578 expect(() =>
579 parseMetaPricing(
580 museEmberPricing.replace(
581 'Over 200K input tokens',
582 'Over 128K input tokens',
583 ),
584 [emberModel('Standard')],
585 emberSource,
586 ),
587 ).toThrow('prompt-size thresholds disagree')
588 })
589 it('fails when the long-context column leaves out a lever', () => {
590 expect(() =>
591 parseMetaPricing(
592 museEmberPricing.replace(
593 '<td>$0.004</td><td>$0.012</td>',
594 '<td>$0.004</td><td>Not available</td>',
595 ),
596 [emberModel('Standard')],
597 emberSource,
598 ),
599 ).toThrow('prompt-size columns price different levers')
600 })
601 it('fails when a prompt-size header does not parse', () => {
602 expect(() =>
603 parseMetaPricing(
604 museEmberPricing.replace(
605 'Over 200K input tokens (per 1M tokens)',
606 'Over 200 thousand input tokens (per 1M tokens)',
607 ),
608 [emberModel('Standard')],
609 emberSource,
610 ),
611 ).toThrow('unreadable prompt-size threshold')
612 })
613 it('fails when a pay-as-you-go chat ID gets no token price', () => {
614 const models = parseMetaModels(docs[META_MODELS] ?? '', pages)
615 expect(() =>
616 parseMetaPricing(
617 (docs[META_PRICING] ?? '').replace(
618 /(<p>Model: <code>muse-wonder-1\.0<\/code>[\s\S]*?)<th>Usage<\/th>/,
619 '$1<th>Meter</th>',
620 ),
621 models,
622 { url: META_PRICING, hash: 'fixture', extractedAt: '2026-10-12' },
623 ),
624 ).toThrow('token-priced model has no price')
625 })
626 it('fails a reasoning effort restriction it cannot read', async () => {
627 const page = docs['https://dev.meta.ai/docs/reasoning'] ?? ''
628 for (const cell of [
629 'Standard mode only.',
630 'Supported by Muse Wonder and Muse Spark 1.3.',
631 'Requires <code>muse-wonder-1.0</code>.',
632 'Supported by <code>muse-wonder-1.0</code>; not available with Contributor-mode variants.',
633 ]) {
634 serve({
635 'https://dev.meta.ai/docs/reasoning': page.replace(
636 /Supported by <code>[\s\S]*?<\/td>/,
637 `${cell}</td>`,
638 ),
639 })
640 await expect(provider.listModels({})).rejects.toThrow(
641 'unreadable reasoning effort restriction',
642 )
643 }
644 })
645 it('leaves reasoning unset for a chat family the page does not say always reasons', async () => {
646 serve({
647 'https://dev.meta.ai/docs/reasoning': (
648 docs['https://dev.meta.ai/docs/reasoning'] ?? ''
649 ).replace(
650 'which Muse Wonder and Muse Spark do not support',
651 'which Muse Spark does not support',
652 ),
653 })
654 const { models } = await provider.listModels({})
655 expect(
656 models.find((m) => m.rawId === 'muse-wonder-1.0')?.reasoning,
657 ).toBeNull()
658 expect(
659 models.find((m) => m.rawId === 'muse-spark-1.1')?.reasoning,
660 ).toMatchObject({ mode: 'effort', mandatory: true })
661 })
662})