Claude commited on
Commit
7a266fa
·
1 Parent(s): cf3e707

Set default model to gpt-5-mini-2025-08-07 across all components

Browse files

Replaced all hardcoded gpt-4o-mini, gpt-4o, and gpt-5-nano defaults with
gpt-5-mini-2025-08-07 in: refactored_analyzers.py, research.py,
report_generator.py, app.py, evaluators.py, country_profiler.py,
pollster_profiler.py, politician_profiler.py, and main_pipeline.py.

CLI --model argument still overrides the default when specified.

https://claude.ai/code/session_012K59SFzJtkQR85Ekj32XCX

app.py CHANGED
@@ -157,7 +157,7 @@ def run_analysis(url: str, force_refresh: bool = False, model: str = None):
157
  "duration_seconds": round(time.time() - t0, 2),
158
  "status": "success",
159
  "details": {"outlet_name": outlet_name,
160
- "model": model or "gpt-4o-mini"}})
161
  progress.progress(75, text="Analysis complete")
162
 
163
  # 3. Generate report
@@ -172,7 +172,7 @@ def run_analysis(url: str, force_refresh: bool = False, model: str = None):
172
  "started_at": datetime.fromtimestamp(t0, tz=timezone.utc).isoformat(),
173
  "duration_seconds": round(time.time() - t0, 2),
174
  "status": "success",
175
- "details": {"model": model or "gpt-4o"}})
176
  progress.progress(90, text="Saving results...")
177
 
178
  # 4. Save
 
157
  "duration_seconds": round(time.time() - t0, 2),
158
  "status": "success",
159
  "details": {"outlet_name": outlet_name,
160
+ "model": model or "gpt-5-mini-2025-08-07"}})
161
  progress.progress(75, text="Analysis complete")
162
 
163
  # 3. Generate report
 
172
  "started_at": datetime.fromtimestamp(t0, tz=timezone.utc).isoformat(),
173
  "duration_seconds": round(time.time() - t0, 2),
174
  "status": "success",
175
+ "details": {"model": model or "gpt-5-mini-2025-08-07"}})
176
  progress.progress(90, text="Saving results...")
177
 
178
  # 4. Save
country_profiler.py CHANGED
@@ -116,7 +116,7 @@ class CountryProfiler:
116
  ECONOMIC_WEIGHT = 0.70
117
  SOCIAL_WEIGHT = 0.30
118
 
119
- def __init__(self, model: str = "gpt-4o-mini", temperature: float = 0.0):
120
  self.llm = ChatOpenAI(model=model, temperature=temperature)
121
 
122
  def _score_to_bias_label(self, score: float) -> str:
 
116
  ECONOMIC_WEIGHT = 0.70
117
  SOCIAL_WEIGHT = 0.30
118
 
119
+ def __init__(self, model: str = "gpt-5-mini-2025-08-07", temperature: float = 0.0):
120
  self.llm = ChatOpenAI(model=model, temperature=temperature)
121
 
122
  def _score_to_bias_label(self, score: float) -> str:
evaluators.py CHANGED
@@ -249,7 +249,7 @@ class CoTWrapper(BaseModel):
249
  class BaseRunner:
250
  """Base class for all evaluation runners."""
251
 
252
- def __init__(self, model_name: str = "gpt-5-nano-2025-08-07"):
253
  self.model_name = model_name
254
  # LangChain client for structured output
255
  self.llm = ChatOpenAI(model=model_name, temperature=0.0)
@@ -414,7 +414,7 @@ NewsGuard, or any other bias-rating service anywhere in your response.
414
  class LLMArticlesRunner(BaseRunner):
415
  """Scenario 2: LLM + 20 scraped articles + fact-check search."""
416
 
417
- def __init__(self, model_name: str = "gpt-5-nano-2025-08-07", max_articles: int = 20,
418
  article_cache=None):
419
  super().__init__(model_name)
420
  self.max_articles = max_articles
@@ -654,7 +654,7 @@ class MBCRunner(BaseRunner):
654
  matching the paper's incremental expansion approach.
