Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
globals.py73 linesDownload Raw Back to langchain_core
1"""Global values and configuration that apply to all of LangChain."""2 3from typing import TYPE_CHECKING, Optional4 5if TYPE_CHECKING:6    from langchain_core.caches import BaseCache7 8 9# DO NOT USE THESE VALUES DIRECTLY!10# Use them only via `get_<X>()` and `set_<X>()` below,11# or else your code may behave unexpectedly with other uses of these global settings:12# https://github.com/langchain-ai/langchain/pull/11311#issuecomment-174378000413_verbose: bool = False14_debug: bool = False15_llm_cache: Optional["BaseCache"] = None16 17 18def set_verbose(value: bool) -> None:  # noqa: FBT00119    """Set a new value for the `verbose` global setting.20 21    Args:22        value: The new value for the `verbose` global setting.23    """24    global _verbose  # noqa: PLW060325    _verbose = value26 27 28def get_verbose() -> bool:29    """Get the value of the `verbose` global setting.30 31    Returns:32        The value of the `verbose` global setting.33    """34    return _verbose35 36 37def set_debug(value: bool) -> None:  # noqa: FBT00138    """Set a new value for the `debug` global setting.39 40    Args:41        value: The new value for the `debug` global setting.42    """43    global _debug  # noqa: PLW060344    _debug = value45 46 47def get_debug() -> bool:48    """Get the value of the `debug` global setting.49 50    Returns:51        The value of the `debug` global setting.52    """53    return _debug54 55 56def set_llm_cache(value: Optional["BaseCache"]) -> None:57    """Set a new LLM cache, overwriting the previous value, if any.58 59    Args:60        value: The new LLM cache to use. If `None`, the LLM cache is disabled.61    """62    global _llm_cache  # noqa: PLW060363    _llm_cache = value64 65 66def get_llm_cache() -> Optional["BaseCache"]:67    """Get the value of the `llm_cache` global setting.68 69    Returns:70        The value of the `llm_cache` global setting.71    """72    return _llm_cache73 
codekingpro/portable-devtools · Team Ai