From 09c2d8faca42f09a924599c9d75cc38e05ba1ad4 Mon Sep 17 00:00:00 2001 From: Kyle Winkelman <39207896+kyle-winkelman@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:54:43 -0500 Subject: [PATCH] langchain_openai: Cleanup OpenAIEmbeddings validate_environment. (#25855) **Description:** [This portion of code](https://github.com/langchain-ai/langchain/blob/v0.1.16/libs/partners/openai/langchain_openai/embeddings/base.py#L189-L196) has no use as a couple lines later a [`ValueError` is thrown](https://github.com/langchain-ai/langchain/blob/v0.1.16/libs/partners/openai/langchain_openai/embeddings/base.py#L209-L213). **Issue:** A follow up to #25852. --- .../openai/langchain_openai/embeddings/base.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/libs/partners/openai/langchain_openai/embeddings/base.py b/libs/partners/openai/langchain_openai/embeddings/base.py index 1e78302a9e..3625c34a8a 100644 --- a/libs/partners/openai/langchain_openai/embeddings/base.py +++ b/libs/partners/openai/langchain_openai/embeddings/base.py @@ -302,19 +302,8 @@ class OpenAIEmbeddings(BaseModel, Embeddings): values["openai_proxy"] = get_from_dict_or_env( values, "openai_proxy", "OPENAI_PROXY", default="" ) - if values["openai_api_type"] in ("azure", "azure_ad", "azuread"): - default_api_version = "2023-05-15" - # Azure OpenAI embedding models allow a maximum of 16 texts - # at a time in each batch - # See: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings - values["chunk_size"] = min(values["chunk_size"], 16) - else: - default_api_version = "" values["openai_api_version"] = get_from_dict_or_env( - values, - "openai_api_version", - "OPENAI_API_VERSION", - default=default_api_version, + values, "openai_api_version", "OPENAI_API_VERSION", default="" ) # Check OPENAI_ORGANIZATION for backwards compatibility. values["openai_organization"] = (