最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

langchain - Using AzureOpenAIEmbeddings for vector search, gives a constant error - Stack Overflow

programmeradmin0浏览0评论

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/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 /2.10/v/value_error
发布评论

评论列表(0)

  1. 暂无评论