655
  """
656
 
657
- def __init__(self, model_name: str = "gpt-5-nano-2025-08-07"):
658
  super().__init__(model_name)
659
  self.queries_path = os.path.join("data", "queries.json")
660
  # Fallback queries if file is missing (based on Appendix E of the paper)
@@ -898,7 +898,7 @@ class SystemRunner(BaseRunner):
898
  compliant scoring. Set benchmark_mode=False for strict methodology mode.
899
  """
900
 
901
- def __init__(self, model_name: str = "gpt-5-nano-2025-08-07", article_cache=None,
902
  benchmark_mode: bool = True, use_synthesis: bool = True,
903
  use_calibration: bool = True):
904
  super().__init__(model_name)
@@ -1518,7 +1518,7 @@ class HybridRunner(SystemRunner):
1518
  2. Always uses LLM synthesis (inherits from SystemRunner with use_synthesis=True).
1519
  """
1520
 
1521
- def __init__(self, model_name: str = "gpt-5-nano-2025-08-07", article_cache=None,
1522
  benchmark_mode: bool = True, use_synthesis: bool = True,
1523
  use_calibration: bool = True):
1524
  # HybridRunner always uses synthesis
 
249
  class BaseRunner:
250
  """Base class for all evaluation runners."""
251
 
252
+ def __init__(self, model_name: str = "gpt-5-mini-2025-08-07"):
253
  self.model_name = model_name
254
  # LangChain client for structured output
255
  self.llm = ChatOpenAI(model=model_name, temperature=0.0)
 
414
  class LLMArticlesRunner(BaseRunner):
415
  """Scenario 2: LLM + 20 scraped articles + fact-check search."""
416
 
417
+ def __init__(self, model_name: str = "gpt-5-mini-2025-08-07", max_articles: int = 20,
418
  article_cache=None):
419
  super().__init__(model_name)
420
  self.max_articles = max_articles
 
654
  matching the paper's incremental expansion approach.
655
  """
656
 
657
+ def __init__(self, model_name: str = "gpt-5-mini-2025-08-07"):
658
  super().__init__(model_name)
659
  self.queries_path = os.path.join("data", "queries.json")
660
  # Fallback queries if file is missing (based on Appendix E of the paper)
 
898
  compliant scoring. Set benchmark_mode=False for strict methodology mode.
899
  """
900
 
901
+ def __init__(self, model_name: str = "gpt-5-mini-2025-08-07", article_cache=None,
902
  benchmark_mode: bool = True, use_synthesis: bool = True,
903
  use_calibration: bool = True):
904
  super().__init__(model_name)
 
1518
  2. Always uses LLM synthesis (inherits from SystemRunner with use_synthesis=True).
1519
  """
1520
 
1521
+ def __init__(self, model_name: str = "gpt-5-mini-2025-08-07", article_cache=None,
1522
  benchmark_mode: bool = True, use_synthesis: bool = True,
1523
  use_calibration: bool = True):
1524
  # HybridRunner always uses synthesis
main_pipeline.py CHANGED
@@ -95,7 +95,7 @@ if __name__ == "__main__":
95
  parser = argparse.ArgumentParser(description="Media Bias Analysis Pipeline")
96
  parser.add_argument("url", help="The URL of the news site to analyze")
97
  parser.add_argument("--refresh", action="store_true", help="Ignore cache and force re-analysis")
98
- parser.add_argument("--model", type=str, default=None, help="LLM model to use (e.g. gpt-4o, gpt-4.1)")
99
 
100
  args = parser.parse_args()
101
 
 
95
  parser = argparse.ArgumentParser(description="Media Bias Analysis Pipeline")
96
  parser.add_argument("url", help="The URL of the news site to analyze")
97
  parser.add_argument("--refresh", action="store_true", help="Ignore cache and force re-analysis")
98
+ parser.add_argument("--model", type=str, default=None, help="LLM model to use (default: gpt-5-mini-2025-08-07)")
99
 
100
  args = parser.parse_args()
101
 
politician_profiler.py CHANGED
@@ -112,7 +112,7 @@ class PoliticianProfiler:
112
  Factuality: 100% from failed fact checks by IFCN-approved checkers
113
  """
114
 
115
- def __init__(self, model: str = "gpt-4o-mini", temperature: float = 0.0,
116
  search_backend=None):
117
  self.llm = ChatOpenAI(model=model, temperature=temperature)
118
  self.weights = PoliticianBiasWeights()
 
112
  Factuality: 100% from failed fact checks by IFCN-approved checkers
113
  """
114
 
115
+ def __init__(self, model: str = "gpt-5-mini-2025-08-07", temperature: float = 0.0,
116
  search_backend=None):
117
  self.llm = ChatOpenAI(model=model, temperature=temperature)
118
  self.weights = PoliticianBiasWeights()
pollster_profiler.py CHANGED
@@ -109,7 +109,7 @@ class PollsterProfiler:
109
  Credibility: Standard MBFC methodology (assessed separately)
110
  """
111
 
112
- def __init__(self, model: str = "gpt-4o-mini", temperature: float = 0.0,
113
  search_backend=None):
114
  self.llm = ChatOpenAI(model=model, temperature=temperature)
115
  self.weights = PollsterBiasWeights()
 
109
  Credibility: Standard MBFC methodology (assessed separately)
110
  """
111
 
112
+ def __init__(self, model: str = "gpt-5-mini-2025-08-07", temperature: float = 0.0,
113
  search_backend=None):
114
  self.llm = ChatOpenAI(model=model, temperature=temperature)
115
  self.weights = PollsterBiasWeights()
refactored_analyzers.py CHANGED
@@ -79,7 +79,7 @@ logger = logging.getLogger(__name__)
79
  # =============================================================================
80
 
81
 
82
- def get_llm(model: str = "gpt-5-nano", temperature: float = 0.0) -> ChatOpenAI:
83
  """
84
  Get a configured LLM instance.
85
 
@@ -154,7 +154,7 @@ Analyze the CONTENT and STYLE, not the URL or publication name."""
154
 
155
  def __init__(
156
  self,
157
- model: str = "gpt-4o-mini",
158
  temperature: float = 0.0,
159
  max_text_chars: int = 1000,
160
  ):
@@ -372,7 +372,7 @@ Look for indicators like:
372
 
