diff --git a/solution/backend/services/prompts/agent.py b/solution/backend/services/prompts/agent.py index b96c49c..4d3f0af 100644 --- a/solution/backend/services/prompts/agent.py +++ b/solution/backend/services/prompts/agent.py @@ -11,18 +11,28 @@ import json 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": { - # tool: 부를 도구 이름. 못 고르겠으면 빈 문자열. - "tool": {"type": "STRING"}, + # 부를 도구 이름. 못 고르겠으면 빈 문자열. + "tool": {"type": "string"}, + # ★ strict 모드는 모든 프로퍼티를 required 로 만든다(llm/openai._to_strict_schema). + # 그래서 안 쓰는 인자는 빈 문자열로 온다 — 도구는 "" 를 '없음' 으로 읽는다. "args": { - "type": "OBJECT", - "properties": {"key": {"type": "STRING"}, "value": {"type": "STRING"}, "keyword": {"type": "STRING"}}, + "type": "object", + "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"], } diff --git a/solution/backend/services/prompts/social.py b/solution/backend/services/prompts/social.py index 3670d45..406ea94 100644 --- a/solution/backend/services/prompts/social.py +++ b/solution/backend/services/prompts/social.py @@ -1,8 +1,11 @@ import json -RESPONSE_SCHEMA = {'type': 'OBJECT', 'properties': { - 'body': {'type': 'STRING'}, - 'fact_keys': {'type': 'ARRAY', 'items': {'type': 'STRING'}}, +# ★ 타입 이름은 소문자다. OpenAI strict 모드가 대문자('STRING')를 거부한다 — +# Gemini 는 둘 다 받아서, 대문자로 두면 **공급자를 openai 로 바꾸는 순간에만** 터진다 +# (실측 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']}