mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(fix) router - update model_group on fallback
This commit is contained in:
parent
8305516d66
commit
98e7aac672
1 changed files with 13 additions and 2 deletions
|
@ -845,6 +845,9 @@ class Router:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
kwargs["model"] = mg
|
kwargs["model"] = mg
|
||||||
|
kwargs.setdefault("metadata", {}).update(
|
||||||
|
{"model_group": mg}
|
||||||
|
) # update model_group used, if fallbacks are done
|
||||||
response = await self.async_function_with_retries(
|
response = await self.async_function_with_retries(
|
||||||
*args, **kwargs
|
*args, **kwargs
|
||||||
)
|
)
|
||||||
|
@ -873,8 +876,10 @@ class Router:
|
||||||
f"Falling back to model_group = {mg}"
|
f"Falling back to model_group = {mg}"
|
||||||
)
|
)
|
||||||
kwargs["model"] = mg
|
kwargs["model"] = mg
|
||||||
kwargs["metadata"]["model_group"] = mg
|
kwargs.setdefault("metadata", {}).update(
|
||||||
response = await self.async_function_with_retries(
|
{"model_group": mg}
|
||||||
|
) # update model_group used, if fallbacks are done
|
||||||
|
response = await self.async_function_with_fallbacks(
|
||||||
*args, **kwargs
|
*args, **kwargs
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
@ -1039,6 +1044,9 @@ class Router:
|
||||||
## LOGGING
|
## LOGGING
|
||||||
kwargs = self.log_retry(kwargs=kwargs, e=original_exception)
|
kwargs = self.log_retry(kwargs=kwargs, e=original_exception)
|
||||||
kwargs["model"] = mg
|
kwargs["model"] = mg
|
||||||
|
kwargs.setdefault("metadata", {}).update(
|
||||||
|
{"model_group": mg}
|
||||||
|
) # update model_group used, if fallbacks are done
|
||||||
response = self.function_with_fallbacks(*args, **kwargs)
|
response = self.function_with_fallbacks(*args, **kwargs)
|
||||||
return response
|
return response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -1062,6 +1070,9 @@ class Router:
|
||||||
## LOGGING
|
## LOGGING
|
||||||
kwargs = self.log_retry(kwargs=kwargs, e=original_exception)
|
kwargs = self.log_retry(kwargs=kwargs, e=original_exception)
|
||||||
kwargs["model"] = mg
|
kwargs["model"] = mg
|
||||||
|
kwargs.setdefault("metadata", {}).update(
|
||||||
|
{"model_group": mg}
|
||||||
|
) # update model_group used, if fallbacks are done
|
||||||
response = self.function_with_fallbacks(*args, **kwargs)
|
response = self.function_with_fallbacks(*args, **kwargs)
|
||||||
return response
|
return response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue