test_schema_for_prompt_and_chat_model() — langchain Function Reference
Architecture documentation for the test_schema_for_prompt_and_chat_model() function in test_runnable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a8dbcb06_d442_ce77_ad24_b970defbb338["test_schema_for_prompt_and_chat_model()"] 26df6ad8_0189_51d0_c3c1_6c3248893ff5["test_runnable.py"] a8dbcb06_d442_ce77_ad24_b970defbb338 -->|defined in| 26df6ad8_0189_51d0_c3c1_6c3248893ff5 fb618d44_c03b_ea8b_385b_2278dfb173d4["invoke()"] a8dbcb06_d442_ce77_ad24_b970defbb338 -->|calls| fb618d44_c03b_ea8b_385b_2278dfb173d4 style a8dbcb06_d442_ce77_ad24_b970defbb338 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_runnable.py lines 5687–5722
def test_schema_for_prompt_and_chat_model() -> None:
"""Test schema generation for prompt and chat model.
Testing that schema is generated properly when using variable names
that collide with pydantic attributes.
"""
prompt = ChatPromptTemplate([("system", "{model_json_schema}, {_private}, {json}")])
chat_res = "i'm a chatbot"
# sleep to better simulate a real stream
chat = FakeListChatModel(responses=[chat_res], sleep=0.01)
chain = prompt | chat
assert (
chain.invoke(
{
"model_json_schema": "hello",
"_private": "goodbye",
"json": "json",
}
).content
== chat_res
)
assert chain.get_input_jsonschema() == {
"properties": {
"model_json_schema": {"title": "Model Json Schema", "type": "string"},
"_private": {"title": "Private", "type": "string"},
"json": {"title": "Json", "type": "string"},
},
"required": [
"_private",
"json",
"model_json_schema",
],
"title": "PromptInput",
"type": "object",
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_schema_for_prompt_and_chat_model() do?
test_schema_for_prompt_and_chat_model() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable.py.
Where is test_schema_for_prompt_and_chat_model() defined?
test_schema_for_prompt_and_chat_model() is defined in libs/core/tests/unit_tests/runnables/test_runnable.py at line 5687.
What does test_schema_for_prompt_and_chat_model() call?
test_schema_for_prompt_and_chat_model() calls 1 function(s): invoke.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free