Nat
Nat

Reputation: 91

Using AzureOpenAIEmbeddings for vector search, gives a constant error

I'm trying to write the following code and it gives me an error. Tried everything, it doesn't work! using

langchain Version: 0.3.19, python 3.11 langchain-openai Version: 0.3.6

Code:

from langchain_openai import AzureOpenAIEmbeddings

openai_embeddings = AzureOpenAIEmbeddings(
    azure_endpoint ="https://****.openai.azure.com/openai",
    deployment = "text-embedding-3-large",
    openai_api_version = "2023-05-15",
    openai_api_key = "****"
)

Later i'm using it for the AzureCosmosDBNoSqlVectorSearch function.

This is the Error:

File "C:\Users\****.py", line 64, in <module>
    openai_embeddings = AzureOpenAIEmbeddings(
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\....\venv\Lib\site-packages\pydantic\main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for AzureOpenAIEmbeddings
  Value error, As of openai>=1.0.0, Azure endpoints should be specified via the `azure_endpoint` param not `openai_api_base` (or alias `base_url`).  [type=value_error, input_value={'azure_endpoint': 'https...te', 'model_kwargs': {}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error

Upvotes: 0

Views: 15

Answers (0)

Related Questions