mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-08 22:38:05 -05:00
Fix litellm_proxy model info JSON parsing error handling (#10009)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -461,12 +461,16 @@ class LLM(RetryMixin, DebugMixin):
|
||||
},
|
||||
)
|
||||
|
||||
resp_json = response.json()
|
||||
if 'data' not in resp_json:
|
||||
logger.error(
|
||||
f'Error getting model info from LiteLLM proxy: {resp_json}'
|
||||
)
|
||||
all_model_info = resp_json.get('data', [])
|
||||
try:
|
||||
resp_json = response.json()
|
||||
if 'data' not in resp_json:
|
||||
logger.info(
|
||||
f'No data field in model info response from LiteLLM proxy: {resp_json}'
|
||||
)
|
||||
all_model_info = resp_json.get('data', [])
|
||||
except Exception as e:
|
||||
logger.info(f'Error parsing JSON response from LiteLLM proxy: {e}')
|
||||
all_model_info = []
|
||||
current_model_info = next(
|
||||
(
|
||||
info
|
||||
|
||||
Reference in New Issue
Block a user