SilverElixir commited on
Commit
2ae6891
·
1 Parent(s): 5fecfef

Drop dead Gemini 3.x line from chains, sante heads light order

Browse files
lumen_router_config.py CHANGED
@@ -80,7 +80,7 @@ GEMINI_MODELS: dict[str, dict[str, Any]] = {
80
  "no_search": True, "stream": True, "url_context": True,
81
  },
82
  }
83
- DEFAULT_GEMINI_MODEL = "gemini-3.8-flash"
84
 
85
  # ── TTS-модели (аудит техдолга, август 2026) ──
86
  GEMINI_TTS_MODELS: list[str] = ["gemini-3.1-flash-tts-preview", "gemini-2.5-flash-preview-tts"]
@@ -384,10 +384,12 @@ def _groq_route(models: list[str]) -> list[tuple[str, str]]:
384
  # Порядок по аудитам 22.08/17.09.2026; nex-mini повышен продом 17.09.2026, снят
385
  # 05.10.2026 (платная отсечка — см. _OR_MODEL_HEALTH): второй стала sante.
386
  # 08.10.2026: fin и qwen3.8-27b:free сняты той же отсечкой — убраны из цепочки.
 
 
387
  _OR_LIGHT_ORDER: list[str] = [
388
- "nvidia/nemotron-3.5-lightning:free",
389
  "inclusionai/ling-3.0-flash-sante:free",
390
  "liquid/lfm-2.5-2.6b:free",
 
391
  "openrouter/free",
392
  ]
393
 
@@ -415,31 +417,24 @@ _OR_VISION_ORDER: list[str] = [
415
  "google/gemma-4-26b-a4b-it:free",
416
  ]
417
 
418
- # ── Цепочки Gemini, где нужен именно Gemini. Голова — 3.8-flash (аудит 17.09.2026).
 
 
 
419
  GEMINI_HEAVY_CHAIN: list[str] = [
420
- "gemini-3.8-flash",
421
- "gemini-3.7-flash",
422
- "gemini-3.6-flash",
423
- "gemini-3.5-flash",
424
- "gemini-3-flash-preview",
425
- "gemini-3.5-flash-lite",
426
- "gemini-3.1-flash-lite",
427
  "gemini-2.5-flash",
428
  "gemini-2.5-flash-lite",
 
 
429
  "gemma-4-31b-it",
430
  "gemma-4-26b-a4b-it",
431
  ]
432
- # Сначала модели с реальной квотой search grounding (2.5-flash/lite), линейка 3.x — резервом (ответ по знаниям/url_context).
433
  GEMINI_SEARCH_CHAIN: list[str] = [
434
  "gemini-2.5-flash",
435
  "gemini-2.5-flash-lite",
436
  "gemini-3.5-flash-lite",
437
  "gemini-3.1-flash-lite",
438
- "gemini-3.8-flash",
439
- "gemini-3.7-flash",
440
- "gemini-3.6-flash",
441
- "gemini-3.5-flash",
442
- "gemini-3-flash-preview",
443
  ]
444
  # Дефолт для прямых вызовов ask_gemini без явной цепочки.
445
  # Копия, а не алиас: раньше правка дефолта молча меняла тяжёлую цепочку (аудит 26.09.2026).
 
80
  "no_search": True, "stream": True, "url_context": True,
81
  },
82
  }
83
+ DEFAULT_GEMINI_MODEL = "gemini-2.5-flash"
84
 
85
  # ── TTS-модели (аудит техдолга, август 2026) ──
86
  GEMINI_TTS_MODELS: list[str] = ["gemini-3.1-flash-tts-preview", "gemini-2.5-flash-preview-tts"]
 
384
  # Порядок по аудитам 22.08/17.09.2026; nex-mini повышен продом 17.09.2026, снят
385
  # 05.10.2026 (платная отсечка — см. _OR_MODEL_HEALTH): второй стала sante.
386
  # 08.10.2026: fin и qwen3.8-27b:free сняты той же отсечкой — убраны из цепочки.
387
+ # 08.10.2026: голова — sante (фактически отвечает в проде), nemotron-3.5-lightning
388
+ # понижен в хвост (таймауты в проде 07.10.2026) — резервом перед openrouter/free.
389
  _OR_LIGHT_ORDER: list[str] = [
 
390
  "inclusionai/ling-3.0-flash-sante:free",
391
  "liquid/lfm-2.5-2.6b:free",
392
+ "nvidia/nemotron-3.5-lightning:free",
393
  "openrouter/free",
394
  ]
395
 
 
417
  "google/gemma-4-26b-a4b-it:free",
