ping: JSON 이 안 나오면 설정 조합을 바꿔가며 자동 진단, LLM_MERGE_SYSTEM 옵션

- 게이트웨이/모델이 system 역할을 무시해 평문으로 답하는 경우(팀원 VM /api/ito + 339 실측)
  LLM_MERGE_SYSTEM=1 로 system 을 user 앞에 합쳐 보낸다
- summarize.ping 이 (그대로 → merge → merge+json_mode off) 순으로 시도해 되는 .env 값을 알려준다. --real 은 실제 조각 추출 프롬프트로

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
byeongwook.choi
2026-09-21 15:52:29 +09:00
co-authored by Claude Fable 5.1
parent 0f70c0d245
commit db50ec9d46
5 changed files with 95 additions and 39 deletions
+11
View File
@@ -263,3 +263,14 @@ def test_provider_requires_its_credentials(monkeypatch):
_configure(monkeypatch, llm_provider="bogus", llm_api_key="k")
with pytest.raises(RuntimeError):
llm_client.OpenAICompatClient()
def test_merge_system_folds_system_into_user(monkeypatch):
from config.settings import settings
from summarize import llm_client
_configure(monkeypatch, llm_api_key="k")
monkeypatch.setattr(settings, "llm_merge_system", True)
msgs = llm_client.OpenAICompatClient().body("SYS", "USR")["messages"]
assert msgs == [{"role": "user", "content": "SYS\n\nUSR"}]
monkeypatch.setattr(settings, "llm_merge_system", False)
assert [m["role"] for m in llm_client.OpenAICompatClient().body("SYS", "USR")["messages"]] == ["system", "user"]