Skip to content

[DP-384] 수집 동향 LLM 서사 요약 구현 (collection_summary, 주/월 단위)#56

Merged
suheon98 merged 1 commit intodevelopV2from
feature/DP-384-trend-collection-summary
Apr 24, 2026
Merged

[DP-384] 수집 동향 LLM 서사 요약 구현 (collection_summary, 주/월 단위)#56
suheon98 merged 1 commit intodevelopV2from
feature/DP-384-trend-collection-summary

Conversation

@suheon98
Copy link
Copy Markdown
Collaborator

Summary

  • TrendSignals 데이터클래스 신규 정의 — unit, period_start/end, cur/prev_content_count, top_tags(TagFrequency), tfidf_keywords, prev_summary 필드 포함, 오케스트레이터(DP-386)가 조립
  • app/core/prompts/trend_collection.py 신규 — SYSTEM_PROMPT(수치 인용·키워드 자연 서술 원칙) + build_user_prompt(signals) + Tool Use 스키마
  • CollectionSummaryGenerator.generate(signals) 신규 — unit="daily" → None, LLM 실패 → None 반환, tool_use 없음 → AIInternalError 전파
  • prev_summary 옵셔널 주입으로 이전 기간 대비 차이점 서술 지원 (DP-404 패턴 동일)

집계 방식

일 단위 집계 없이 주/월 범위 DB 직접 쿼리 채택 — TrendDataLoader.load(start, end) 가 임의 날짜 범위를 이미 지원하므로 별도 인프라 불필요.

Test plan

  • pytest tests/test_trend_collection_summary.py — 7개 케이스 통과 확인
    • 정상 반환 / daily → None(API 미호출) / LLM 실패 → None / 수집 글 수 프롬프트 포함 / 태그 통계 포함 / prev_summary 주입 / tool_use 없음 → AIInternalError
  • pytest -q 전체 406개 통과
  • ruff check . && black --check . 클린

🤖 Generated with Claude Code

- TrendSignals 데이터클래스 정의 (unit/period/content_count/top_tags/tfidf_keywords/prev_summary)
- CollectionSummaryGenerator.generate(): daily → None, LLM 실패 → None, tool_use 없음 → AIInternalError
- build_user_prompt(): 태그 빈도·증감 테이블 + 신규/급증 태그 + 수집 글 키워드 포함
- 이전 기간 prev_summary 주입 지원 (변화 비교 서술 유도)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@suheon98 suheon98 merged commit ee9447c into developV2 Apr 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant