openai[patch]: Update extra to match pydantic 2 (#25382)

Backwards compatible change that converts pydantic extras to literals
which is consistent with pydantic 2 usage.
This commit is contained in:
Eugene Yurtsev 2024-08-14 09:55:18 -04:00 committed by GitHub
parent dc51cc5690
commit d00176e523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,13 +21,7 @@ from typing import (
import openai
import tiktoken
from langchain_core.embeddings import Embeddings
from langchain_core.pydantic_v1 import (
BaseModel,
Extra,
Field,
SecretStr,
root_validator,
)
from langchain_core.pydantic_v1 import BaseModel, Field, SecretStr, root_validator
from langchain_core.utils import (
convert_to_secret_str,
get_from_dict_or_env,
@ -261,7 +255,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
class Config:
"""Configuration for this pydantic object."""
extra = Extra.forbid
extra = "forbid"
allow_population_by_field_name = True
@root_validator(pre=True)