The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
add should_fake_stream
Ishaan Jaffbc174adcd060
diff --git a/litellm/llms/base_llm/responses/transformation.py b/litellm/llms/base_llm/responses/transformation.pyindex c41d63842b1..53a7a212903 100644--- a/litellm/llms/base_llm/responses/transformation.py+++ b/litellm/llms/base_llm/responses/transformation.py@@ -131,3 +131,12 @@ class BaseResponsesAPIConfig(ABC):message=error_message,headers=headers,)++ def should_fake_stream(+ self,+ model: Optional[str],+ stream: Optional[bool],+ custom_llm_provider: Optional[str] = None,+ ) -> bool:+ """Returns True if litellm should fake a stream for the given model and stream value"""+ return Falsediff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.pyindex ce4052dc197..891b8849dbd 100644--- a/litellm/llms/openai/responses/transformation.py+++ b/litellm/llms/openai/responses/transformation.py@@ -188,3 +188,27 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):raise ValueError(f"Unknown event type: {event_type}")return model_class++ def should_fake_stream(+ self,+ model: Optional[str],+ stream: Optional[bool],+ custom_llm_provider: Optional[str] = None,+ ) -> bool:+ if stream is not True:+ return False+ if model is not None:+ try:+ if (+ litellm.utils.supports_native_streaming(+ model=model,+ custom_llm_provider=custom_llm_provider,+ )+ is False+ ):+ return True+ except Exception as e:+ verbose_logger.debug(+ f"Error getting model info in OpenAIResponsesAPIConfig: {e}"+ )+ return Falsediff --git a/litellm/utils.py b/litellm/utils.pyindex 677cfe7684e..6bf1560a3b6 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -1975,6 +1975,27 @@ def supports_system_messages(model: str, custom_llm_provider: Optional[str]) ->)+def supports_native_streaming(model: str, custom_llm_provider: Optional[str]) -> bool:+ """+ Check if the given model supports native streaming and return a boolean value.++ Parameters:+ model (str): The model name to be checked.+ custom_llm_provider (str): The provider to be checked.++ Returns:+ bool: True if the model supports native streaming, False otherwise.++ Raises:+ Exception: If the given model is not found in model_prices_and_context_window.json.+ """+ return _supports_factory(+ model=model,+ custom_llm_provider=custom_llm_provider,+ key="supports_native_streaming",+ )++def supports_response_schema(model: str, custom_llm_provider: Optional[str] = None) -> bool: