fix(worksheet-parsing): remove .optional() for OpenAI strict mode compatibility
OpenAI's strict JSON schema mode requires ALL properties to be in the `required` array. The `notes` and `excluded` fields used `.optional()` which caused them to be excluded from `required`, resulting in API error: "Missing 'notes'" in required array. Fix: - `notes`: Changed from `.nullable().optional()` to just `.nullable()` - `excluded`: Changed from `.optional()` to `.default(false)` Both fields are now properly included in the required array while still allowing null/false values as defaults. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f7dccb3e0b
commit
b208213b66
|
|
@ -144,10 +144,9 @@ export const ParsedProblemSchema = z
|
||||||
notes: z
|
notes: z
|
||||||
.string()
|
.string()
|
||||||
.nullable()
|
.nullable()
|
||||||
.optional()
|
|
||||||
.describe(
|
.describe(
|
||||||
'Brief explanation if confidence is low. Examples: "Answer partially obscured by smudge", ' +
|
'Brief explanation if confidence is low. Examples: "Answer partially obscured by smudge", ' +
|
||||||
'"Digit could be 7 or 1", "Answer box appears empty". Null/omit if confidence is high.',
|
'"Digit could be 7 or 1", "Answer box appears empty". Null if confidence is high.',
|
||||||
),
|
),
|
||||||
|
|
||||||
// Bounding boxes for UI highlighting
|
// Bounding boxes for UI highlighting
|
||||||
|
|
@ -161,7 +160,7 @@ export const ParsedProblemSchema = z
|
||||||
// User exclusion (set by corrections, not LLM)
|
// User exclusion (set by corrections, not LLM)
|
||||||
excluded: z
|
excluded: z
|
||||||
.boolean()
|
.boolean()
|
||||||
.optional()
|
.default(false)
|
||||||
.describe(
|
.describe(
|
||||||
"True if user marked this problem to be excluded from the session",
|
"True if user marked this problem to be excluded from the session",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue