Plugin Data Filtering & Sampling Strategies
This document explains how Auspex plugin tools filter and sample articles for analysis, and how to extend the system with new filtering strategies.
Overview
Architecture
User Request ("Partisan Analysis for __all__")
│
▼
┌─────────────────────────────────────┐
│ _should_use_tools() │ ← Keyword detection
│ (auspex_service.py) │
│ Checks for: "bias", "partisan", │
│ "future", "impact", etc. │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ _check_plugin_tools() │ ← Topic conversion
│ (auspex_service.py) │
│ Converts __all__ → None for │
│ cross-topic mode │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ tool_registry.find_matching_tools()│ ← Plugin matching
│ (tool_plugin_base.py) │
│ Matches triggers in tool.md files │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ tool_registry.execute_tool() │ ← Handler dispatch
│ Gets PromptOnlyToolHandler for │
│ the matched tool │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ PromptOnlyToolHandler.execute() │ ← Action execution
│ (tool_plugin_base.py) │
│ Runs actions defined in tool.md │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ DatabaseQueryFacade methods │ ← Data filtering
│ get_articles_with_bias_data() │
│ get_articles_with_future_signals() │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Distribution calculation │ ← Statistics
│ _get_bias_distribution_from_field()│
│ _get_future_signal_distribution() │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ LLM Prompt with {placeholders} │ ← Analysis
│ {articles}, {bias}, {future_signals}│
└─────────────────────────────────────┘Current Filtering Strategies
1. Bias Analysis (bias_analysis action)
bias_analysis action)2. Future Impact Analysis (future_impact_analysis action)
future_impact_analysis action)3. Sentiment Analysis (sentiment_analysis action)
sentiment_analysis action)4. Vector Search (default)
Cross-Topic Mode
Adding a New Filtering Strategy
Step 1: Add Database Facade Method
Step 2: Add Action Handler
Step 3: Add Distribution Method
Step 4: Create Plugin Definition
Step 5: Add Trigger Keywords
Available Article Fields
Field
Type
Description
Example Values
Best Practices
Debugging
Last updated