Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate direct access to globals like debug and verbose. #11311

Merged
merged 29 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6a928c4
Move globals like `debug` and `verbose` to their own module.
obi1kenobi Oct 2, 2023
eaacf21
Fix lint.
obi1kenobi Oct 2, 2023
0769605
Fix function name.
obi1kenobi Oct 2, 2023
c45c367
Delint.
obi1kenobi Oct 2, 2023
30d8b4f
Delint, take two.
obi1kenobi Oct 2, 2023
f266fba
Workaround for duplicated attributes depending on how they are imported.
obi1kenobi Oct 2, 2023
bbb9987
Merge branch 'master' into pg/move_globals_to_own_module
obi1kenobi Oct 2, 2023
e4e3371
Update state-resetting code.
obi1kenobi Oct 2, 2023
c238b02
Delint.
obi1kenobi Oct 2, 2023
30f8dbc
Add warnings to the repo.
obi1kenobi Oct 2, 2023
d0a28ab
Merge branch 'master' into pg/move_globals_to_own_module
obi1kenobi Oct 3, 2023
7ed2616
Merge branch 'master' into pg/move_globals_to_own_module
obi1kenobi Oct 4, 2023
8154f48
Add explicit `get_<X>()` functions.
obi1kenobi Oct 9, 2023
454c0c8
Update docs to point to new locations.
obi1kenobi Oct 9, 2023
c7b5abf
Remove type hints since type checkers seem to read `__getattr__()`.
obi1kenobi Oct 9, 2023
39baef0
Remove unused imports.
obi1kenobi Oct 9, 2023
6888c55
Import the underscored values in the top level `__init__`.
obi1kenobi Oct 9, 2023
0fbda65
Do not report warnings when using deprecated code internally.
obi1kenobi Oct 9, 2023
4596710
Move `globals` to be a top-level `langchain` namespace.
obi1kenobi Oct 9, 2023
97e398e
Fix test imports.
obi1kenobi Oct 9, 2023
1af7da5
Fix type hint.
obi1kenobi Oct 9, 2023
ef840a1
Use underscored underlying values in tests.
obi1kenobi Oct 9, 2023
41f2e31
Ruff lint.
obi1kenobi Oct 9, 2023
a6260b7
Fix type hint.
obi1kenobi Oct 9, 2023
42c8a9f
Merge branch 'master' into pg/move_globals_to_own_module
hwchase17 Oct 11, 2023
0c55aa1
Merge branch 'pg/move_globals_to_own_module' of github.com:hwchase17/…
hwchase17 Oct 11, 2023
5560519
cr
hwchase17 Oct 11, 2023
c0562d4
cr
hwchase17 Oct 12, 2023
c780715
Merge branch 'master' into pg/move_globals_to_own_module
hwchase17 Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Import the underscored values in the top level __init__.
  • Loading branch information
obi1kenobi committed Oct 9, 2023
commit 6888c55592fb85113070d0c02f6eab17d0807504
12 changes: 6 additions & 6 deletions libs/langchain/langchain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __getattr__(name: str) -> Any:

return SerpAPIWrapper
elif name == "verbose":
from langchain.utils.globals import verbose
from langchain.utils.globals import _verbose

_warn_on_import(
name,
Expand All @@ -335,9 +335,9 @@ def __getattr__(name: str) -> Any:
),
)

return verbose
return _verbose
elif name == "debug":
from langchain.utils.globals import debug
from langchain.utils.globals import _debug

_warn_on_import(
name,
Expand All @@ -347,9 +347,9 @@ def __getattr__(name: str) -> Any:
),
)

return debug
return _debug
elif name == "llm_cache":
from langchain.utils.globals import llm_cache
from langchain.utils.globals import _llm_cache

_warn_on_import(
name,
Expand All @@ -359,7 +359,7 @@ def __getattr__(name: str) -> Any:
),
)

return llm_cache
return _llm_cache
else:
raise AttributeError(f"Could not find: {name}")

Expand Down
Loading