From dfbbf0bde88249e5e58130c33b693be4fbe226c1 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Fri, 7 Feb 2025 16:20:28 -0800 Subject: [PATCH] fix: dictionary changed size during iteration error (#8327) (#8341) Co-authored-by: Joey Feldberg Co-authored-by: Joey Feldberg <12495578+joeyfeldberg@users.noreply.github.com> --- litellm/llms/anthropic/chat/transformation.py | 2 +- litellm/llms/anthropic/completion/transformation.py | 2 +- litellm/llms/bedrock/chat/converse_transformation.py | 2 +- litellm/llms/bedrock/chat/invoke_handler.py | 2 +- .../chat/invoke_transformations/amazon_ai21_transformation.py | 2 +- .../chat/invoke_transformations/amazon_cohere_transformation.py | 2 +- .../chat/invoke_transformations/amazon_llama_transformation.py | 2 +- .../invoke_transformations/amazon_mistral_transformation.py | 2 +- .../chat/invoke_transformations/amazon_titan_transformation.py | 2 +- .../invoke_transformations/anthropic_claude2_transformation.py | 2 +- .../invoke_transformations/anthropic_claude3_transformation.py | 2 +- litellm/llms/bedrock/embed/amazon_titan_g1_transformation.py | 2 +- litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py | 2 +- litellm/llms/bedrock/image/amazon_stability1_transformation.py | 2 +- litellm/llms/clarifai/chat/transformation.py | 2 +- litellm/llms/cloudflare/chat/transformation.py | 2 +- litellm/llms/cohere/chat/transformation.py | 2 +- litellm/llms/cohere/completion/transformation.py | 2 +- litellm/llms/databricks/chat/transformation.py | 2 +- litellm/llms/databricks/embed/transformation.py | 2 +- litellm/llms/deprecated_providers/aleph_alpha.py | 2 +- litellm/llms/deprecated_providers/palm.py | 2 +- litellm/llms/gemini/chat/transformation.py | 2 +- litellm/llms/huggingface/chat/transformation.py | 2 +- litellm/llms/jina_ai/embedding/transformation.py | 2 +- litellm/llms/lm_studio/embed/transformation.py | 2 +- litellm/llms/maritalk.py | 2 +- litellm/llms/nlp_cloud/chat/transformation.py | 2 +- litellm/llms/nvidia_nim/embed.py | 2 +- litellm/llms/ollama/completion/transformation.py | 2 +- litellm/llms/ollama_chat.py | 2 +- litellm/llms/petals/completion/transformation.py | 2 +- litellm/llms/predibase/chat/transformation.py | 2 +- litellm/llms/replicate/chat/transformation.py | 2 +- litellm/llms/sagemaker/completion/transformation.py | 2 +- .../llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py | 2 +- .../vertex_ai/vertex_ai_partner_models/ai21/transformation.py | 2 +- .../vertex_ai/vertex_ai_partner_models/llama3/transformation.py | 2 +- litellm/llms/vertex_ai/vertex_embeddings/transformation.py | 2 +- litellm/llms/watsonx/completion/transformation.py | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 960b4f95bb3..7ad673b9f50 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -70,7 +70,7 @@ class AnthropicConfig(BaseConfig): metadata: Optional[dict] = None, system: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/anthropic/completion/transformation.py b/litellm/llms/anthropic/completion/transformation.py index e2510d6a983..7a260b6f949 100644 --- a/litellm/llms/anthropic/completion/transformation.py +++ b/litellm/llms/anthropic/completion/transformation.py @@ -72,7 +72,7 @@ class AnthropicTextConfig(BaseConfig): top_k: Optional[int] = None, metadata: Optional[dict] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index 60527381f66..aa09fb30611 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -63,7 +63,7 @@ class AmazonConverseConfig(BaseConfig): topP: Optional[int] = None, topK: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py index 42b29120b14..460c2bbeaca 100644 --- a/litellm/llms/bedrock/chat/invoke_handler.py +++ b/litellm/llms/bedrock/chat/invoke_handler.py @@ -103,7 +103,7 @@ class AmazonCohereChatConfig: stop_sequences: Optional[str] = None, raw_prompting: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py index 48e21ce602a..50fa6f170b3 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py @@ -46,7 +46,7 @@ class AmazonAI21Config(AmazonInvokeConfig, BaseConfig): presencePenalty: Optional[dict] = None, countPenalty: Optional[dict] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_cohere_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_cohere_transformation.py index f276e390b2e..e9479c8f322 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_cohere_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_cohere_transformation.py @@ -28,7 +28,7 @@ class AmazonCohereConfig(AmazonInvokeConfig, BaseConfig): temperature: Optional[float] = None, return_likelihood: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_llama_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_llama_transformation.py index f45e49672b9..9f84844fcb6 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_llama_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_llama_transformation.py @@ -28,7 +28,7 @@ class AmazonLlamaConfig(AmazonInvokeConfig, BaseConfig): temperature: Optional[float] = None, topP: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py index 761fab7465e..ef3c237f9d0 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py @@ -33,7 +33,7 @@ class AmazonMistralConfig(AmazonInvokeConfig, BaseConfig): top_k: Optional[float] = None, stop: Optional[List[str]] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_titan_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_titan_transformation.py index e16946f3ed2..367fb84d1ac 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_titan_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_titan_transformation.py @@ -33,7 +33,7 @@ class AmazonTitanConfig(AmazonInvokeConfig, BaseConfig): temperature: Optional[float] = None, topP: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py index 5f86c225290..085cf0b9ca7 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py @@ -34,7 +34,7 @@ class AmazonAnthropicConfig: top_p: Optional[int] = None, anthropic_version: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py index b227eb8223a..ca8c0bf9812 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py @@ -32,7 +32,7 @@ class AmazonAnthropicClaude3Config: max_tokens: Optional[int] = None, anthropic_version: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/embed/amazon_titan_g1_transformation.py b/litellm/llms/bedrock/embed/amazon_titan_g1_transformation.py index 63219868f4f..2747551af81 100644 --- a/litellm/llms/bedrock/embed/amazon_titan_g1_transformation.py +++ b/litellm/llms/bedrock/embed/amazon_titan_g1_transformation.py @@ -27,7 +27,7 @@ class AmazonTitanG1Config: def __init__( self, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py b/litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py index 8244a9a334a..a68bc6962c8 100644 --- a/litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py +++ b/litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py @@ -33,7 +33,7 @@ class AmazonTitanV2Config: def __init__( self, normalize: Optional[bool] = None, dimensions: Optional[int] = None ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/bedrock/image/amazon_stability1_transformation.py b/litellm/llms/bedrock/image/amazon_stability1_transformation.py index 880881e9712..698ecca94ba 100644 --- a/litellm/llms/bedrock/image/amazon_stability1_transformation.py +++ b/litellm/llms/bedrock/image/amazon_stability1_transformation.py @@ -49,7 +49,7 @@ class AmazonStabilityConfig: width: Optional[int] = None, height: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/clarifai/chat/transformation.py b/litellm/llms/clarifai/chat/transformation.py index 299dd8637cd..916da738839 100644 --- a/litellm/llms/clarifai/chat/transformation.py +++ b/litellm/llms/clarifai/chat/transformation.py @@ -45,7 +45,7 @@ class ClarifaiConfig(BaseConfig): temperature: Optional[int] = None, top_k: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/cloudflare/chat/transformation.py b/litellm/llms/cloudflare/chat/transformation.py index ba1e0697ed5..1ef6da5a4bd 100644 --- a/litellm/llms/cloudflare/chat/transformation.py +++ b/litellm/llms/cloudflare/chat/transformation.py @@ -44,7 +44,7 @@ class CloudflareChatConfig(BaseConfig): max_tokens: Optional[int] = None, stream: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/cohere/chat/transformation.py b/litellm/llms/cohere/chat/transformation.py index 1d68735224e..3ceec2dbba4 100644 --- a/litellm/llms/cohere/chat/transformation.py +++ b/litellm/llms/cohere/chat/transformation.py @@ -104,7 +104,7 @@ class CohereChatConfig(BaseConfig): tool_results: Optional[list] = None, seed: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/cohere/completion/transformation.py b/litellm/llms/cohere/completion/transformation.py index 7c01523571f..bdfcda020ef 100644 --- a/litellm/llms/cohere/completion/transformation.py +++ b/litellm/llms/cohere/completion/transformation.py @@ -86,7 +86,7 @@ class CohereTextConfig(BaseConfig): return_likelihoods: Optional[str] = None, logit_bias: Optional[dict] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/databricks/chat/transformation.py b/litellm/llms/databricks/chat/transformation.py index 7e5c1f6c23d..94e0203459a 100644 --- a/litellm/llms/databricks/chat/transformation.py +++ b/litellm/llms/databricks/chat/transformation.py @@ -37,7 +37,7 @@ class DatabricksConfig(OpenAILikeChatConfig): stop: Optional[Union[List[str], str]] = None, n: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/databricks/embed/transformation.py b/litellm/llms/databricks/embed/transformation.py index 8c7e1197144..53e3b30dd21 100644 --- a/litellm/llms/databricks/embed/transformation.py +++ b/litellm/llms/databricks/embed/transformation.py @@ -16,7 +16,7 @@ class DatabricksEmbeddingConfig: ) def __init__(self, instruction: Optional[str] = None) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/deprecated_providers/aleph_alpha.py b/litellm/llms/deprecated_providers/aleph_alpha.py index a4c5d155f48..81ad1346414 100644 --- a/litellm/llms/deprecated_providers/aleph_alpha.py +++ b/litellm/llms/deprecated_providers/aleph_alpha.py @@ -145,7 +145,7 @@ class AlephAlphaConfig: contextual_control_threshold: Optional[int] = None, control_log_additive: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/deprecated_providers/palm.py b/litellm/llms/deprecated_providers/palm.py index 4afc952a51a..3039222c0e2 100644 --- a/litellm/llms/deprecated_providers/palm.py +++ b/litellm/llms/deprecated_providers/palm.py @@ -63,7 +63,7 @@ class PalmConfig: top_p: Optional[float] = None, max_output_tokens: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/gemini/chat/transformation.py b/litellm/llms/gemini/chat/transformation.py index 313bb99af74..6aa4cf5b52f 100644 --- a/litellm/llms/gemini/chat/transformation.py +++ b/litellm/llms/gemini/chat/transformation.py @@ -57,7 +57,7 @@ class GoogleAIStudioGeminiConfig(VertexGeminiConfig): candidate_count: Optional[int] = None, stop_sequences: Optional[list] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/huggingface/chat/transformation.py b/litellm/llms/huggingface/chat/transformation.py index 2f9824b6773..858fda473ea 100644 --- a/litellm/llms/huggingface/chat/transformation.py +++ b/litellm/llms/huggingface/chat/transformation.py @@ -77,7 +77,7 @@ class HuggingfaceChatConfig(BaseConfig): typical_p: Optional[float] = None, watermark: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/jina_ai/embedding/transformation.py b/litellm/llms/jina_ai/embedding/transformation.py index a8fca201008..5263be900fa 100644 --- a/litellm/llms/jina_ai/embedding/transformation.py +++ b/litellm/llms/jina_ai/embedding/transformation.py @@ -21,7 +21,7 @@ class JinaAIEmbeddingConfig: def __init__( self, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/lm_studio/embed/transformation.py b/litellm/llms/lm_studio/embed/transformation.py index 5ef121ea7a6..1285550c30f 100644 --- a/litellm/llms/lm_studio/embed/transformation.py +++ b/litellm/llms/lm_studio/embed/transformation.py @@ -18,7 +18,7 @@ class LmStudioEmbeddingConfig: def __init__( self, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/maritalk.py b/litellm/llms/maritalk.py index 62fa0113eb5..5f2b8d71bca 100644 --- a/litellm/llms/maritalk.py +++ b/litellm/llms/maritalk.py @@ -33,7 +33,7 @@ class MaritalkConfig(OpenAIGPTConfig): tools: Optional[List[dict]] = None, tool_choice: Optional[Union[str, dict]] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/nlp_cloud/chat/transformation.py b/litellm/llms/nlp_cloud/chat/transformation.py index 35ced50242f..b7967249ab7 100644 --- a/litellm/llms/nlp_cloud/chat/transformation.py +++ b/litellm/llms/nlp_cloud/chat/transformation.py @@ -78,7 +78,7 @@ class NLPCloudConfig(BaseConfig): num_beams: Optional[int] = None, num_return_sequences: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/nvidia_nim/embed.py b/litellm/llms/nvidia_nim/embed.py index 1ab608cbdc1..24c6cc34e4d 100644 --- a/litellm/llms/nvidia_nim/embed.py +++ b/litellm/llms/nvidia_nim/embed.py @@ -32,7 +32,7 @@ class NvidiaNimEmbeddingConfig: input_type: Optional[str] = None, truncate: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py index fcd198b01ae..da981b6afb6 100644 --- a/litellm/llms/ollama/completion/transformation.py +++ b/litellm/llms/ollama/completion/transformation.py @@ -117,7 +117,7 @@ class OllamaConfig(BaseConfig): system: Optional[str] = None, template: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/ollama_chat.py b/litellm/llms/ollama_chat.py index 38fe549ca6b..1047012c2e8 100644 --- a/litellm/llms/ollama_chat.py +++ b/litellm/llms/ollama_chat.py @@ -105,7 +105,7 @@ class OllamaChatConfig(OpenAIGPTConfig): system: Optional[str] = None, template: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/petals/completion/transformation.py b/litellm/llms/petals/completion/transformation.py index dec3f69416a..08ec15de33b 100644 --- a/litellm/llms/petals/completion/transformation.py +++ b/litellm/llms/petals/completion/transformation.py @@ -58,7 +58,7 @@ class PetalsConfig(BaseConfig): top_p: Optional[float] = None, repetition_penalty: Optional[float] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/predibase/chat/transformation.py b/litellm/llms/predibase/chat/transformation.py index b9ca0ff693e..f574238696d 100644 --- a/litellm/llms/predibase/chat/transformation.py +++ b/litellm/llms/predibase/chat/transformation.py @@ -59,7 +59,7 @@ class PredibaseConfig(BaseConfig): typical_p: Optional[float] = None, watermark: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/replicate/chat/transformation.py b/litellm/llms/replicate/chat/transformation.py index 310193ea661..e9934dada83 100644 --- a/litellm/llms/replicate/chat/transformation.py +++ b/litellm/llms/replicate/chat/transformation.py @@ -73,7 +73,7 @@ class ReplicateConfig(BaseConfig): seed: Optional[int] = None, debug: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/sagemaker/completion/transformation.py b/litellm/llms/sagemaker/completion/transformation.py index 4ee4d2ce6a8..d0ab5d06976 100644 --- a/litellm/llms/sagemaker/completion/transformation.py +++ b/litellm/llms/sagemaker/completion/transformation.py @@ -47,7 +47,7 @@ class SagemakerConfig(BaseConfig): temperature: Optional[float] = None, return_full_text: Optional[bool] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index 294c8150169..dff63ce148b 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -179,7 +179,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): presence_penalty: Optional[float] = None, seed: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/ai21/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/ai21/transformation.py index 7ddd1cf89f4..d87b2e0311f 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/ai21/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/ai21/transformation.py @@ -17,7 +17,7 @@ class VertexAIAi21Config: self, max_tokens: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py index 331d378c84d..0278d198062 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py @@ -21,7 +21,7 @@ class VertexAILlama3Config: self, max_tokens: Optional[int] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key == "max_tokens" and value is None: value = self.max_tokens diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index 41eb65be697..0e9c073f8dd 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -48,7 +48,7 @@ class VertexAITextEmbeddingConfig(BaseModel): ] = None, title: Optional[str] = None, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value) diff --git a/litellm/llms/watsonx/completion/transformation.py b/litellm/llms/watsonx/completion/transformation.py index 7e6a8a525d5..ebebbde021d 100644 --- a/litellm/llms/watsonx/completion/transformation.py +++ b/litellm/llms/watsonx/completion/transformation.py @@ -108,7 +108,7 @@ class IBMWatsonXAIConfig(IBMWatsonXMixin, BaseConfig): stream: Optional[bool] = None, **kwargs, ) -> None: - locals_ = locals() + locals_ = locals().copy() for key, value in locals_.items(): if key != "self" and value is not None: setattr(self.__class__, key, value)