mirror of
https://github.com/nubenetes/awesome-kubernetes.git
synced 2026-07-13 18:30:44 +00:00
fix: adjust batch size to 50 and enforce strict Lite-only policy
- Reduced BATCH_SIZE_FAST to 50 to prevent AI request timeouts. - Hardened call_gemini_with_retry to strictly use Flash/Lite models when prefer_flash=True. - Ensured newest model versions are prioritized within the Flash tier.
This commit is contained in:
@@ -293,9 +293,13 @@ async def call_gemini_with_retry(prompt: str, response_format: str = "json", max
|
||||
consecutive_429s = 0
|
||||
base_wait_time = 2.0
|
||||
|
||||
# 1. Smart Re-ordering
|
||||
# 1. Smart Filtering and Re-ordering (Strict Lite-Only Policy for Tier 1)
|
||||
if prefer_flash:
|
||||
models = sorted(models_pool, key=lambda m: 0 if "flash" in m or "lite" in m else 1)
|
||||
# Strict filter: Only allow flash/lite models, maintaining version sorting from pool
|
||||
models = [m for m in models_pool if "flash" in m or "lite" in m]
|
||||
if not models:
|
||||
# Emergency fallback: if no flash/lite discovered, use hardcoded safe defaults
|
||||
models = ["gemini-1.5-flash", "gemini-1.5-flash-latest"]
|
||||
else:
|
||||
models = models_pool
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ class V2VisionEngine:
|
||||
analyst_results = []
|
||||
|
||||
# 1.1 Fast-Track: Large Batches, NO GROUNDING (Fast)
|
||||
BATCH_SIZE_FAST = 100 # Increased from 40 for optimal RPM/TPM balance
|
||||
BATCH_SIZE_FAST = 50 # Balanced "Sweet Spot" for RPM/TPM and timeout safety (2026)
|
||||
total_fast = len(fast_track)
|
||||
for i in range(0, total_fast, BATCH_SIZE_FAST):
|
||||
batch = fast_track[i:i+BATCH_SIZE_FAST]
|
||||
|
||||
Reference in New Issue
Block a user