test_schema_complex_seq() — langchain Function Reference
Architecture documentation for the test_schema_complex_seq() function in test_runnable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cd29b59a_2e4d_7f89_c2ec_514b1a240603["test_schema_complex_seq()"] 26df6ad8_0189_51d0_c3c1_6c3248893ff5["test_runnable.py"] cd29b59a_2e4d_7f89_c2ec_514b1a240603 -->|defined in| 26df6ad8_0189_51d0_c3c1_6c3248893ff5 style cd29b59a_2e4d_7f89_c2ec_514b1a240603 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_runnable.py lines 685–739
def test_schema_complex_seq() -> None:
prompt1 = ChatPromptTemplate.from_template("what is the city {person} is from?")
prompt2 = ChatPromptTemplate.from_template(
"what country is the city {city} in? respond in {language}"
)
model = FakeListChatModel(responses=[""])
chain1: Runnable = RunnableSequence(
prompt1, model, StrOutputParser(), name="city_chain"
)
assert chain1.name == "city_chain"
chain2: Runnable = (
{"city": chain1, "language": itemgetter("language")}
| prompt2
| model
| StrOutputParser()
)
assert chain2.get_input_jsonschema() == {
"title": "RunnableParallel<city,language>Input",
"type": "object",
"properties": {
"person": {"title": "Person", "type": "string"},
"language": {"title": "Language"},
},
"required": ["person", "language"],
}
assert chain2.get_output_jsonschema() == {
"title": "StrOutputParserOutput",
"type": "string",
}
assert chain2.with_types(input_type=str).get_input_jsonschema() == {
"title": "RunnableSequenceInput",
"type": "string",
}
assert chain2.with_types(input_type=int).get_output_jsonschema() == {
"title": "StrOutputParserOutput",
"type": "string",
}
class InputType(BaseModel):
person: str
assert chain2.with_types(input_type=InputType).get_input_jsonschema() == {
"title": "InputType",
"type": "object",
"properties": {"person": {"title": "Person", "type": "string"}},
"required": ["person"],
}
Domain
Subdomains
Source
Frequently Asked Questions
What does test_schema_complex_seq() do?
test_schema_complex_seq() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable.py.
Where is test_schema_complex_seq() defined?
test_schema_complex_seq() is defined in libs/core/tests/unit_tests/runnables/test_runnable.py at line 685.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free