[Bugfix] remove fallback in guided_json (int range, patterns) (#16725)

Signed-off-by: csy1204 <josang1204@gmail.com>
Co-authored-by: 조상연[플레이스 AI] <sang-yeon.cho@navercorp.com>
This commit is contained in:
Sangyeon Cho
2025-04-25 15:54:43 +09:00
committed by GitHub
parent b22980a1dc
commit 6aae216b4e
6 changed files with 94 additions and 72 deletions

View File

@@ -47,6 +47,14 @@ def sample_json_schema():
"type": "string",
}
},
"grade": {
"type": "string",
"pattern": "^[A-D]$" # Regex pattern
},
"email": {
"type": "string",
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
},
"work_history": {
"type": "array",
"items": {
@@ -56,17 +64,20 @@ def sample_json_schema():
"type": "string"
},
"duration": {
"type": "number"
"type": "number",
"minimum": 0.0,
"maximum": 100.0, # Numeric range
},
"position": {
"type": "string"
}
},
"required": ["company", "position"]
"required": ["company", "duration", "position"]
}
}
},
"required": ["name", "age", "skills", "work_history"]
"required":
["name", "age", "skills", "grade", "email", "work_history"]
}
@@ -78,27 +89,18 @@ def unsupported_json_schema():
"properties": {
"score": {
"type": "integer",
"minimum": 0,
"maximum": 100 # Numeric range
},
"grade": {
"type": "string",
"pattern": "^[A-D]$" # Regex pattern
},
"email": {
"type": "string",
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
"multipleOf": 5 # Numeric multiple
},
"tags": {
"type": "array",
"items": {
"type": "string",
"pattern":
"^[a-z]{1,10}$" # Combining length and pattern restrictions
"minLength": 10,
"maxLength": 20
}
}
},
"required": ["score", "grade", "email", "tags"]
"required": ["score", "tags"]
}