추출 프롬프트에 전역 grounding 규칙 추가 - #29
Conversation
- 기존 "DO NOT GUESS" 는 Strategy 3(가격)에 국한돼 있었고, 빈 셸 환각 사고(에이블리 mobile.*, 15회 중 8회 창작)에서 flash-lite 가 이 지시를 절반가량만 따르는 것이 실측됐다. 극한(빈 입력)은 #26 게이트가 결정론으로 막았으므로, 이 규칙은 남은 표면 - 내용이 일부 있는 페이지에서 없는 필드를 채워 넣는 창작 - 을 겨냥한다 - 전역 규칙을 프롬프트 서두에 승격: 모든 출력 값은 제공된 HTML 에 존재해야 하고, 없으면 null(상품 자체가 없으면 isProductPage=false). 기억·유사 상품에서 회상한 값 생성을 명시적으로 금지하고 "창작이 null 보다 엄격히 나쁘다"는 우선순위를 박는다 - imageUrl 필드에도 개별 강화: URL(또는 resolve 전 상대경로)이 HTML 에 실재해야 하며 조립·축약 금지. 사고에서 창작된 이미지가 전부 NXDOMAIN/403 이었던 것의 직접 대응이며, 보류 중인 출력 대조(grounding 검증) PR 이 들어오기 전까지의 확률적 방어층이다 - 효과 측정은 dev 모델 실험(gemini-3.6-flash, extraction_models)과 함께 via=llm 대비 UNTRUSTWORTHY_VALUE·INCOMPLETE_SNAPSHOT 비율로 본다
📝 WalkthroughWalkthrough
ChangesGemini HTML 근거 규칙
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/depromeet/piki/extractor/extraction/gemini/GeminiExtractionRequest.java`:
- Around line 59-65: Update the currency guidance in the GeminiExtractionRequest
prompt so it follows the highest-priority grounding rule: return null when the
HTML lacks an explicit currency code or unambiguous currency symbol, and remove
any permission to infer currency from page language or locale.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d8762f13-c04b-4225-8218-540c09c5fc0d
📒 Files selected for processing (1)
src/main/java/com/depromeet/piki/extractor/extraction/gemini/GeminiExtractionRequest.java
| **Grounding rule (highest priority, applies to every field)**: | ||
| Every value you output MUST be taken from the provided HTML. If a value is not present | ||
| in the HTML, return null for that field (or isProductPage=false if the page shows no | ||
| product at all). NEVER invent, guess, or recall values from memory or from similar | ||
| products you have seen elsewhere. A fabricated value is the worst possible outcome — | ||
| strictly worse than null. | ||
|
|
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
currency 추론 규칙과의 충돌을 해소해야 합니다.
Line 59-65는 모든 출력값을 제공된 HTML에서만 가져오도록 요구합니다. 그러나 Line 86은 HTML에서 통화가 모호하면 페이지 언어 또는 locale로 currency를 추론하도록 허용합니다. 이 경우 모델이 HTML에 없는 통화 코드를 출력할 수 있습니다.
HTML에 통화 코드나 모호하지 않은 통화 표기가 없으면 null을 반환하도록 Line 86을 수정해야 합니다.
수정 예시
- 4. currency (string): ISO 4217 code (KRW, USD, JPY, EUR, etc.). Infer from page language/locale if ambiguous.
+ 4. currency (string): ISO 4217 code only when the code or an unambiguous currency marker appears in the HTML. If the currency is absent or ambiguous, return null.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/com/depromeet/piki/extractor/extraction/gemini/GeminiExtractionRequest.java`
around lines 59 - 65, Update the currency guidance in the
GeminiExtractionRequest prompt so it follows the highest-priority grounding
rule: return null when the HTML lacks an explicit currency code or unambiguous
currency symbol, and remove any permission to infer currency from page language
or locale.
Situation
Task
Action
Result
연관 이슈
Summary by CodeRabbit
null로 처리하고, 상품 페이지가 아니면 이를 명확히 표시합니다.