1717
1818from langchain_community .utils .openai import is_openai_v1
1919from langchain_core .embeddings import Embeddings
20- from pydantic import BaseModel , Field , model_validator
20+ from langchain_core . pydantic_v1 import BaseModel , Field , root_validator
2121from langchain_core .utils import get_from_dict_or_env , get_pydantic_field_names
2222from tenacity import (
2323 AsyncRetrying ,
@@ -171,9 +171,9 @@ class LocalAIEmbeddings(BaseModel, Embeddings):
171171 class Config :
172172 """Configuration for this pydantic object."""
173173
174- populate_by_name = True
174+ allow_population_by_field_name = True
175175
176- @model_validator ( mode = 'before' )
176+ @root_validator ( pre = True )
177177 def build_extra (cls , values : Dict [str , Any ]) -> Dict [str , Any ]:
178178 """Build extra kwargs from additional params that were passed in."""
179179 all_required_field_names = get_pydantic_field_names (cls )
@@ -199,7 +199,7 @@ def build_extra(cls, values: Dict[str, Any]) -> Dict[str, Any]:
199199 values ["model_kwargs" ] = extra
200200 return values
201201
202- @model_validator ( mode = 'after' )
202+ @root_validator ( )
203203 def validate_environment (cls , values : Dict ) -> Dict :
204204 """Validate that api key and python package exists in environment."""
205205 values ["openai_api_key" ] = get_from_dict_or_env (
0 commit comments