forked from phoenix/litellm-mirror
fix log model_group
This commit is contained in:
parent
ee2a2ce559
commit
ad5fddef15
3 changed files with 6 additions and 5 deletions
|
@ -915,7 +915,7 @@ class LiteLLM_SpendLogs(LiteLLMBase):
|
||||||
class LiteLLM_ErrorLogs(LiteLLMBase):
|
class LiteLLM_ErrorLogs(LiteLLMBase):
|
||||||
request_id: Optional[str] = str(uuid.uuid4())
|
request_id: Optional[str] = str(uuid.uuid4())
|
||||||
api_base: Optional[str] = ""
|
api_base: Optional[str] = ""
|
||||||
model_name: Optional[str] = ""
|
model_group: Optional[str] = ""
|
||||||
model_id: Optional[str] = ""
|
model_id: Optional[str] = ""
|
||||||
request_kwargs: Optional[Json] = {}
|
request_kwargs: Optional[Json] = {}
|
||||||
exception_type: Optional[str] = ""
|
exception_type: Optional[str] = ""
|
||||||
|
|
|
@ -1232,13 +1232,14 @@ async def _PROXY_failure_handler(
|
||||||
_exception = kwargs.get("exception")
|
_exception = kwargs.get("exception")
|
||||||
traceback = kwargs.get("traceback")
|
traceback = kwargs.get("traceback")
|
||||||
_exception_type = _exception.__class__.__name__
|
_exception_type = _exception.__class__.__name__
|
||||||
|
|
||||||
_model = kwargs.get("model", None)
|
_model = kwargs.get("model", None)
|
||||||
|
|
||||||
_status_code = _exception.status_code
|
_status_code = _exception.status_code
|
||||||
|
|
||||||
_litellm_params = kwargs.get("litellm_params", {}) or {}
|
_litellm_params = kwargs.get("litellm_params", {}) or {}
|
||||||
_metadata = _litellm_params.get("metadata", {}) or {}
|
_metadata = _litellm_params.get("metadata", {}) or {}
|
||||||
_model_id = _metadata.get("model_info", {}).get("id", None)
|
_model_id = _metadata.get("model_info", {}).get("id", "")
|
||||||
|
_model_group = _metadata.get("model_group", "")
|
||||||
|
|
||||||
api_base = litellm.get_api_base(model=_model, optional_params=_litellm_params)
|
api_base = litellm.get_api_base(model=_model, optional_params=_litellm_params)
|
||||||
|
|
||||||
|
@ -1256,7 +1257,7 @@ async def _PROXY_failure_handler(
|
||||||
)
|
)
|
||||||
error_log = LiteLLM_ErrorLogs(
|
error_log = LiteLLM_ErrorLogs(
|
||||||
request_id=str(uuid.uuid4()),
|
request_id=str(uuid.uuid4()),
|
||||||
model_name=_model,
|
model_group=_model_group,
|
||||||
model_id=_model_id,
|
model_id=_model_id,
|
||||||
api_base=api_base,
|
api_base=api_base,
|
||||||
exception_type=_exception_type,
|
exception_type=_exception_type,
|
||||||
|
|
|
@ -187,7 +187,7 @@ model LiteLLM_SpendLogs {
|
||||||
model LiteLLM_ErrorLogs {
|
model LiteLLM_ErrorLogs {
|
||||||
request_id String @id @default(uuid())
|
request_id String @id @default(uuid())
|
||||||
api_base String @default("")
|
api_base String @default("")
|
||||||
model_name String @default("") // public model_name / model_group
|
model_group String @default("") // public model_name / model_group
|
||||||
model_id String @default("") // ID of model in ProxyModelTable
|
model_id String @default("") // ID of model in ProxyModelTable
|
||||||
request_kwargs Json @default("{}")
|
request_kwargs Json @default("{}")
|
||||||
exception_type String @default("")
|
exception_type String @default("")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue