mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-21 18:37:04 +00:00
core[patch]: substantially speed up @deprecated (#29016)
Resolves https://github.com/langchain-ai/langchain/issues/26918 Unit tests don't raise any additional `LangChainDeprecationWarning`. Would like guidance on how to test this more thoroughly if needed. Note: speed up for `bind_tools` path is shown below. This is **redundant** with the speedup in https://github.com/langchain-ai/langchain/pull/29015. I include it for demonstration purposes. Before:  After: 
This commit is contained in:
parent
4bb391fd4e
commit
85403bfa99
@ -14,10 +14,9 @@ def is_caller_internal(depth: int = 2) -> bool:
|
||||
frame = frame.f_back
|
||||
if frame is None:
|
||||
return False
|
||||
caller_module = inspect.getmodule(frame)
|
||||
if caller_module is None:
|
||||
return False
|
||||
caller_module_name = caller_module.__name__
|
||||
# Directly access the module name from the frame's global variables
|
||||
module_globals = frame.f_globals
|
||||
caller_module_name = module_globals.get("__name__", "")
|
||||
return caller_module_name.startswith("langchain")
|
||||
finally:
|
||||
del frame
|
||||
|
Loading…
Reference in New Issue
Block a user