Multi-stage evidence-grounded inference architecture replacing the monolithic 9B model extraction pipeline. CPU-first specialist services handle routine extraction while the 9B vLLM model is preserved for semantic adjudication of ambiguous cases. Key components: - Capability-aware inference gateway (OpenAI-compatible + Ollama) - Endpoint registry with DB migrations and REST API - Sentence-aware document segmenter (property tests) - Deterministic financial parsing with offset integrity - Symbol resolution with ambiguity detection - Specialist service (GLiNER2, dynamic batching, K8s deployment) - Company-specific sentiment (FinBERT, calibration) - Retrieval-based novelty and duplicate detection - Confidence calibration pipeline - Deterministic routing engine (property tests) - 9B adjudication layer with VRAM gating - Stock-specific impact model (features, labels, baseline, trained) - Pipeline orchestrator (state machine, queues, leases, feature flags) - Bounded parallelism (async workers, semaphore, load shedding) - Observability (tracing, metrics, alerts) - Compatibility adapter (v3→v2 golden mapping tests) - Shadow/canary promotion framework - Active learning and fine-tuning pipeline Test results: 1,161 tests pass, ruff lint clean. All 282 spec tasks completed.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""Company-specific financial sentiment analysis.
|
|
|
|
This package provides FinBERT-based sentiment classification
|
|
on company-linked evidence groups, producing per-company probability
|
|
distributions with full evidence provenance.
|
|
"""
|
|
|
|
from services.intelligence_pipeline_v3.sentiment.aggregation import (
|
|
aggregate_evidence_sentiments,
|
|
)
|
|
from services.intelligence_pipeline_v3.sentiment.calibrator import SentimentCalibrator
|
|
from services.intelligence_pipeline_v3.sentiment.evidence_groups import build_evidence_groups
|
|
from services.intelligence_pipeline_v3.sentiment.finbert_adapter import FinBERTAdapter
|
|
from services.intelligence_pipeline_v3.sentiment.mixed_sentiment import compute_mixed_sentiment
|
|
from services.intelligence_pipeline_v3.sentiment.models import (
|
|
CompanySentimentResult,
|
|
EvidenceGroup,
|
|
SentimentBatchResult,
|
|
TextSentiment,
|
|
)
|
|
from services.intelligence_pipeline_v3.sentiment.sentiment_scorer import (
|
|
SentimentModel,
|
|
SentimentScorer,
|
|
)
|
|
|
|
__all__ = [
|
|
"SentimentCalibrator",
|
|
"SentimentModel",
|
|
"SentimentScorer",
|
|
"CompanySentimentResult",
|
|
"EvidenceGroup",
|
|
"FinBERTAdapter",
|
|
"SentimentBatchResult",
|
|
"TextSentiment",
|
|
"aggregate_evidence_sentiments",
|
|
"build_evidence_groups",
|
|
"compute_mixed_sentiment",
|
|
]
|