@peopl-health/nexus 5.70.0 → 5.71.0-dev.12718
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -348,15 +348,27 @@ class AnthropicProvider extends BaseLLMProvider {
|
|
|
348
348
|
};
|
|
349
349
|
if (system) apiConfig.system = system;
|
|
350
350
|
|
|
351
|
+
// Always-thinking models (Opus/Sonnet 5.5) reject a forced tool_choice; presets opt into output_config.format instead.
|
|
352
|
+
const nativeFormat = modelConfig.structured_mode === 'output_format';
|
|
353
|
+
if (nativeFormat) {
|
|
354
|
+
const effort = modelConfig.reasoning?.effort;
|
|
355
|
+
if (effort) apiConfig.output_config = { effort: effort === 'minimal' ? 'low' : effort };
|
|
356
|
+
if (modelConfig.thinking) apiConfig.thinking = modelConfig.thinking;
|
|
357
|
+
}
|
|
358
|
+
|
|
351
359
|
const spec = text || modelConfig.text;
|
|
352
360
|
let tool = null;
|
|
353
361
|
if (spec) {
|
|
354
362
|
const format = spec.format ? spec.format : spec;
|
|
355
363
|
if (!format.schema) throw new Error('runStructured: format spec has no schema');
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
364
|
+
if (nativeFormat) {
|
|
365
|
+
apiConfig.output_config = { ...apiConfig.output_config, format: { type: 'json_schema', schema: format.schema } };
|
|
366
|
+
} else {
|
|
367
|
+
tool = { name: format.name || 'structuredOutput', input_schema: format.schema };
|
|
368
|
+
if (format.strict !== undefined) tool.strict = format.strict;
|
|
369
|
+
apiConfig.tools = [tool];
|
|
370
|
+
apiConfig.tool_choice = { type: 'tool', name: tool.name };
|
|
371
|
+
}
|
|
360
372
|
}
|
|
361
373
|
|
|
362
374
|
const { result: { result }, durationMs } = await withTiming(() =>
|