Repository navigation
[Feat] LLM 분석 설명 근거 검증 내부 API 구현 - #43
boogiewooki02 wants to merge 8 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
| configured = get_verification_settings().ANALYSIS_CALLBACK_INTERNAL_TOKEN | ||
| if not configured or not configured.strip(): | ||
| raise HTTPException(status.HTTP_503_SERVICE_UNAVAILABLE, "Verification authentication is not configured") | ||
| if x_internal_token is None or not hmac.compare_digest( |
There was a problem hiding this comment.
기존 app/api/dependencies.py의 verify_internal_token과 헤더 추출·토큰 비교 로직이 겹쳐서 공통 토큰 비교 로직으로 빼거나 토큰 미설정 시 정책을 명시적으로 구분하는 공통 의존성으로 정리하는 게 어떨까요?
|
|
||
| @lru_cache | ||
| def get_verification_redis() -> Redis: | ||
| return Redis.from_url(get_verification_settings().REDIS_URL) |
There was a problem hiding this comment.
이 부분도 기존 app/jobs/queue.py의 Redis 연결 생성과 거의 같은 구현이라서 로직 공통화할 수 있을 거 같습니다~
다만 검증 설정은 .env.verification에서 별도로 덮어쓸 수 있으므로 기존 분석 연결을 그대로 재사용하면 설정 의미가 달라질 수 있어서 이 부분은 연결 팩토리를 두는 게 좋을 거 같아요!
|
|
||
| def run_worker() -> None: | ||
| logging.basicConfig(level=logging.INFO) | ||
| worker = VerificationWorker( |
There was a problem hiding this comment.
여기도 기존 app/jobs/worker.py와 Worker 초기화 구조가 유사한 거 같은데, 따로 만드신 이유가 있을까요??
없다면 큐·serializer·Worker 클래스를 받는 실행 헬퍼는 따로 공통 로직으로 빼도 될 거 같습니다!
| raise VerificationIntegrityError("Citation ID or quote does not match the evidence") | ||
|
|
||
| for field, text in answer.items(): | ||
| if any(not covered and not char.isspace() for char, covered in zip(text, coverage[field])): |
There was a problem hiding this comment.
현재 커버리지 검사는 sourceText가 원문을 덮는지만 확인하고, claim이 해당 원문의 모든 주장을 보존하는지는 확인하지 않는 거 같아요!
예를 들어 전체 문장을 sourceText에 넣고 claim에는 일부 주장만 적어도 이 검사를 통과할 수 있는 거 같습니다.. 인용문 검사도 근거 안에 해당 문자열이 존재하는지 확인하는 수준이라 의미적 뒷받침은 LLM에 의존하는 거 같은데, 보장 범위를 문서에 명시하고, 복합 주장·조건·부정 표현에 대한 실제 모델 평가 사례를 추가하는 것도 좋을 거 같습니당
close #41
🔎 개요
LLM이 생성한 보안 분석 설명을 코드·탐지 결과·RAG 근거와 대조하는 내부 검증 API 구현
📝 작업 내용
👀 변경 사항
X-Internal-Token필수✅ 체크리스트
💬 고민사항 및 리뷰 요구사항
Summary by CodeRabbit