2 Commits (9d3427e24ecf050bb22f1fb99856d0452e6f303b)

Author SHA1 Message Date
I Luk Kim 9d3427e24e fix: disable Qwen3.5 thinking mode and switch OllamaClient to sync httpx
- Add `think: False` and `num_ctx: 8192` to Ollama payload:
  Qwen3.5 extended thinking mode generated 1300+ internal reasoning
  tokens before each response, adding 30-60s latency per LLM call.
  Disabling it reduces parse time from 600s timeout to ~13s.

- Rewrite OllamaClient to use sync httpx.Client inside asyncio.to_thread():
  Async httpx inside an active asyncpg SQLAlchemy session context on
  Python 3.13 hung indefinitely. Synchronous httpx in a thread pool
  completely isolates Ollama I/O from the asyncio event loop.

- Fix filing_poller to set issuer_id/symbol_id on Document records:
  Missing FK caused feature_builder to reject all events with
  event_no_symbol warning. Now looks up IssuerMaster/SymbolMaster
  by ticker before creating Document rows.

- Update test_llm_client to mock _sync_call instead of _client attr.
- Raise ollama_timeout default to 600s for large document processing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim bbe0e31150 feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export
- libs/llm/: OllamaClient (httpx async, retry), LLMCacheStore (SHA-256 DB cache),
  prompt registry (event_classifier_v1), LLMParser (cache→prompt→validate→repair)
- libs/parser/merger.py: rule+LLM canonical merge with provenance tracking,
  conflict detection (both confident + disagree), should_queue_for_review()
- libs/db/models.py: LLMCallCache, ReviewItem, EventLabel 3개 ORM 모델 추가
- libs/db/migrations/versions/0002_phase3_tables.py: Phase 3 Alembic migration
- libs/labeler/: filing_time_bucket→reaction_date, 1D/3D/5D fwd return, MFE/MAE
- libs/review/queue.py: create(dedup)/resolve/list ReviewItem
- libs/export/snapshot_export.py: temporal split + Parquet + manifest.json
- apps/: label_generator, dataset_export, review CLI, gold set evaluator
- 42개 신규 테스트 추가 (unit 32 + integration 4 + replay 1) — 152/152 통과
- libs/common/config.py: OLLAMA_URL/MODEL/TIMEOUT 설정 추가
- libs/common/logging.py: bugfix — add_logger_name incompatible with PrintLoggerFactory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 months ago