[fix] solution/backend: 응답 스키마 대문자 타입 — openai 에서만 400 으로 터지던 것
OpenAI strict 모드는 'STRING' 을 거부한다: Invalid schema for response_format: 'STRING' is not valid under any of the given schemas Gemini 는 대소문자를 둘 다 받아서, 대문자로 써 두면 **공급자를 openai 로 바꾸는 순간에만** 터진다. LLM_PROVIDER 기본값이 openai 인데 두 파일만 대문자로 남아 있었다 — 대화창은 첫 발화부터 502 였고 SNS 초안도 같은 이유로 못 돌았다. - prompts/agent: 소문자로. args 는 strict 가 전 프로퍼티를 required 로 만드므로 안 쓰는 인자가 빈 문자열로 온다 — 도구는 "" 를 '없음' 으로 읽는다 - prompts/social: 같은 수정. 나머지 프롬프트는 원래 소문자였다 실측 확인: "체크인 시간 3시로 바꿔줘" → set_fact(check_in_time, 15:00) test_agent_runtime·test_social 34 passed Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4dd0c604ee
commit
59df616a7b
2 files changed
+24
-11
No files matched your search
@@ -11,18 +11,28 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
RESPONSE_SCHEMA = {
|
RESPONSE_SCHEMA = {
|
||||||
"type": "OBJECT",
|
# ★ 타입 이름은 **소문자**다. OpenAI strict 모드가 대문자('STRING')를 거부한다 —
|
||||||
|
# `Invalid schema for response_format: 'STRING' is not valid under any of the given schemas`.
|
||||||
|
# Gemini 는 둘 다 받아서, 대문자로 써 두면 공급자를 openai 로 바꾸는 순간에만 터진다.
|
||||||
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
# tool: 부를 도구 이름. 못 고르겠으면 빈 문자열.
|
# 부를 도구 이름. 못 고르겠으면 빈 문자열.
|
||||||
"tool": {"type": "STRING"},
|
"tool": {"type": "string"},
|
||||||
|
# ★ strict 모드는 모든 프로퍼티를 required 로 만든다(llm/openai._to_strict_schema).
|
||||||
|
# 그래서 안 쓰는 인자는 빈 문자열로 온다 — 도구는 "" 를 '없음' 으로 읽는다.
|
||||||
"args": {
|
"args": {
|
||||||
"type": "OBJECT",
|
"type": "object",
|
||||||
"properties": {"key": {"type": "STRING"}, "value": {"type": "STRING"}, "keyword": {"type": "STRING"}},
|
"properties": {
|
||||||
|
"key": {"type": "string"},
|
||||||
|
"value": {"type": "string"},
|
||||||
|
"keyword": {"type": "string"},
|
||||||
|
},
|
||||||
|
"required": ["key", "value", "keyword"],
|
||||||
},
|
},
|
||||||
# message: 도구를 못 고른 경우에만 쓴다(되묻기·안내).
|
# 도구를 못 고른 경우에만 쓴다(되묻기·안내).
|
||||||
"message": {"type": "STRING"},
|
"message": {"type": "string"},
|
||||||
},
|
},
|
||||||
"required": ["tool", "message"],
|
"required": ["tool", "args", "message"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
RESPONSE_SCHEMA = {'type': 'OBJECT', 'properties': {
|
# ★ 타입 이름은 소문자다. OpenAI strict 모드가 대문자('STRING')를 거부한다 —
|
||||||
'body': {'type': 'STRING'},
|
# Gemini 는 둘 다 받아서, 대문자로 두면 **공급자를 openai 로 바꾸는 순간에만** 터진다
|
||||||
'fact_keys': {'type': 'ARRAY', 'items': {'type': 'STRING'}},
|
# (실측 2026-09-21: LLM_PROVIDER 기본값이 openai 인데 이 파일만 대문자로 남아 있었다).
|
||||||
|
RESPONSE_SCHEMA = {'type': 'object', 'properties': {
|
||||||
|
'body': {'type': 'string'},
|
||||||
|
'fact_keys': {'type': 'array', 'items': {'type': 'string'}},
|
||||||
}, 'required': ['body', 'fact_keys']}
|
}, 'required': ['body', 'fact_keys']}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user