feat: system prompt kind별 그룹화 + disambiguation 개선#244
Merged
seyoung4503 merged 8 commits intoJul 19, 2026
Conversation
비즈니스 용어를 Metric/Table/Rule/Dimension으로 분류할 수 있도록 FedEntry에 kind, applies_to, tags 필드를 추가한다. - FedEntry: kind, applies_to, tags 필드 추가 (기존 JSON 하위호환) - term_custom tool spec: 세 파라미터 노출 - _fmt_entry: kind 배지 표시 (`metric` 등) - 신규 테스트 3개: round-trip, 하위호환, kind 배지 렌더링 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pre-commit black check (--all-files) was consistently failing on master and all PR branches. This commit formats all Python files to make CI green. No logic changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Google OKF 스펙을 따라 KV 용어를 .md 파일로 내보내고 불러오는 OkfBundle 어댑터를 추가한다. - adapters/storage/okf_bundle.py 신규: export/import, kind별 폴더 라우팅 - pyproject.toml: PyYAML 의존성 추가 - 신규 테스트 9개: 직렬화 단위, 폴더 구조, round-trip Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ingest_doc: 추출된 후보를 KV에 pending_ingest:{ref} 키로 임시 저장
- confirm_ingest: pending 후보를 FedEntry로 변환해 KV 등록 (all/인덱스 선택)
- OKF_BUNDLE_DIR env var 설정 시 confirm 후 OkfBundle로 자동 export
- HarnessContext.okf_bundle_dir 필드 추가 (ContextConcierge가 env에서 주입)
- 테스트 14개 신규 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- confirm_ingest: FedEntry 등록 성공 후 pending_ingest:{ref} 키 삭제
- ingest_doc: content 인라인 입력 시 ref를 md5 해시 기반으로 고유화
('inline' 고정 → 'inline:{md5[:8]}')하여 연속 ingestion 시 키 충돌 방지
- 테스트: pending 키 삭제 검증 케이스 추가
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- build_prompt_section: metric/dimension/rule/table 그룹별 헤더와 SQL 활용 힌트 추가 (Metrics → SELECT/HAVING, Rules → WHERE AND, Dimensions → GROUP BY) - _AMBIGUOUS_TERM_POLICY: 미등록 용어 등록 시 kind 확인 요청 포함 - _resolve_entry 추가 (FedEntry 반환), _tag_for 파라미터 정리 - _resolve_term 제거 (내부 중복, _render_effective에서 직접 _resolve_entry 사용) - 테스트 8개 추가 (그룹핑, SQL 힌트 포함, 기타 폴백, 빈 그룹 스킵, _resolve_entry) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
#241 → #244 스택 통합 리뷰4개가 하나의 흐름이라 최종 상태( 잘 되는 것
머지 전 수정 (전부 #243에서)1. 전사(guild) 용어를 아무나 등록할 수 있습니다 —
2. 빈 channel_id 가드 누락 —
3.
4. 번들 파일 경로 검증 없음 —
5. 정의에
후속 PR
머지 순서
테스트
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ Issue Number
없음
📝 요약(Summary)
한 줄 요약: 등록된 비즈니스 용어를 종류별로 분류해 시스템 프롬프트에 주입함으로써, LLM이 각 용어를 SQL 어느 절에 써야 하는지 명확하게 판단할 수 있게 합니다.
해결하려는 문제
PR1에서 용어에
kind(metric/rule/dimension/table)를 추가했지만, 시스템 프롬프트에는 여전히 모든 용어가 한 덩어리로 나열됐습니다.기존 프롬프트:
LLM이
metric은 SELECT에,rule은 WHERE에 쓴다는 판단을 스스로 해야 했습니다.이번 변경으로 달라지는 것
변경 후 프롬프트:
kind가 없는 용어는
### 기타그룹으로, 등록되지 않은 kind 그룹은 헤더 자체가 생략됩니다.Ambiguous Term Policy 개선
미등록 용어를 처음 만났을 때 LLM이 사용자에게 묻는 방식도 개선했습니다.
기존: "이 정의를 어느 범위로 등록할까요?"
변경: "metric/rule/dimension/table 중 어느 종류이며, 어느 범위로 등록할까요?"
PR1에서
term_custom에kind파라미터를 추가했으므로, 이제 LLM이 등록 시 kind까지 함께 지정할 수 있습니다.다음 PR과의 관계
이 PR이 시리즈의 마지막입니다.
💬 To Reviewers
이 PR은 총 4개로 구성된 시리즈의 네 번째(마지막)입니다. PR3 머지 후 순차 머지 부탁드립니다.
_resolve_term내부 함수를 제거하고_resolve_entry로 통합했습니다.bench/ecommerce_demo.py에서 미사용 import를 제거했습니다._KIND_SQL_HINT)는 한국어로 작성했습니다. 영어 통일이 필요하다면 말씀해 주세요.PR Checklist