File tree Expand file tree Collapse file tree 3 files changed +7
-14
lines changed Expand file tree Collapse file tree 3 files changed +7
-14
lines changed Original file line number Diff line number Diff line change 53
53
"LangChainDeprecationWarning" : "deprecation" ,
54
54
"deprecated" : "deprecation" ,
55
55
"surface_langchain_deprecation_warnings" : "deprecation" ,
56
- "suppress_langchain_deprecation_warnings " : "deprecation" ,
56
+ "suppress_langchain_deprecation_warning " : "deprecation" ,
57
57
"warn_deprecated" : "deprecation" ,
58
58
}
59
59
Original file line number Diff line number Diff line change @@ -17,22 +17,15 @@ def create_dynamic_getattr(
17
17
18
18
def _dynamic_getattr (attr_name : str ) -> object :
19
19
module_name = dynamic_imports .get (attr_name )
20
- if module_name is None :
21
- import_error_msg = (
22
- f"cannot import name '{ attr_name } ' from '{ package_name } .{ module_path } '"
23
- )
24
- raise ImportError (import_error_msg )
25
20
26
- if module_name == "__module__" :
27
- attr = import_module (f".{ module_path } .{ attr_name } " , package = package_name )
28
- globals ()[attr_name ] = attr
29
- return attr
21
+ if module_name == "__module__" or module_name is None :
22
+ module = import_module (f".{ module_path } .{ attr_name } " , package = package_name )
23
+ globals ()[attr_name ] = module
24
+ return module
30
25
31
26
module = import_module (f".{ module_path } .{ module_name } " , package = package_name )
32
27
attr = getattr (module , attr_name )
33
-
34
- g = globals ()
35
- g [attr_name ] = attr
28
+ globals ()[attr_name ] = attr
36
29
37
30
# TODO: determine if we want to do this eagerly
38
31
# for k, v_module_name in dynamic_imports.items():
Original file line number Diff line number Diff line change 22
22
),
23
23
pytest .param (
24
24
"from langchain_core.prompts import ChatPromptTemplate" ,
25
- id = "PromChatPromptTemplateptTemplate " ,
25
+ id = "ChatPromptTemplate " ,
26
26
),
27
27
pytest .param ("from langchain_core.documents import Document" , id = "Document" ),
28
28
pytest .param (
You can’t perform that action at this time.
0 commit comments