Merge branch 'offline_cai' into '0.5.0'

remove warning for pricing when CAI offline

See merge request aliasrobotics/alias_research/cai!227
This commit is contained in:
Luis Javier Navarrete Lozano 2025-06-18 08:26:32 +00:00
commit 019c94d313
1 changed files with 9 additions and 1 deletions

View File

@ -557,7 +557,15 @@ class CostTracker:
self.model_pricing_cache[model_name] = (input_cost_per_token, output_cost_per_token)
return input_cost_per_token, output_cost_per_token
except Exception as e:
print(f" WARNING: Error fetching model pricing: {str(e)}")
# Check if it's a network connectivity issue by testing a simple connection
try:
import requests
test_response = requests.get("https://aliasrobotics.com/", timeout=1)
# The pricing URL failed
print(f" WARNING: Error fetching model pricing: {str(e)}")
except Exception:
# No internet connection, silently skip the warning
pass
# Default to zero cost if no pricing found (local/free models)
default_pricing = (0.0, 0.0)