|
|
|
@ -878,6 +878,16 @@ class AsyncCallbackManager(BaseCallbackManager):
|
|
|
|
|
T = TypeVar("T", CallbackManager, AsyncCallbackManager)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def env_var_is_set(env_var: str) -> bool:
|
|
|
|
|
"""Check if an environment variable is set."""
|
|
|
|
|
return env_var in os.environ and os.environ[env_var] not in (
|
|
|
|
|
"",
|
|
|
|
|
"0",
|
|
|
|
|
"false",
|
|
|
|
|
"False",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _configure(
|
|
|
|
|
callback_manager_cls: Type[T],
|
|
|
|
|
inheritable_callbacks: Callbacks = None,
|
|
|
|
@ -911,18 +921,17 @@ def _configure(
|
|
|
|
|
wandb_tracer = wandb_tracing_callback_var.get()
|
|
|
|
|
open_ai = openai_callback_var.get()
|
|
|
|
|
tracing_enabled_ = (
|
|
|
|
|
os.environ.get("LANGCHAIN_TRACING") is not None
|
|
|
|
|
env_var_is_set("LANGCHAIN_TRACING")
|
|
|
|
|
or tracer is not None
|
|
|
|
|
or os.environ.get("LANGCHAIN_HANDLER") is not None
|
|
|
|
|
or env_var_is_set("LANGCHAIN_HANDLER")
|
|
|
|
|
)
|
|
|
|
|
wandb_tracing_enabled_ = (
|
|
|
|
|
os.environ.get("LANGCHAIN_WANDB_TRACING") is not None
|
|
|
|
|
or wandb_tracer is not None
|
|
|
|
|
env_var_is_set("LANGCHAIN_WANDB_TRACING") or wandb_tracer is not None
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
tracer_v2 = tracing_v2_callback_var.get()
|
|
|
|
|
tracing_v2_enabled_ = (
|
|
|
|
|
os.environ.get("LANGCHAIN_TRACING_V2") is not None or tracer_v2 is not None
|
|
|
|
|
env_var_is_set("LANGCHAIN_TRACING_V2") or tracer_v2 is not None
|
|
|
|
|
)
|
|
|
|
|
tracer_session = os.environ.get("LANGCHAIN_SESSION")
|
|
|
|
|
debug = _get_debug()
|
|
|
|
|