Skip to content

Commit ea226b0

Browse files
Marfuenclaude
andauthored
fix(questionnaire): add additionalProperties false for OpenAI strict mode (#2792)
The gpt-5-mini parser was failing with "additionalProperties is required to be supplied and to be false" because OpenAI's Responses API enforces strict structured outputs, which requires additionalProperties: false on every object schema and every property listed in required. Also fix the same latent bug in content-extractor's shared schema, which would break if any of its callers swapped to a strict-mode OpenAI model. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 47bd6d8 commit ea226b0

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

apps/api/src/questionnaire/utils/content-extractor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ const questionExtractionSchema = jsonSchema<{
3737
description: 'The answer/response if provided, null if empty',
3838
},
3939
},
40-
required: ['question'],
40+
required: ['question', 'answer'],
41+
additionalProperties: false,
4142
},
4243
},
4344
},
4445
required: ['questions'],
46+
additionalProperties: false,
4547
});
4648

4749
export interface ContentExtractionLogger {

apps/api/src/questionnaire/utils/question-parser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ export async function parseChunkQuestionsAndAnswers(
135135
'The answer to the question. Use null if no answer is provided.',
136136
},
137137
},
138-
required: ['question'],
138+
required: ['question', 'answer'],
139+
additionalProperties: false,
139140
},
140141
},
141142
},
142143
required: ['questionsAndAnswers'],
144+
additionalProperties: false,
143145
}),
144146
system: QUESTION_PARSING_SYSTEM_PROMPT,
145147
prompt: buildParsingPrompt(chunk, chunkIndex, totalChunks),

0 commit comments

Comments
 (0)