mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
fix: Flip logic in get_model_info
This commit is contained in:
parent
fa7d92a117
commit
5e8f9f72cc
1 changed files with 45 additions and 39 deletions
|
@ -452,7 +452,13 @@ class Model(ModelSettings):
|
||||||
self.get_weak_model(weak_model)
|
self.get_weak_model(weak_model)
|
||||||
|
|
||||||
def get_model_info(self, model):
|
def get_model_info(self, model):
|
||||||
if not litellm._lazy_module:
|
if litellm._lazy_module:
|
||||||
|
# Do it the slow way...
|
||||||
|
try:
|
||||||
|
return litellm.get_model_info(model)
|
||||||
|
except Exception:
|
||||||
|
return dict()
|
||||||
|
|
||||||
cache_dir = Path.home() / ".aider" / "caches"
|
cache_dir = Path.home() / ".aider" / "caches"
|
||||||
cache_file = cache_dir / "model_prices_and_context_window.json"
|
cache_file = cache_dir / "model_prices_and_context_window.json"
|
||||||
cache_dir.mkdir(parents=True, exist_ok=True)
|
cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
@ -497,7 +503,7 @@ class Model(ModelSettings):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass # If there's any error, fall back to the slow way
|
pass # If there's any error, fall back to the slow way
|
||||||
|
|
||||||
# Do it the slow way...
|
# If all else fails, do it the slow way...
|
||||||
try:
|
try:
|
||||||
return litellm.get_model_info(model)
|
return litellm.get_model_info(model)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue