mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
STREAM_SSE_DONE_STRING
This commit is contained in:
parent
aa250088b2
commit
58acf23c3e
2 changed files with 3 additions and 4 deletions
|
@ -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",
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue