mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
feat(router): mapped finish reason checkpoint on chat completions
This commit is contained in:
parent
f6ec7dfeb9
commit
ebe4967783
1 changed files with 20 additions and 0 deletions
|
|
@ -2574,6 +2574,16 @@ class Router:
|
|||
llm_provider="",
|
||||
)
|
||||
|
||||
## CHECK MAPPED FINISH REASON ERROR ##
|
||||
if isinstance(response, ModelResponse):
|
||||
if self._should_raise_mapped_finish_reason_error(model=model, response=response, kwargs=kwargs):
|
||||
raise self._finish_reason_failure_error(
|
||||
model=model, reason=self._get_mapped_finish_reason(response)
|
||||
)
|
||||
self._account_mapped_finish_reason_failure(
|
||||
model=model, deployment=deployment, response=response, kwargs=kwargs
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(response, CustomStreamWrapper)
|
||||
and response.completion_stream is None
|
||||
|
|
@ -3698,6 +3708,16 @@ class Router:
|
|||
llm_provider="",
|
||||
)
|
||||
|
||||
## CHECK MAPPED FINISH REASON ERROR ##
|
||||
if isinstance(response, ModelResponse):
|
||||
if self._should_raise_mapped_finish_reason_error(model=model, response=response, kwargs=kwargs):
|
||||
raise self._finish_reason_failure_error(
|
||||
model=model, reason=self._get_mapped_finish_reason(response)
|
||||
)
|
||||
self._account_mapped_finish_reason_failure(
|
||||
model=model, deployment=deployment, response=response, kwargs=kwargs
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(response, CustomStreamWrapper)
|
||||
and response.completion_stream is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue