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 960b4f95bb30..7ad673b9f500 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -70,7 +70,7 @@ def __init__( 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 e2510d6a9831..7a260b6f9492 100644 --- a/litellm/llms/anthropic/completion/transformation.py +++ b/litellm/llms/anthropic/completion/transformation.py @@ -72,7 +72,7 @@ def __init__( 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 60527381f665..aa09fb30611b 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -63,7 +63,7 @@ def __init__( 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 42b29120b145..460c2bbeaca5 100644 --- a/litellm/llms/bedrock/chat/invoke_handler.py +++ b/litellm/llms/bedrock/chat/invoke_handler.py @@ -103,7 +103,7 @@ def __init__( 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 48e21ce602aa..50fa6f170b30 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 @@ def __init__( 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 f276e390b2e7..e9479c8f3229 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 @@ def __init__( 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 f45e49672b9e..9f84844fcb6a 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 @@ def __init__( 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 761fab7465e7..ef3c237f9d0d 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 @@ def __init__( 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 e16946f3ed2e..367fb84d1ac6 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 @@ def __init__( 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 5f86c2252909..085cf0b9ca77 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 @@ def __init__( 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 b227eb8223a5..ca8c0bf98127 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 @@ def __init__( 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 63219868f4f3..2747551af81b 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 8244a9a334aa..a68bc6962c8e 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 880881e97126..698ecca94ba2 100644 --- a/litellm/llms/bedrock/image/amazon_stability1_transformation.py +++ b/litellm/llms/bedrock/image/amazon_stability1_transformation.py @@ -49,7 +49,7 @@ def __init__( 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 299dd8637cd4..916da7388397 100644 --- a/litellm/llms/clarifai/chat/transformation.py +++ b/litellm/llms/clarifai/chat/transformation.py @@ -45,7 +45,7 @@ def __init__( 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 ba1e0697ed5a..1ef6da5a4bd0 100644 --- a/litellm/llms/cloudflare/chat/transformation.py +++ b/litellm/llms/cloudflare/chat/transformation.py @@ -44,7 +44,7 @@ def __init__( 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 1d68735224ef..3ceec2dbba4c 100644 --- a/litellm/llms/cohere/chat/transformation.py +++ b/litellm/llms/cohere/chat/transformation.py @@ -104,7 +104,7 @@ def __init__( 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 7c01523571f4..bdfcda020ef1 100644 --- a/litellm/llms/cohere/completion/transformation.py +++ b/litellm/llms/cohere/completion/transformation.py @@ -86,7 +86,7 @@ def __init__( 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 7e5c1f6c23da..94e0203459a8 100644 --- a/litellm/llms/databricks/chat/transformation.py +++ b/litellm/llms/databricks/chat/transformation.py @@ -37,7 +37,7 @@ def __init__( 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 8c7e11971447..53e3b30dd213 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 a4c5d155f486..81ad13464141 100644 --- a/litellm/llms/deprecated_providers/aleph_alpha.py +++ b/litellm/llms/deprecated_providers/aleph_alpha.py @@ -145,7 +145,7 @@ def __init__( 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 4afc952a51a4..3039222c0e21 100644 --- a/litellm/llms/deprecated_providers/palm.py +++ b/litellm/llms/deprecated_providers/palm.py @@ -63,7 +63,7 @@ def __init__( 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 313bb99af74e..6aa4cf5b52fd 100644 --- a/litellm/llms/gemini/chat/transformation.py +++ b/litellm/llms/gemini/chat/transformation.py @@ -57,7 +57,7 @@ def __init__( 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 2f9824b67736..858fda473ea8 100644 --- a/litellm/llms/huggingface/chat/transformation.py +++ b/litellm/llms/huggingface/chat/transformation.py @@ -77,7 +77,7 @@ def __init__( 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 a8fca2010086..5263be900fa7 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 5ef121ea7a6a..1285550c30f9 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 62fa0113eb54..5f2b8d71bca0 100644 --- a/litellm/llms/maritalk.py +++ b/litellm/llms/maritalk.py @@ -33,7 +33,7 @@ def __init__( 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 35ced50242f6..b7967249ab71 100644 --- a/litellm/llms/nlp_cloud/chat/transformation.py +++ b/litellm/llms/nlp_cloud/chat/transformation.py @@ -78,7 +78,7 @@ def __init__( 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 1ab608cbdc1b..24c6cc34e4d6 100644 --- a/litellm/llms/nvidia_nim/embed.py +++ b/litellm/llms/nvidia_nim/embed.py @@ -32,7 +32,7 @@ def __init__( 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 fcd198b01ae4..da981b6afb6d 100644 --- a/litellm/llms/ollama/completion/transformation.py +++ b/litellm/llms/ollama/completion/transformation.py @@ -117,7 +117,7 @@ def __init__( 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 38fe549ca6b3..1047012c2e8f 100644 --- a/litellm/llms/ollama_chat.py +++ b/litellm/llms/ollama_chat.py @@ -105,7 +105,7 @@ def __init__( 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 dec3f69416a9..08ec15de33b9 100644 --- a/litellm/llms/petals/completion/transformation.py +++ b/litellm/llms/petals/completion/transformation.py @@ -58,7 +58,7 @@ def __init__( 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 b9ca0ff693eb..f574238696d6 100644 --- a/litellm/llms/predibase/chat/transformation.py +++ b/litellm/llms/predibase/chat/transformation.py @@ -59,7 +59,7 @@ def __init__( 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 310193ea6613..e9934dada83f 100644 --- a/litellm/llms/replicate/chat/transformation.py +++ b/litellm/llms/replicate/chat/transformation.py @@ -73,7 +73,7 @@ def __init__( 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 4ee4d2ce6a86..d0ab5d069760 100644 --- a/litellm/llms/sagemaker/completion/transformation.py +++ b/litellm/llms/sagemaker/completion/transformation.py @@ -47,7 +47,7 @@ def __init__( 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 294c81501699..dff63ce148b8 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 @@ def __init__( 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 7ddd1cf89f4c..d87b2e0311f0 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 @@ def __init__( 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 331d378c84d1..0278d1980629 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 @@ def __init__( 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 41eb65be6970..0e9c073f8ddf 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -48,7 +48,7 @@ def __init__( ] = 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 7e6a8a525d50..ebebbde021d9 100644 --- a/litellm/llms/watsonx/completion/transformation.py +++ b/litellm/llms/watsonx/completion/transformation.py @@ -108,7 +108,7 @@ def __init__( 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)