diff --git a/litellm/main.py b/litellm/main.py index 7a341961f8..6a665e4a90 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1717,11 +1717,12 @@ def embedding( - exception_type: If an exception occurs during the API call. """ azure = kwargs.get("azure", None) + client = kwargs.pop("client", None) + optional_params = {} for param in kwargs: if param != "metadata": # filter out metadata from optional_params optional_params[param] = kwargs[param] - model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider(model=model, custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key) try: response = None @@ -1766,7 +1767,7 @@ def embedding( timeout=timeout, model_response=EmbeddingResponse(), optional_params=optional_params, - client=optional_params.pop("client", None) + client=client ) elif model in litellm.open_ai_embedding_models or custom_llm_provider == "openai": api_base = ( @@ -1801,7 +1802,7 @@ def embedding( timeout=timeout, model_response=EmbeddingResponse(), optional_params=optional_params, - client=optional_params.pop("client", None) + client=client ) elif model in litellm.cohere_embedding_models: cohere_key = (