config_specs() — langchain Function Reference
Architecture documentation for the config_specs() function in configurable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4["config_specs()"] 2b6bd8a1_0810_3be0_c02d_ad7e25c2a53b["RunnableConfigurableAlternatives"] e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4 -->|defined in| 2b6bd8a1_0810_3be0_c02d_ad7e25c2a53b b6d577b5_af80_9209_44b7_75aab97908a9["config_specs()"] b6d577b5_af80_9209_44b7_75aab97908a9 -->|calls| e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4 b6d577b5_af80_9209_44b7_75aab97908a9["config_specs()"] e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4 -->|calls| b6d577b5_af80_9209_44b7_75aab97908a9 bb25a3f1_34cb_801a_9218_36e525867d75["prefix_config_spec()"] e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4 -->|calls| bb25a3f1_34cb_801a_9218_36e525867d75 style e4fa5d6f_ff4f_0a27_ba51_9b78f0fb91b4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/configurable.py lines 553–598
def config_specs(self) -> list[ConfigurableFieldSpec]:
with _enums_for_spec_lock:
if which_enum := _enums_for_spec.get(self.which):
pass
else:
which_enum = StrEnum( # type: ignore[call-overload]
self.which.name or self.which.id,
(
(v, v)
for v in [*list(self.alternatives.keys()), self.default_key]
),
)
_enums_for_spec[self.which] = cast("type[StrEnum]", which_enum)
return get_unique_config_specs(
# which alternative
[
ConfigurableFieldSpec(
id=self.which.id,
name=self.which.name,
description=self.which.description,
annotation=which_enum,
default=self.default_key,
is_shared=self.which.is_shared,
),
]
# config specs of the default option
+ (
[
prefix_config_spec(s, f"{self.which.id}=={self.default_key}")
for s in self.default.config_specs
]
if self.prefix_keys
else self.default.config_specs
)
# config specs of the alternatives
+ [
(
prefix_config_spec(s, f"{self.which.id}=={alt_key}")
if self.prefix_keys
else s
)
for alt_key, alt in self.alternatives.items()
if isinstance(alt, RunnableSerializable)
for s in alt.config_specs
]
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does config_specs() do?
config_specs() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/configurable.py.
Where is config_specs() defined?
config_specs() is defined in libs/core/langchain_core/runnables/configurable.py at line 553.
What does config_specs() call?
config_specs() calls 2 function(s): config_specs, prefix_config_spec.
What calls config_specs()?
config_specs() 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