mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
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.
This commit is contained in:
parent
201bdf7148
commit
09c2d8faca
@ -302,19 +302,8 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
|||||||
values["openai_proxy"] = get_from_dict_or_env(
|
values["openai_proxy"] = get_from_dict_or_env(
|
||||||
values, "openai_proxy", "OPENAI_PROXY", default=""
|
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"] = get_from_dict_or_env(
|
||||||
values,
|
values, "openai_api_version", "OPENAI_API_VERSION", default=""
|
||||||
"openai_api_version",
|
|
||||||
"OPENAI_API_VERSION",
|
|
||||||
default=default_api_version,
|
|
||||||
)
|
)
|
||||||
# Check OPENAI_ORGANIZATION for backwards compatibility.
|
# Check OPENAI_ORGANIZATION for backwards compatibility.
|
||||||
values["openai_organization"] = (
|
values["openai_organization"] = (
|
||||||
|
Loading…
Reference in New Issue
Block a user