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
fix bytez validate_environment
Ishaan Jaff98da9c73dc4f
diff --git a/litellm/llms/bytez/chat/transformation.py b/litellm/llms/bytez/chat/transformation.pyindex 481eb43d82b..ccd3c216458 100644--- a/litellm/llms/bytez/chat/transformation.py+++ b/litellm/llms/bytez/chat/transformation.py@@ -1,34 +1,25 @@import jsonimport timeimport traceback-from typing import (- TYPE_CHECKING,- Any,- List,- Optional,- Union,- Dict,-)+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Unionimport httpx-from litellm.litellm_core_utils.logging_utils import track_llm_api_timingfrom litellm.litellm_core_utils.exception_mapping_utils import exception_type+from litellm.litellm_core_utils.logging_utils import track_llm_api_timingfrom litellm.llms.base_llm.chat.transformation import BaseConfig, BaseLLMException-from litellm.utils import CustomStreamWrapper, ModelResponse, Usage-from litellm.types.utils import LlmProviders-from litellm.types.llms.openai import AllMessageValues-from litellm.llms.custom_httpx.http_handler import (- version,+ AsyncHTTPHandler,HTTPHandler,_get_httpx_client,- AsyncHTTPHandler,get_async_httpx_client,+ version,)+from litellm.types.llms.openai import AllMessageValues+from litellm.types.utils import LlmProviders+from litellm.utils import CustomStreamWrapper, ModelResponse, Usage-from ..common_utils import validate_environment, API_BASE, BytezError-+from ..common_utils import API_BASE, BytezErrorif TYPE_CHECKING:from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj@@ -142,10 +133,14 @@ class BytezChatConfig(BaseConfig):})- validate_environment(- messages=messages,- api_key=api_key,- )+ if not messages:+ raise Exception(+ "kwarg `messages` must be an array of messages that follow the openai chat standard"+ )++ if not api_key:+ raise Exception("Missing api_key, make sure you pass in your api key")+return headersdiff --git a/litellm/llms/bytez/common_utils.py b/litellm/llms/bytez/common_utils.pyindex b59d57b2e73..c8a78225020 100644--- a/litellm/llms/bytez/common_utils.py+++ b/litellm/llms/bytez/common_utils.py@@ -1,4 +1,4 @@-from typing import Optional, List, Union+from typing import List, Optional, Unionimport httpx@@ -22,16 +22,4 @@ class BytezError(BaseLLMException):status_code=status_code,message=message,headers=headers,- )---def validate_environment(- api_key: Optional[str] = None, messages: Union[List, None] = None-) -> None:- if not messages:- raise Exception(- "kwarg `messages` must be an array of messages that follow the openai chat standard"- )-- if not api_key:- raise Exception("Missing api_key, make sure you pass in your api key")+ )\ No newline at end of file