Home / File/ configurable.py — langchain Source File

configurable.py — langchain Source File

Architecture documentation for configurable.py, a python file in the langchain codebase. 13 imports, 0 dependents.

File python CoreAbstractions Serialization 13 imports 4 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  3e4f3163_58be_ee5e_f841_ae0bd0577190["configurable.py"]
  b188e880_71c6_b93e_127d_c22666293d37["enum"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> b188e880_71c6_b93e_127d_c22666293d37
  242d0b7d_a8ef_b66d_169b_c791b32a9cc9["threading"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 242d0b7d_a8ef_b66d_169b_c791b32a9cc9
  cccbe73e_4644_7211_4d55_e8fb133a8014["abc"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> cccbe73e_4644_7211_4d55_e8fb133a8014
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  c990f2d7_9509_7cea_ca95_51ad57dbe5c6["functools"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> c990f2d7_9509_7cea_ca95_51ad57dbe5c6
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  7610c6f7_1851_b8bd_58e0_076478b94a9c["weakref"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 7610c6f7_1851_b8bd_58e0_076478b94a9c
  6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 91721f45_4909_e489_8c1f_084f8bd87145
  c764ccae_0d75_abec_7c23_6d5d1949a7ba["langchain_core.runnables.base"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> c764ccae_0d75_abec_7c23_6d5d1949a7ba
  2971f9da_6393_a3e3_610e_ace3d35ee978["langchain_core.runnables.config"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 2971f9da_6393_a3e3_610e_ace3d35ee978
  81c04601_d095_a27d_4af1_55e771bb2b6b["langchain_core.runnables.utils"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 81c04601_d095_a27d_4af1_55e771bb2b6b
  8551c22a_c7c2_547e_0f94_77eab59053b3["langchain_core.runnables.graph"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190 --> 8551c22a_c7c2_547e_0f94_77eab59053b3
  style 3e4f3163_58be_ee5e_f841_ae0bd0577190 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""`Runnable` objects that can be dynamically configured."""

from __future__ import annotations

import enum
import threading
from abc import abstractmethod
from collections.abc import (
    AsyncIterator,
    Callable,
    Iterator,
    Sequence,
)
from functools import wraps
from typing import (
    TYPE_CHECKING,
    Any,
    cast,
)
from weakref import WeakValueDictionary

from pydantic import BaseModel, ConfigDict
from typing_extensions import override

from langchain_core.runnables.base import Runnable, RunnableSerializable
from langchain_core.runnables.config import (
    RunnableConfig,
    ensure_config,
    get_config_list,
    get_executor_for_config,
    merge_configs,
)
from langchain_core.runnables.utils import (
    AnyConfigurableField,
    ConfigurableField,
    ConfigurableFieldMultiOption,
    ConfigurableFieldSingleOption,
    ConfigurableFieldSpec,
    Input,
    Output,
    gather_with_concurrency,
    get_unique_config_specs,
)

if TYPE_CHECKING:
    from langchain_core.runnables.graph import Graph


class DynamicRunnable(RunnableSerializable[Input, Output]):
    """Serializable `Runnable` that can be dynamically configured.

    A `DynamicRunnable` should be initiated using the `configurable_fields` or
    `configurable_alternatives` method of a `Runnable`.
    """

    default: RunnableSerializable[Input, Output]
    """The default `Runnable` to use."""

    config: RunnableConfig | None = None
    """The configuration to use."""
// ... (657 more lines)

Subdomains

Dependencies

  • abc
  • collections.abc
  • enum
  • functools
  • langchain_core.runnables.base
  • langchain_core.runnables.config
  • langchain_core.runnables.graph
  • langchain_core.runnables.utils
  • pydantic
  • threading
  • typing
  • typing_extensions
  • weakref

Frequently Asked Questions

What does configurable.py do?
configurable.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 configurable.py?
configurable.py defines 4 function(s): _strremoveprefix, langchain_core, make_options_spec, prefix_config_spec.
What does configurable.py depend on?
configurable.py imports 13 module(s): abc, collections.abc, enum, functools, langchain_core.runnables.base, langchain_core.runnables.config, langchain_core.runnables.graph, langchain_core.runnables.utils, and 5 more.
Where is configurable.py in the architecture?
configurable.py is located at libs/core/langchain_core/runnables/configurable.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