Home / Function/ get_config_list() — langchain Function Reference

get_config_list() — langchain Function Reference

Architecture documentation for the get_config_list() function in config.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  37e84640_8b54_30cc_8d8f_b98bb4730786["get_config_list()"]
  4d16987d_fe07_22bb_f46d_7daeb24e0367["config.py"]
  37e84640_8b54_30cc_8d8f_b98bb4730786 -->|defined in| 4d16987d_fe07_22bb_f46d_7daeb24e0367
  10f85dc9_a2b1_ad35_7d02_3749f6491bef["map()"]
  37e84640_8b54_30cc_8d8f_b98bb4730786 -->|calls| 10f85dc9_a2b1_ad35_7d02_3749f6491bef
  79a92f47_0451_ce36_938e_d386903a786f["ensure_config()"]
  37e84640_8b54_30cc_8d8f_b98bb4730786 -->|calls| 79a92f47_0451_ce36_938e_d386903a786f
  style 37e84640_8b54_30cc_8d8f_b98bb4730786 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/config.py lines 269–312

def get_config_list(
    config: RunnableConfig | Sequence[RunnableConfig] | None, length: int
) -> list[RunnableConfig]:
    """Get a list of configs from a single config or a list of configs.

     It is useful for subclasses overriding batch() or abatch().

    Args:
        config: The config or list of configs.
        length: The length of the list.

    Returns:
        The list of configs.

    Raises:
        ValueError: If the length of the list is not equal to the length of the inputs.

    """
    if length < 0:
        msg = f"length must be >= 0, but got {length}"
        raise ValueError(msg)
    if isinstance(config, Sequence) and len(config) != length:
        msg = (
            f"config must be a list of the same length as inputs, "
            f"but got {len(config)} configs for {length} inputs"
        )
        raise ValueError(msg)

    if isinstance(config, Sequence):
        return list(map(ensure_config, config))
    if length > 1 and isinstance(config, dict) and config.get("run_id") is not None:
        warnings.warn(
            "Provided run_id be used only for the first element of the batch.",
            category=RuntimeWarning,
            stacklevel=3,
        )
        subsequent = cast(
            "RunnableConfig", {k: v for k, v in config.items() if k != "run_id"}
        )
        return [
            ensure_config(subsequent) if i else ensure_config(config)
            for i in range(length)
        ]
    return [ensure_config(config) for i in range(length)]

Subdomains

Frequently Asked Questions

What does get_config_list() do?
get_config_list() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/config.py.
Where is get_config_list() defined?
get_config_list() is defined in libs/core/langchain_core/runnables/config.py at line 269.
What does get_config_list() call?
get_config_list() calls 2 function(s): ensure_config, map.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free