test_chat_prompt_template_data_prompt_from_message() — langchain Function Reference
Architecture documentation for the test_chat_prompt_template_data_prompt_from_message() function in test_chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cc6489a8_106d_3877_f15a_fe23014c4b5a["test_chat_prompt_template_data_prompt_from_message()"] bf3138ca_0068_68ea_f479_35376e264d13["test_chat.py"] cc6489a8_106d_3877_f15a_fe23014c4b5a -->|defined in| bf3138ca_0068_68ea_f479_35376e264d13 style cc6489a8_106d_3877_f15a_fe23014c4b5a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_chat.py lines 1414–1458
def test_chat_prompt_template_data_prompt_from_message(
template_format: PromptTemplateFormat,
cache_control_placeholder: str,
source_data_placeholder: str,
) -> None:
prompt: dict[str, Any] = {
"type": "image",
"source_type": "base64",
"data": f"{source_data_placeholder}",
}
template = ChatPromptTemplate.from_messages(
[("human", [prompt])], template_format=template_format
)
assert template.format_messages(source_data="base64data") == [
HumanMessage(
content=[
{
"type": "image",
"source_type": "base64",
"data": "base64data",
}
]
)
]
# metadata
prompt["metadata"] = {"cache_control": {"type": f"{cache_control_placeholder}"}}
template = ChatPromptTemplate.from_messages(
[("human", [prompt])], template_format=template_format
)
assert template.format_messages(
cache_type="ephemeral", source_data="base64data"
) == [
HumanMessage(
content=[
{
"type": "image",
"source_type": "base64",
"data": "base64data",
"metadata": {"cache_control": {"type": "ephemeral"}},
}
]
)
]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_chat_prompt_template_data_prompt_from_message() do?
test_chat_prompt_template_data_prompt_from_message() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_chat.py.
Where is test_chat_prompt_template_data_prompt_from_message() defined?
test_chat_prompt_template_data_prompt_from_message() is defined in libs/core/tests/unit_tests/prompts/test_chat.py at line 1414.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free