TradingAgents/docs/specs/news/tasks.md

50 lines
2.4 KiB
Markdown

# News Domain - Implementation Tasks
## Overview
**Current Status**: ~90% Complete with working production features
**Remaining Work**: 1-2 hour integration fix to connect existing components
**Architecture**: Google News → OpenRouter LLM → PostgreSQL + Dagster (All Implemented)
## Component Status
| Component | Status | Evidence |
|-----------|--------|----------|
| Google News Collection | ✅ Complete | `google_news_client.py` working |
| Article Scraping | ✅ Complete | `article_scraper_client.py` with fallbacks |
| OpenRouter LLM Client | ✅ Complete | `openrouter_client.py` sentiment + embeddings working |
| Database Storage | ✅ Complete | `news_repository.py` + migrations applied |
| NewsService Pipeline | ✅ Complete | `news_service.py` complete orchestration |
| Dagster Scheduling | ✅ Complete | `schedules.py` + `jobs.py` working |
| Dagster Operations | 🔧 Gap | Placeholders in `ops.py` instead of real OpenRouter calls |
## Remaining Tasks
### ✅ T001: Connect OpenRouter to Dagster Workflow - COMPLETE
**Priority**: Critical | **Duration**: 1-2 hours | **Dependencies**: None
**Description**: Replace placeholder sentiment and embeddings in Dagster ops with real OpenRouter client calls
**Acceptance Criteria**:
- [x] Update `fetch_and_process_article` to use real OpenRouter sentiment analysis
- [x] Update `fetch_and_process_article` to use real OpenRouter embeddings
- [x] Store sentiment_confidence, sentiment_label, title_embedding, content_embedding in database
- [x] Test complete Dagster workflow end-to-end
- [x] Verify asset materialization includes real LLM results
**Implementation Details**:
Replaced placeholders in `/tradingagents/workflows/ops.py`:
- Lines 176-179: Real OpenRouter sentiment analysis with error handling
- Lines 187-189: Real OpenRouter embeddings with fallback to zero vectors
- Lines 203-213: Store sentiment and vector fields in database via NewsArticle
**Files Modified**:
- `/tradingagents/workflows/ops.py` - Real OpenRouter integration
- `/tradingagents/domains/news/news_repository.py` - Added embedding fields to NewsArticle dataclass
- `/tests/domains/news/test_dagster_openrouter_integration.py` - Comprehensive integration tests
---
## Conclusion
The news domain is production-ready with a simple 1-2 hour integration fix. All major components are built, tested, and working - only need to connect existing OpenRouter client to existing Dagger ops.