Use strict OpenRouter schema for analysis
All checks were successful
Build and deploy Worker / build (push) Successful in 2m44s

This commit is contained in:
Ruslan Bakiev
2026-05-14 22:10:31 +07:00
parent 842d151a44
commit 07ffd95a02

View File

@@ -86,9 +86,40 @@ async function buildPlaceAnalysis(input: {
},
body: JSON.stringify({
model: config.openRouterModel,
provider: { require_parameters: true },
temperature: 0.1,
max_tokens: 900,
response_format: { type: 'json_object' },
max_tokens: 2000,
response_format: {
type: 'json_schema',
json_schema: {
name: 'place_analysis',
strict: true,
schema: {
type: 'object',
additionalProperties: false,
required: ['placeName', 'tags', 'signals', 'summary'],
properties: {
placeName: { type: 'string' },
tags: { type: 'array', items: { type: 'string' } },
signals: {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
required: ['axis', 'leaf', 'evidence', 'confidence'],
properties: {
axis: { type: 'string' },
leaf: { type: 'string' },
evidence: { type: 'string' },
confidence: { type: 'number', minimum: 0, maximum: 1 },
},
},
},
summary: { type: 'string' },
},
},
},
},
messages: [
{
role: 'system',