mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(openai): add verbose_logger.debug for silent failure paths in try_parse_sse_response_body
Address Greptile P2 suggestions: log when no SSE data lines are found and when stream_chunk_builder raises, so failures are observable in debug logs rather than silently falling back to the original error.
This commit is contained in:
parent
04b60791c9
commit
ab1d2d0b33
1 changed files with 8 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ if TYPE_CHECKING:
|
|||
from litellm.types.utils import ModelResponse
|
||||
|
||||
import litellm
|
||||
from litellm._logging import verbose_logger
|
||||
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
||||
from litellm.llms.custom_httpx.http_handler import (
|
||||
_DEFAULT_TTL_FOR_HTTPX_CLIENTS,
|
||||
|
|
@ -322,13 +323,19 @@ def try_parse_sse_response_body(body: Optional[str]) -> Optional["ModelResponse"
|
|||
continue
|
||||
|
||||
if not chunks:
|
||||
verbose_logger.debug(
|
||||
"try_parse_sse_response_body: no SSE data lines found in response body"
|
||||
)
|
||||
return None
|
||||
|
||||
from litellm.types.utils import ModelResponse
|
||||
|
||||
try:
|
||||
result = litellm.stream_chunk_builder(chunks=chunks)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
verbose_logger.debug(
|
||||
"try_parse_sse_response_body: stream_chunk_builder failed: %s", e
|
||||
)
|
||||
return None
|
||||
if not isinstance(result, ModelResponse):
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue