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

Instead of accessing `langchain.debug`, `langchain.verbose`, or
`langchain.llm_cache`, please use the new getter/setter functions in
`langchain.globals`:
- `langchain.globals.set_debug()` and `langchain.globals.get_debug()`
- `langchain.globals.set_verbose()` and
`langchain.globals.get_verbose()`
- `langchain.globals.set_llm_cache()` and
`langchain.globals.get_llm_cache()`

Using the old globals directly will now raise a warning.

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
Predrag Gruevski
2023-10-12 18:48:04 -04:00
committed by GitHub
parent 01b7b46908
commit 9e32120cbb
22 changed files with 479 additions and 119 deletions

View File

@@ -135,9 +135,9 @@
"outputs": [],
"source": [
"# We set this so we can see what exactly is going on\n",
"import langchain\n",
"from langchain.globals import set_verbose\n",
"\n",
"langchain.verbose = True"
"set_verbose(True)"
]
},
{
@@ -489,7 +489,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.10.1"
}
},
"nbformat": 4,