Commit dbf2672
committed
feat(audit): swap premium model to gemma-4-26b-a4b + dual-shape adapter
The previous commit registered gemma-3-12b as the premium option because
my stale local types didn't list gemma-4-26b-a4b-it. The model is in
fact GA on Workers AI (docs at developers.cloudflare.com/workers-ai/models/
gemma-4-26b-a4b-it) — the wrangler type generator just hasn't picked it
up yet. Runtime calls work; the existing TypeScript cast in the consumer
handles the gap.
- AUDIT_MODELS swapped: gemma-3-12b → gemma-4-26b-a4b (MoE 26B/4B active,
256k context, vision + reasoning + function calling).
- AuditModelKey union updated to match.
- Consumer now normalises across two response shapes:
* Standard Workers AI: { response: string, usage: {...} }
* OpenAI chat completion (gemma-4):
{ choices: [{message: {content}}], usage: {...} }
Fallback chain reads response first then choices[0].message.content so
existing tests (which mock the standard shape) keep passing.
- Request body sends both max_tokens and max_completion_tokens — Workers
AI ignores the unrecognised one for each model so a single call works
for both shapes.
- Stored rawResponse now uses the normalised text instead of the
envelope-specific field.1 parent c1e4bf7 commit dbf2672
3 files changed
+47
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
328 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
329 | 347 | | |
330 | 348 | | |
331 | 349 | | |
332 | 350 | | |
333 | 351 | | |
334 | | - | |
| 352 | + | |
335 | 353 | | |
336 | 354 | | |
337 | 355 | | |
338 | 356 | | |
339 | 357 | | |
| 358 | + | |
340 | 359 | | |
341 | | - | |
| 360 | + | |
342 | 361 | | |
343 | 362 | | |
344 | 363 | | |
| |||
351 | 370 | | |
352 | 371 | | |
353 | 372 | | |
354 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
355 | 383 | | |
356 | 384 | | |
357 | 385 | | |
358 | | - | |
359 | 386 | | |
360 | 387 | | |
361 | 388 | | |
| |||
383 | 410 | | |
384 | 411 | | |
385 | 412 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
390 | 418 | | |
391 | 419 | | |
392 | 420 | | |
393 | 421 | | |
394 | | - | |
| 422 | + | |
395 | 423 | | |
396 | 424 | | |
397 | 425 | | |
| |||
406 | 434 | | |
407 | 435 | | |
408 | 436 | | |
409 | | - | |
| 437 | + | |
410 | 438 | | |
411 | 439 | | |
412 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
0 commit comments