418
  ]
419
 
420
+ # ── Цепочки Gemini, где нужен именно Gemini. Вся линейка 3.x убрана 08.10.2026:
421
+ # прод 05.10.2026 — HTTP 503 "model unavailable" на 3.8/3.7/3.6/3.5-flash и
422
+ # 3-flash-preview разом (жива только ветка 2.5). Конфиги в GEMINI_MODELS и ID в
423
+ # детекте утечек оставлены: если дашборд покажет их живыми — вернуть в цепочки.
424
  GEMINI_HEAVY_CHAIN: list[str] = [
 
 
 
 
 
 
 
425
  "gemini-2.5-flash",
426
  "gemini-2.5-flash-lite",
427
+ "gemini-3.5-flash-lite",
428
+ "gemini-3.1-flash-lite",
429
  "gemma-4-31b-it",
430
  "gemma-4-26b-a4b-it",
431
  ]
432
+ # Сначала модели с реальной квотой search grounding (2.5-flash/lite), lite 3.x — резервом.
433
  GEMINI_SEARCH_CHAIN: list[str] = [
434
  "gemini-2.5-flash",
435
  "gemini-2.5-flash-lite",
436
  "gemini-3.5-flash-lite",
437
  "gemini-3.1-flash-lite",
 
 
 
 
 
438
  ]
439
  # Дефолт для прямых вызовов ask_gemini без явной цепочки.
440
  # Копия, а не алиас: раньше правка дефолта молча меняла тяжёлую цепочку (аудит 26.09.2026).
tests/test_lumen_router_config.py CHANGED
@@ -128,8 +128,9 @@ def test_looks_like_heavy_query_ignores_substrings_and_handles_plurals():
128
  def test_build_route_youtube_link_forces_gemini_only():
129
  route = lumen_router_config._build_route(needs_youtube=True, needs_website=False, media_mime=None, is_heavy=False, needs_freshness=False)
130
  assert all(p == "gemini" for p, _ in route)
131
- # ОБНОВЛЕНО (аудит моделей, 17.09.2026): флагман сменился с 3.7 на 3.8 Flash.
132
- assert route[0] == ("gemini", "gemini-3.8-flash")
 
133
 
134
 
135
  def test_build_route_website_link_forces_gemini_only_and_excludes_gemma():
@@ -230,9 +231,11 @@ def test_new_gemini_models_present_and_prioritized():
230
  assert "gemini-3.7-flash" in lumen_router_config.GEMINI_MODELS
231
  assert "gemini-3.6-flash" in lumen_router_config.GEMINI_MODELS
232
  assert "gemini-3.5-flash-lite" in lumen_router_config.GEMINI_MODELS
233
- assert lumen_router_config.DEFAULT_GEMINI_MODEL == "gemini-3.8-flash"
234
- assert lumen_router_config.GEMINI_HEAVY_CHAIN[0] == "gemini-3.8-flash"
235
- assert lumen_router_config.GEMINI_HEAVY_CHAIN[1] == "gemini-3.7-flash"
 
 
236
  # Обновлено (24.07.2026) вместе с реордером GEMINI_SEARCH_CHAIN — см. комментарий
237
  # там же: реальная квота на search grounding подтверждена только у Gemini 2.5.
238
  assert lumen_router_config.GEMINI_SEARCH_CHAIN[0] == "gemini-2.5-flash"
@@ -245,15 +248,14 @@ def test_gemini_3_flash_preview_restored_after_official_docs_confirmation():
245
  # прислал скриншот ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview —
246
  # "Last updated 2026-08-18 UTC", живая таблица возможностей, Model code
247
  # gemini-3-flash-preview. Первоисточник перевешивает прежний (неверный) вывод.
 
 
 
248
  assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_MODELS
249
- assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_HEAVY_CHAIN
250
- assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_SEARCH_CHAIN
251
- assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_LINK_CHAIN
252
- assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_LINK_SEARCH_CHAIN
253
- # Позиция — после 3.5 Flash по номеру версии (3, 3.1, 3.5, 3.6, 3.7), перед
254
- # lite-вариантами.
255
- chain = lumen_router_config.GEMINI_HEAVY_CHAIN
256
- assert chain.index("gemini-3.5-flash") < chain.index("gemini-3-flash-preview") < chain.index("gemini-3.5-flash-lite")
257
 
258
 
259
  def test_gemini_3_flash_preview_quota_config_matches_dashboard():
@@ -411,7 +413,14 @@ def test_ling_3_0_flash_still_flagged_for_leak_detection():
411
  # nemotron-3-super/-ultra в heavy) — новая голова.
