You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drop structured-outputs enforcement for the exercise-details call
Sixth attempt at satisfying Anthropic's structured-outputs grammar
compiler for a rich per-exercise schema, after five straight failures
(optional-count limit, union-type limit, "too complex" twice, grammar
compilation timeout) -- every one of them in the exercise-details call
specifically. The workout-shape call has never failed once.
Rather than reshaping the schema a sixth time, the exercise-details call
now skips output_config/json_schema entirely: SystemPrompt#exercise_details_text
describes the exact JSON shape in prose (built programmatically from
EXERCISE_SCHEMA's properties, so the description can't silently drift
from the Exercise model) and instructs the model to respond with only a
JSON object, no markdown fences. parse_json_response gains a
strip_markdown_fences step before JSON.parse -- a no-op for the
workout-shape call's still-enforced, fence-free response, a real safety
net for the exercise-details call's unenforced one.
This trades away the hard guarantee that the response can't violate the
shape, but downstream validation already covers what that guarantee was
protecting against: lookup_movement! catches an unrecognized movement
name, the exercise-count-mismatch check catches a wrong array length,
ActiveRecord type-casts a stray numeric string automatically, and
Workout#valid? catches anything else.
Also drops `notes` from EXERCISE_SCHEMA per a separate simplification
call, unrelated to this specific fix.
EXERCISE_DETAILS_SCHEMA is removed (no longer used for output_config);
EXERCISE_SCHEMA stays, now purely as the source the prompt's field
descriptions are derived from. Test updates: exercise_payload helpers
drop notes; the schema test's "call 2 property counts" test is removed
since Anthropic's structured-outputs limits no longer apply to that call;
added a test confirming a markdown-fenced exercise-details response still
parses correctly.
0 commit comments