Home / Function/ prefix_config_spec() — langchain Function Reference

prefix_config_spec() — langchain Function Reference

Architecture documentation for the prefix_config_spec() function in configurable.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dc734e0e_15cb_b654_e4f2_f99ac3a98d12["prefix_config_spec()"]
  3e4f3163_58be_ee5e_f841_ae0bd0577190["configurable.py"]
  dc734e0e_15cb_b654_e4f2_f99ac3a98d12 -->|defined in| 3e4f3163_58be_ee5e_f841_ae0bd0577190
  573172fd_cfaa_25dc_85e0_93df3c28864d["config_specs()"]
  573172fd_cfaa_25dc_85e0_93df3c28864d -->|calls| dc734e0e_15cb_b654_e4f2_f99ac3a98d12
  style dc734e0e_15cb_b654_e4f2_f99ac3a98d12 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/configurable.py lines 646–672

def prefix_config_spec(
    spec: ConfigurableFieldSpec, prefix: str
) -> ConfigurableFieldSpec:
    """Prefix the id of a `ConfigurableFieldSpec`.

    This is useful when a `RunnableConfigurableAlternatives` is used as a
    `ConfigurableField` of another `RunnableConfigurableAlternatives`.

    Args:
        spec: The `ConfigurableFieldSpec` to prefix.
        prefix: The prefix to add.

    Returns:
        The prefixed `ConfigurableFieldSpec`.
    """
    return (
        ConfigurableFieldSpec(
            id=f"{prefix}/{spec.id}",
            name=spec.name,
            description=spec.description,
            annotation=spec.annotation,
            default=spec.default,
            is_shared=spec.is_shared,
        )
        if not spec.is_shared
        else spec
    )

Subdomains

Called By

Frequently Asked Questions

What does prefix_config_spec() do?
prefix_config_spec() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/configurable.py.
Where is prefix_config_spec() defined?
prefix_config_spec() is defined in libs/core/langchain_core/runnables/configurable.py at line 646.
What calls prefix_config_spec()?
prefix_config_spec() is called by 1 function(s): config_specs.

Analyze Your Own Codebase

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

Try Supermodel Free