412
 
413
  def test_nemotron_3_5_lightning_promoted_to_light_order_head():
414
- assert lumen_router_config._OR_LIGHT_ORDER[0] == "nvidia/nemotron-3.5-lightning:free"
 
 
 
 
 
 
 
415
 
416
 
417
  def test_nemotron_3_nano_30b_a3b_excluded_after_removal_date_passed():
@@ -588,7 +597,8 @@ def test_sept_2026_dead_models_excluded_but_kept_for_leak_detection():
588
 
589
  def test_sept_2026_new_light_models_after_proven_head_before_reserve():
590
  order = lumen_router_config._OR_LIGHT_ORDER
591
- assert order[0] == "nvidia/nemotron-3.5-lightning:free"
 
592
  assert order[-1] == "openrouter/free"
593
  for model_id in (
594
  "inclusionai/ling-3.0-flash-sante:free",
@@ -606,7 +616,8 @@ def test_inkling_small_excluded_after_agentic_harness_refusal():
606
  assert "thinkingmachines/inkling-small:free" in lumen_router_config._ROUTER_EXCLUDED_OR_MODELS
607
  assert "thinkingmachines/inkling-small:free" not in lumen_router_config._OR_LIGHT_ORDER
608
  # nex-mini снят 05.10.2026 (платная отсечка) — второй стала sante.
609
- assert lumen_router_config._OR_LIGHT_ORDER[1] == "inclusionai/ling-3.0-flash-sante:free"
 
610
 
611
 
612
  def test_nex_mini_excluded_after_paid_tier_cutover():
@@ -661,11 +672,16 @@ def test_sept_2026_new_heavy_and_vision_models_placed():
661
 
662
 
663
  def test_gemini_3_8_flash_heads_heavy_chain_and_default():
 
 
664
  assert "gemini-3.8-flash" in lumen_router_config.GEMINI_MODELS
665
- assert lumen_router_config.DEFAULT_GEMINI_MODEL == "gemini-3.8-flash"
666
- assert lumen_router_config.GEMINI_HEAVY_CHAIN[0] == "gemini-3.8-flash"
667
- assert "gemini-3.8-flash" in lumen_router_config.GEMINI_SEARCH_CHAIN
668
- assert "gemini-3.8-flash" in lumen_router_config.GEMINI_LINK_CHAIN
 
 
 
669
  conf = lumen_router_config.GEMINI_MODELS["gemini-3.8-flash"]
670
  assert conf.get("search_grounding") is False
671
  assert conf.get("map_grounding") is False
 
128
  def test_build_route_youtube_link_forces_gemini_only():
129
  route = lumen_router_config._build_route(needs_youtube=True, needs_website=False, media_mime=None, is_heavy=False, needs_freshness=False)
130
  assert all(p == "gemini" for p, _ in route)
131
+ # ОБНОВЛЕНО 08.10.2026: линейка 3.x убрана из цепочек (503 в проде 05.10.2026) —
132
+ # голова LINK-цепочки теперь живая 2.5-flash.
133
+ assert route[0] == ("gemini", "gemini-2.5-flash")
134
 
135
 
136
  def test_build_route_website_link_forces_gemini_only_and_excludes_gemma():
 
231
  assert "gemini-3.7-flash" in lumen_router_config.GEMINI_MODELS
232
  assert "gemini-3.6-flash" in lumen_router_config.GEMINI_MODELS
233
  assert "gemini-3.5-flash-lite" in lumen_router_config.GEMINI_MODELS
234
+ # 08.10.2026: линейка 3.x убрана из цепочек (503 в проде 05.10.2026) —
235
+ # дефолт переехал на живую ветку 2.5, она же голова тяжёлой цепочки
236
+ # (lite 3.x в том же логе отдавали 400 — стоят резервом).
237
+ assert lumen_router_config.DEFAULT_GEMINI_MODEL == "gemini-2.5-flash"
238
+ assert lumen_router_config.GEMINI_HEAVY_CHAIN[0] == "gemini-2.5-flash"
239
  # Обновлено (24.07.2026) вместе с реордером GEMINI_SEARCH_CHAIN — см. комментарий
240
  # там же: реальная квота на search grounding подтверждена только у Gemini 2.5.
241
  assert lumen_router_config.GEMINI_SEARCH_CHAIN[0] == "gemini-2.5-flash"
 
248
  # прислал скриншот ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview —
249
  # "Last updated 2026-08-18 UTC", живая таблица возможностей, Model code
250
  # gemini-3-flash-preview. Первоисточник перевешивает прежний (неверный) вывод.
251
+ # 08.10.2026: вся линейка 3.x снова убрана из цепочек — на этот раз прод
252
+ # 05.10.2026 (HTTP 503 разом на пяти моделях). Конфиг в GEMINI_MODELS оставлен:
253
+ # возврат — одной правкой цепочек, если дашборд покажет их живыми.
254
  assert "gemini-3-flash-preview" in lumen_router_config.GEMINI_MODELS
255
+ assert "gemini-3-flash-preview" not in lumen_router_config.GEMINI_HEAVY_CHAIN
256
+ assert "gemini-3-flash-preview" not in lumen_router_config.GEMINI_SEARCH_CHAIN
257
+ assert "gemini-3-flash-preview" not in lumen_router_config.GEMINI_LINK_CHAIN
258
+ assert "gemini-3-flash-preview" not in lumen_router_config.GEMINI_LINK_SEARCH_CHAIN
 
 
 
 
259
 
260
 
261
  def test_gemini_3_flash_preview_quota_config_matches_dashboard():
 
413
  # nemotron-3-super/-ultra в heavy) — новая голова.
414
 
415
  def test_nemotron_3_5_lightning_promoted_to_light_order_head():
416
+ # 08.10.2026: понижена в хвост — таймауты в проде 07.10.2026, каждая её
417
+ # попытка стоила до 22 секунд до живой sante. Головой стала sante
418
+ # (фактически отвечает в проде). Резервом перед openrouter/free, не в реестре.
419
+ order = lumen_router_config._OR_LIGHT_ORDER
420
+ assert order[0] == "inclusionai/ling-3.0-flash-sante:free"
421
+ assert order[-2] == "nvidia/nemotron-3.5-lightning:free"
422
+ assert order[-1] == "openrouter/free"
423
+ assert "nvidia/nemotron-3.5-lightning:free" not in lumen_router_config._ROUTER_EXCLUDED_OR_MODELS
424
 
425
 
426
  def test_nemotron_3_nano_30b_a3b_excluded_after_removal_date_passed():
 
597
 
598
  def test_sept_2026_new_light_models_after_proven_head_before_reserve():
599
  order = lumen_router_config._OR_LIGHT_ORDER
600
+ # 08.10.2026: голова — sante (фактически отвечает в проде), nemotron-3.5-lightning понижен в хвост за таймауты 07.10.2026.
601
+ assert order[0] == "inclusionai/ling-3.0-flash-sante:free"
602
  assert order[-1] == "openrouter/free"
603
  for model_id in (
604
  "inclusionai/ling-3.0-flash-sante:free",
 
616
  assert "thinkingmachines/inkling-small:free" in lumen_router_config._ROUTER_EXCLUDED_OR_MODELS
617
  assert "thinkingmachines/inkling-small:free" not in lumen_router_config._OR_LIGHT_ORDER
618
  # nex-mini снят 05.10.2026 (платная отсечка) — второй стала sante.
619
+ # 08.10.2026: sante уже голова (nemotron понижен за таймауты 07.10.2026).
620
+ assert lumen_router_config._OR_LIGHT_ORDER[0] == "inclusionai/ling-3.0-flash-sante:free"
621
 
622
 
623
  def test_nex_mini_excluded_after_paid_tier_cutover():
 
672
 
673
 
674
  def test_gemini_3_8_flash_heads_heavy_chain_and_default():
675
+ # 08.10.2026: вся линейка 3.x убрана из цепочек (прод 05.10.2026 — HTTP 503
676
+ # разом). Конфиг и детект утечек оставлены, возврат — правкой цепочек.
677
  assert "gemini-3.8-flash" in lumen_router_config.GEMINI_MODELS
678
+ assert lumen_router_config.DEFAULT_GEMINI_MODEL == "gemini-2.5-flash"
679
+ assert "gemini-3.8-flash" not in lumen_router_config.GEMINI_HEAVY_CHAIN
680
+ assert "gemini-3.8-flash" not in lumen_router_config.GEMINI_SEARCH_CHAIN
681
+ assert "gemini-3.8-flash" not in lumen_router_config.GEMINI_LINK_CHAIN
682
+ for dead in ("gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3-flash-preview"):
683
+ assert dead not in lumen_router_config.GEMINI_HEAVY_CHAIN
684
+ assert dead not in lumen_router_config.GEMINI_SEARCH_CHAIN
685
  conf = lumen_router_config.GEMINI_MODELS["gemini-3.8-flash"]
686
  assert conf.get("search_grounding") is False
687
  assert conf.get("map_grounding") is False