Skip to content

The agent engineering platform.

Remove check preventing passing non-declared config keys (#18276)

Nuno Camposd9fd1194f5aa
diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py
index 900efb1f9f..da4750bd55 100644
--- a/libs/core/langchain_core/runnables/base.py
+++ b/libs/core/langchain_core/runnables/base.py
@@ -3995,16 +3995,6 @@ class RunnableBindingBase(RunnableSerializable[Input, Output]):
runnable with a custom type.
**other_kwargs: Unpacked into the base class.
"""
- config = config or {}
- # config_specs contains the list of valid `configurable` keys
- if configurable := config.get("configurable", None):
- allowed_keys = set(s.id for s in bound.config_specs)
- for key in configurable:
- if key not in allowed_keys:
- raise ValueError(
- f"Configurable key '{key}' not found in runnable with"
- f" config keys: {allowed_keys}"
- )
super().__init__(
bound=bound,
kwargs=kwargs or {},
diff --git a/libs/core/tests/unit_tests/runnables/test_runnable.py b/libs/core/tests/unit_tests/runnables/test_runnable.py
index 935613a18b..696a70520b 100644
--- a/libs/core/tests/unit_tests/runnables/test_runnable.py
+++ b/libs/core/tests/unit_tests/runnables/test_runnable.py
@@ -1278,9 +1278,6 @@ def test_configurable_fields_example() -> None:
},
}
- with pytest.raises(ValueError):
- chain_configurable.with_config(configurable={"llm123": "chat"})
-
assert (
chain_configurable.with_config(configurable={"llm": "chat"}).invoke(
{"name": "John"}