STREAM_SSE_DONE_STRING

This commit is contained in:
Ishaan Jaff 2025-03-12 09:33:28 -07:00
parent aa250088b2
commit 58acf23c3e
2 changed files with 3 additions and 4 deletions

View file

@ -18,6 +18,7 @@ SINGLE_DEPLOYMENT_TRAFFIC_FAILURE_THRESHOLD = 1000 # Minimum number of requests
REPEATED_STREAMING_CHUNK_LIMIT = 100 # catch if model starts looping the same chunk while streaming. Uses high default to prevent false positives. REPEATED_STREAMING_CHUNK_LIMIT = 100 # catch if model starts looping the same chunk while streaming. Uses high default to prevent false positives.
#### Networking settings #### #### Networking settings ####
request_timeout: float = 6000 # time in seconds request_timeout: float = 6000 # time in seconds
STREAM_SSE_DONE_STRING: str = "[DONE]"
LITELLM_CHAT_PROVIDERS = [ LITELLM_CHAT_PROVIDERS = [
"openai", "openai",

View file

@ -5,17 +5,15 @@ from typing import Any, AsyncIterator, Dict, Optional, Union
import httpx import httpx
from litellm.constants import STREAM_SSE_DONE_STRING
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig from litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig
from litellm.types.llms.openai import ( from litellm.types.llms.openai import (
ResponsesAPIResponse,
ResponsesAPIStreamEvents, ResponsesAPIStreamEvents,
ResponsesAPIStreamingResponse, ResponsesAPIStreamingResponse,
) )
from litellm.utils import CustomStreamWrapper from litellm.utils import CustomStreamWrapper
COMPLETED_OPENAI_CHUNK_TYPE = "response.completed"
class BaseResponsesAPIStreamingIterator: class BaseResponsesAPIStreamingIterator:
""" """
@ -50,7 +48,7 @@ class BaseResponsesAPIStreamingIterator:
return None return None
# Handle "[DONE]" marker # Handle "[DONE]" marker
if chunk == "[DONE]": if chunk == STREAM_SSE_DONE_STRING:
self.finished = True self.finished = True
return None return None