373
  def __init__(
374
  self,
375
- model: str = "gpt-4o-mini",
376
  temperature: float = 0.0,
377
  tranco_path: Optional[str] = None,
378
  auto_download_tranco: bool = True,
@@ -863,7 +863,7 @@ For example, NYT is a NEWSPAPER even though they have a website and podcasts."""
863
 
864
  def __init__(
865
  self,
866
- model: str = "gpt-4o-mini",
867
  temperature: float = 0.0,
868
  lookup_path: Optional[str] = None,
869
  search_backend=None,
@@ -1225,7 +1225,7 @@ If results are about fact checks OF specific claims MADE BY the outlet, those ar
1225
 
1226
  def __init__(
1227
  self,
1228
- model: str = "gpt-4o-mini",
1229
  temperature: float = 0.0,
1230
  sites: list[str] | None = None,
1231
  search_backend=None,
@@ -1481,7 +1481,7 @@ You must also detect **Vague Sourcing** or "Anonymous Authority".
1481
 
1482
  def __init__(
1483
  self,
1484
- model: str = "gpt-4o-mini",
1485
  temperature: float = 0.0,
1486
  ):
1487
  self.llm = get_llm(model, temperature).with_structured_output(SourcingLLMOutput)
@@ -1883,7 +1883,7 @@ If the outlet is a peer-reviewed scientific journal, academic publisher, or evid
1883
 
1884
  def __init__(
1885
  self,
1886
- model: str = "gpt-4o-mini",
1887
  temperature: float = 0.0,
1888
  ):
1889
  """
@@ -2255,7 +2255,7 @@ NONE_DETECTED: No pseudoscience content found
2255
 
2256
  def __init__(
2257
  self,
2258
- model: str = "gpt-4o-mini",
2259
  temperature: float = 0.0,
2260
  ):
2261
  """
@@ -2421,7 +2421,7 @@ If no evidence of transparency is found (no about page, no ownership disclosure,
2421
 
2422
  def __init__(
2423
  self,
2424
- model: str = "gpt-4o-mini",
2425
  temperature: float = 0.0,
2426
  search_backend=None,
2427
  ):
@@ -2605,7 +2605,7 @@ Base your assessment ONLY on the article content provided."""
2605
 
2606
  def __init__(
2607
  self,
2608
- model: str = "gpt-4o-mini",
2609
  temperature: float = 0.0,
2610
  ):
2611
  self.llm = get_llm(model, temperature).with_structured_output(OneSidednessLLMOutput)
 
79
  # =============================================================================
80
 
81
 
82
+ def get_llm(model: str = "gpt-5-mini-2025-08-07", temperature: float = 0.0) -> ChatOpenAI:
83
  """
84
  Get a configured LLM instance.
85
 
 
154
 
155
  def __init__(
156
  self,
157
+ model: str = "gpt-5-mini-2025-08-07",
158
  temperature: float = 0.0,
159
  max_text_chars: int = 1000,
160
  ):
 
372
 
373
  def __init__(
374
  self,
375
+ model: str = "gpt-5-mini-2025-08-07",
376
  temperature: float = 0.0,
377
  tranco_path: Optional[str] = None,
378
  auto_download_tranco: bool = True,
 
863
 
864
  def __init__(
865
  self,
866
+ model: str = "gpt-5-mini-2025-08-07",
867
  temperature: float = 0.0,
868
  lookup_path: Optional[str] = None,
869
  search_backend=None,
 
1225
 
1226
  def __init__(
1227
  self,
1228
+ model: str = "gpt-5-mini-2025-08-07",
1229
  temperature: float = 0.0,
1230
  sites: list[str] | None = None,
1231
  search_backend=None,
 
1481
 
1482
  def __init__(
1483
  self,
1484
+ model: str = "gpt-5-mini-2025-08-07",
1485
  temperature: float = 0.0,
1486
  ):
1487
  self.llm = get_llm(model, temperature).with_structured_output(SourcingLLMOutput)
 
1883
 
1884
  def __init__(
1885
  self,
1886
+ model: str = "gpt-5-mini-2025-08-07",
1887
  temperature: float = 0.0,
1888
  ):
1889
  """
 
2255
 
2256
  def __init__(
2257
  self,
2258
+ model: str = "gpt-5-mini-2025-08-07",
2259
  temperature: float = 0.0,
2260
  ):
2261
  """
 
2421
 
2422
  def __init__(
2423
  self,
2424
+ model: str = "gpt-5-mini-2025-08-07",
2425
  temperature: float = 0.0,
2426
  search_backend=None,
2427
  ):
 
2605
 
2606
  def __init__(
2607
  self,
2608
+ model: str = "gpt-5-mini-2025-08-07",
2609
  temperature: float = 0.0,
2610
  ):
2611
  self.llm = get_llm(model, temperature).with_structured_output(OneSidednessLLMOutput)
report_generator.py CHANGED
@@ -7,7 +7,7 @@ from langchain_openai import ChatOpenAI
7
  from schemas import ComprehensiveReportData
8
 
9
  class ReportGenerator:
10
- def __init__(self, model: str = "gpt-4o", temperature: float = 0.4):
11
  self.llm = ChatOpenAI(model=model, temperature=temperature)
12
 
13
  def generate(self, data: ComprehensiveReportData) -> str:
 
7
  from schemas import ComprehensiveReportData
8
 
9
  class ReportGenerator:
10
+ def __init__(self, model: str = "gpt-5-mini-2025-08-07", temperature: float = 0.4):
11
  self.llm = ChatOpenAI(model=model, temperature=temperature)
12
 
13
  def generate(self, data: ComprehensiveReportData) -> str:
research.py CHANGED
@@ -168,7 +168,7 @@ Include up to 3-5 most relevant and credible analyses."""
168
 
169
  def __init__(
170
  self,
171
- model: str = "gpt-4o-mini",
172
  temperature: float = 0.0,
173
  search_backend=None,
174
  ):
@@ -1070,7 +1070,7 @@ class MediaProfiler:
1070
 
1071
  def __init__(
1072
  self,
1073
- model: str = "gpt-4o-mini",
1074
  temperature: float = 0.0,
1075
  search_backend=None,
1076
  use_calibration: bool = True,
 
168
 
169
  def __init__(
170
  self,
171
+ model: str = "gpt-5-mini-2025-08-07",
172
  temperature: float = 0.0,
173
  search_backend=None,
174
  ):
 
1070
 
1071
  def __init__(
1072
  self,
1073
+ model: str = "gpt-5-mini-2025-08-07",
1074
  temperature: float = 0.0,
1075
  search_backend=None,
1076
  use_calibration: bool = True,