test_configurable_fields_prefix_keys() — langchain Function Reference
Architecture documentation for the test_configurable_fields_prefix_keys() function in test_runnable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ddf86e40_c2c3_b694_4853_414f24cfc41c["test_configurable_fields_prefix_keys()"] 26df6ad8_0189_51d0_c3c1_6c3248893ff5["test_runnable.py"] ddf86e40_c2c3_b694_4853_414f24cfc41c -->|defined in| 26df6ad8_0189_51d0_c3c1_6c3248893ff5 style ddf86e40_c2c3_b694_4853_414f24cfc41c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_runnable.py lines 883–934
def test_configurable_fields_prefix_keys(snapshot: SnapshotAssertion) -> None:
fake_chat = FakeListChatModel(responses=["b"]).configurable_fields(
responses=ConfigurableFieldMultiOption(
id="responses",
name="Chat Responses",
options={
"hello": "A good morning to you!",
"bye": "See you later!",
"helpful": "How can I help you?",
},
default=["hello", "bye"],
),
# (sleep is a configurable field in FakeListChatModel)
sleep=ConfigurableField(
id="chat_sleep",
is_shared=True,
),
)
fake_llm = (
FakeListLLM(responses=["a"])
.configurable_fields(
responses=ConfigurableField(
id="responses",
name="LLM Responses",
description="A list of fake responses for this LLM",
)
)
.configurable_alternatives(
ConfigurableField(id="llm", name="LLM"),
chat=fake_chat | StrOutputParser(),
prefix_keys=True,
)
)
prompt = PromptTemplate.from_template("Hello, {name}!").configurable_fields(
template=ConfigurableFieldSingleOption(
id="prompt_template",
name="Prompt Template",
description="The prompt template for this chain",
options={
"hello": "Hello, {name}!",
"good_morning": "A very good morning to you, {name}!",
},
default="hello",
)
)
chain = prompt | fake_llm
if PYDANTIC_VERSION_AT_LEAST_29:
assert _normalize_schema(_schema(chain.config_schema())) == snapshot(
name="schema6"
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_configurable_fields_prefix_keys() do?
test_configurable_fields_prefix_keys() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable.py.
Where is test_configurable_fields_prefix_keys() defined?
test_configurable_fields_prefix_keys() is defined in libs/core/tests/unit_tests/runnables/test_runnable.py at line 883.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free