Repository navigation
Commit 58138ea
fix(autoblog): two Anthropic SDK foot-guns hiding behind structured-output
Why detect+enrich looked like it "prefilled with placeholders": the
LLM call was silently failing, leaving niche/audiences/description
empty, so the form fell through to its placeholder text. Two distinct
bugs, both in lib/lx/detectBlog.ts (and one repeating in
lib/lx/articleGen.ts).
1. `zodOutputFormat` needs `zod/v4`.
@anthropic-ai/sdk@0.95.x's helpers/zod.mjs does
`import * as z from 'zod/v4'` and calls `z.toJSONSchema(...)` — a
v4-only API. Importing plain "zod" gives a v3 schema whose `_def`
shape v4 can't read → "Cannot read properties of undefined
(reading 'def')" at runtime. lib/audit/claude-engine.ts already
imports from "zod/v4" with a warning comment; the new lx/ files
missed it.
2. Haiku 4.5 rejects `output_config.effort`.
Adaptive thinking is a Sonnet/Opus feature. Passing effort to Haiku
returns 400 "This model does not support the effort parameter."
Drop effort + thinking for Haiku-only call sites; keep them on the
article-generation call (Sonnet) where they're valid.
Reproduced locally against crawlproof.com — discover finds blog +
sitemap; enrichment now returns a real { niche, target_audiences,
description } in ~5s on Haiku 4.5.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b7f31fc commit 58138ea
2 files changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
460 | 464 | | |
461 | 465 | | |
462 | 466 | | |
463 | | - | |
| 467 | + | |
| 468 | + | |
464 | 469 | | |
465 | | - | |
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
| |||
0 commit comments