config.py — langchain Source File
Architecture documentation for config.py, a python file in the langchain codebase. 15 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4d16987d_fe07_22bb_f46d_7daeb24e0367["config.py"] a327e534_84f6_5308_58ca_5727d5eda0cf["asyncio"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> a327e534_84f6_5308_58ca_5727d5eda0cf 8dfa0cac_d802_3ccd_f710_43a5e70da3a5["uuid"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 8dfa0cac_d802_3ccd_f710_43a5e70da3a5 0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 0c635125_6987_b8b3_7ff7_d60249aecde7 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 082415a8_067b_221f_7984_07d87009267d["concurrent.futures"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 082415a8_067b_221f_7984_07d87009267d 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56["contextlib"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56 e7c46dc4_ca3a_87ac_156f_0aa3d9b9d3f4["contextvars"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> e7c46dc4_ca3a_87ac_156f_0aa3d9b9d3f4 c990f2d7_9509_7cea_ca95_51ad57dbe5c6["functools"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> c990f2d7_9509_7cea_ca95_51ad57dbe5c6 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 ae8a5181_678b_4c6a_5dab_f5850ee1ed20["langsmith.run_helpers"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> ae8a5181_678b_4c6a_5dab_f5850ee1ed20 91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 91721f45_4909_e489_8c1f_084f8bd87145 e8ec017e_6c91_4b34_675f_2a96c5aa9be6["langchain_core.callbacks.manager"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> e8ec017e_6c91_4b34_675f_2a96c5aa9be6 81c04601_d095_a27d_4af1_55e771bb2b6b["langchain_core.runnables.utils"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> 81c04601_d095_a27d_4af1_55e771bb2b6b ec9bee24_c773_b0b6_adc6_6ee890d32c05["langchain_core.tracers.langchain"] 4d16987d_fe07_22bb_f46d_7daeb24e0367 --> ec9bee24_c773_b0b6_adc6_6ee890d32c05 style 4d16987d_fe07_22bb_f46d_7daeb24e0367 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Configuration utilities for `Runnable` objects."""
from __future__ import annotations
import asyncio
# Cannot move uuid to TYPE_CHECKING as RunnableConfig is used in Pydantic models
import uuid # noqa: TC003
import warnings
from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Sequence
from concurrent.futures import Executor, Future, ThreadPoolExecutor
from contextlib import contextmanager
from contextvars import Context, ContextVar, Token, copy_context
from functools import partial
from typing import (
TYPE_CHECKING,
Any,
ParamSpec,
TypeVar,
cast,
)
from langsmith.run_helpers import _set_tracing_context, get_tracing_context
from typing_extensions import TypedDict
from langchain_core.callbacks.manager import AsyncCallbackManager, CallbackManager
from langchain_core.runnables.utils import (
Input,
Output,
accepts_config,
accepts_run_manager,
)
from langchain_core.tracers.langchain import LangChainTracer
if TYPE_CHECKING:
from langchain_core.callbacks.base import BaseCallbackManager, Callbacks
from langchain_core.callbacks.manager import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
else:
# Pydantic validates through typed dicts, but
# the callbacks need forward refs updated
Callbacks = list | Any | None
class EmptyDict(TypedDict, total=False):
"""Empty dict type."""
class RunnableConfig(TypedDict, total=False):
"""Configuration for a `Runnable`.
!!! note Custom values
The `TypedDict` has `total=False` set intentionally to:
- Allow partial configs to be created and merged together via `merge_configs`
- Support config propagation from parent to child runnables via
`var_child_runnable_config` (a `ContextVar` that automatically passes
// ... (573 more lines)
Domain
Subdomains
Functions
- Callbacks()
- _set_config_context()
- acall_func_with_variable_args()
- call_func_with_variable_args()
- ensure_config()
- get_async_callback_manager_for_config()
- get_callback_manager_for_config()
- get_config_list()
- get_executor_for_config()
- langchain_core()
- merge_configs()
- patch_config()
- run_in_executor()
- set_config_context()
Dependencies
- asyncio
- collections.abc
- concurrent.futures
- contextlib
- contextvars
- functools
- langchain_core.callbacks.base
- langchain_core.callbacks.manager
- langchain_core.runnables.utils
- langchain_core.tracers.langchain
- langsmith.run_helpers
- typing
- typing_extensions
- uuid
- warnings
Source
Frequently Asked Questions
What does config.py do?
config.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in config.py?
config.py defines 14 function(s): Callbacks, _set_config_context, acall_func_with_variable_args, call_func_with_variable_args, ensure_config, get_async_callback_manager_for_config, get_callback_manager_for_config, get_config_list, get_executor_for_config, langchain_core, and 4 more.
What does config.py depend on?
config.py imports 15 module(s): asyncio, collections.abc, concurrent.futures, contextlib, contextvars, functools, langchain_core.callbacks.base, langchain_core.callbacks.manager, and 7 more.
Where is config.py in the architecture?
config.py is located at libs/core/langchain_core/runnables/config.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/runnables).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free