From eb9dc94604f79475f4ce11a4dc9b2933f633de64 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Fri, 17 Apr 2026 12:02:51 +0900 Subject: [PATCH] =?UTF-8?q?feat(search):=20E.3=20=E2=80=94=20ask=20synthes?= =?UTF-8?q?is=20prompt=20v2-600char=20bump?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 한도 400 → 600 자. baseline 관찰(partial avg 168자 / full 10%)에서 길이 제약이 실제 출력 제약이 되는 현상 확인, 절차·비교 카테고리 답변 깊이 확보 목적. 변경 4 라인: - search_synthesis.txt:17 answer 400→600 characters max - prompt_versions.py:20 v1-400char → v2-600char (telemetry) - synthesis_service.py:42 PROMPT_VERSION v1→v2 (cache key 의미론 동기화) - synthesis_service.py:46 MAX_ANSWER_CHARS 400→600 (hard clip 동기화) v1 post-tier0 baseline: 225 rows, partial 51% / insufficient 49% / full 0% (Tier 0 fix 로 full+refused=True 모순 0 건). E.6 는 이 clean baseline 을 compare-against 로 사용. 향후 티켓: PROMPT_VERSION 과 ASK_PROMPT_VERSION 단일 소스 통합. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/prompts/search_synthesis.txt | 2 +- app/services/prompt_versions.py | 2 +- app/services/search/synthesis_service.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/prompts/search_synthesis.txt b/app/prompts/search_synthesis.txt index 45737d9..1b7be7f 100644 --- a/app/prompts/search_synthesis.txt +++ b/app/prompts/search_synthesis.txt @@ -14,7 +14,7 @@ Given a query and numbered evidence spans, write a short answer that cites speci } ## Rules -- `answer`: **400 characters max**. Must contain inline `[n]` citations. Every claim sentence ends with at least one `[n]`. Multiple sources: `[1][3]`. **Only use facts present in evidence. No outside knowledge, no guessing, no paraphrasing what is not there.** +- `answer`: **600 characters max**. Must contain inline `[n]` citations. Every claim sentence ends with at least one `[n]`. Multiple sources: `[1][3]`. **Only use facts present in evidence. No outside knowledge, no guessing, no paraphrasing what is not there.** - `used_citations`: integer list of `n` values that actually appear in `answer` (for cross-check). Must be sorted ascending, no duplicates. - `confidence`: - `high`: 3+ evidence items with strong relevance diff --git a/app/services/prompt_versions.py b/app/services/prompt_versions.py index 759c134..57c877d 100644 --- a/app/services/prompt_versions.py +++ b/app/services/prompt_versions.py @@ -17,7 +17,7 @@ from __future__ import annotations # ─── ask (/search/ask) 프롬프트 버전 ───────────────────────── # synthesis_service.py 가 로드하는 app/prompts/search_synthesis.txt 기준 -ASK_PROMPT_VERSION: str = "search_synthesis.v1-400char" +ASK_PROMPT_VERSION: str = "search_synthesis.v2-600char" # ─── /analyze 프롬프트 버전 ────────────────────────────────── # documents.py analyze 라우트가 로드하는 app/prompts/document_analyze.txt 기준 diff --git a/app/services/search/synthesis_service.py b/app/services/search/synthesis_service.py index 74ac125..51248a6 100644 --- a/app/services/search/synthesis_service.py +++ b/app/services/search/synthesis_service.py @@ -39,11 +39,11 @@ if TYPE_CHECKING: logger = setup_logger("synthesis") # ─── 상수 (plan 영구 룰) ───────────────────────────────── -PROMPT_VERSION = "v1" +PROMPT_VERSION = "v2" LLM_TIMEOUT_MS = 15000 CACHE_TTL = 3600 # 1h (answer 는 원문 변경에 민감 → query_analyzer 24h 보다 짧게) CACHE_MAXSIZE = 300 -MAX_ANSWER_CHARS = 400 +MAX_ANSWER_CHARS = 600 SynthesisStatus = Literal[ "completed",