test_chat_prompt_template_from_messages_jinja2() — langchain Function Reference
Architecture documentation for the test_chat_prompt_template_from_messages_jinja2() function in test_chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3616470a_1453_64f8_aa3b_37ac964ec2a6["test_chat_prompt_template_from_messages_jinja2()"] bf3138ca_0068_68ea_f479_35376e264d13["test_chat.py"] 3616470a_1453_64f8_aa3b_37ac964ec2a6 -->|defined in| bf3138ca_0068_68ea_f479_35376e264d13 style 3616470a_1453_64f8_aa3b_37ac964ec2a6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_chat.py lines 294–314
def test_chat_prompt_template_from_messages_jinja2() -> None:
template = ChatPromptTemplate.from_messages(
[
("system", "You are a helpful AI bot. Your name is {{ name }}."),
("human", "Hello, how are you doing?"),
("ai", "I'm doing well, thanks!"),
("human", "{{ user_input }}"),
],
"jinja2",
)
messages = template.format_messages(name="Bob", user_input="What is your name?")
assert messages == [
SystemMessage(
content="You are a helpful AI bot. Your name is Bob.", additional_kwargs={}
),
HumanMessage(content="Hello, how are you doing?", additional_kwargs={}),
AIMessage(content="I'm doing well, thanks!", additional_kwargs={}),
HumanMessage(content="What is your name?", additional_kwargs={}),
]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_chat_prompt_template_from_messages_jinja2() do?
test_chat_prompt_template_from_messages_jinja2() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_chat.py.
Where is test_chat_prompt_template_from_messages_jinja2() defined?
test_chat_prompt_template_from_messages_jinja2() is defined in libs/core/tests/unit_tests/prompts/test_chat.py at line 294.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free