test_image.py — langchain Source File
Architecture documentation for test_image.py, a python file in the langchain codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f0f18051_6b78_f197_e3bd_6f2de3ecd423["test_image.py"] 7025b240_fdc3_cf68_b72f_f41dac94566b["json"] f0f18051_6b78_f197_e3bd_6f2de3ecd423 --> 7025b240_fdc3_cf68_b72f_f41dac94566b 36cce5da_d805_04c3_7e86_e1b4dd49b497["langchain_core.load"] f0f18051_6b78_f197_e3bd_6f2de3ecd423 --> 36cce5da_d805_04c3_7e86_e1b4dd49b497 e6b4f61e_7b98_6666_3641_26b069517d4a["langchain_core.prompts"] f0f18051_6b78_f197_e3bd_6f2de3ecd423 --> e6b4f61e_7b98_6666_3641_26b069517d4a style f0f18051_6b78_f197_e3bd_6f2de3ecd423 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import json
from langchain_core.load import dump, loads
from langchain_core.prompts import ChatPromptTemplate
def test_image_prompt_template_deserializable() -> None:
"""Test that the image prompt template is serializable."""
loads(
dump.dumps(
ChatPromptTemplate.from_messages(
[("system", [{"type": "image", "image_url": "{img}"}])]
)
),
)
def test_image_prompt_template_deserializable_old() -> None:
"""Test that the image prompt template is serializable."""
loads(
json.dumps(
{
"lc": 1,
"type": "constructor",
"id": ["langchain", "prompts", "chat", "ChatPromptTemplate"],
"kwargs": {
"messages": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"chat",
"SystemMessagePromptTemplate",
],
"kwargs": {
"prompt": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"prompt",
"PromptTemplate",
],
"kwargs": {
"template": "Foo",
"input_variables": [],
"template_format": "f-string",
"partial_variables": {},
},
}
]
},
},
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"chat",
"HumanMessagePromptTemplate",
],
"kwargs": {
"prompt": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"image",
"ImagePromptTemplate",
],
"kwargs": {
"template": {
"url": "data:image/png;base64,{img}"
},
"input_variables": ["img"],
},
},
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"prompt",
"PromptTemplate",
],
"kwargs": {
"template": "{input}",
"input_variables": ["input"],
"template_format": "f-string",
"partial_variables": {},
},
},
]
},
},
],
"input_variables": ["img", "input"],
},
}
),
)
Domain
Subdomains
Functions
Dependencies
- json
- langchain_core.load
- langchain_core.prompts
Source
Frequently Asked Questions
What does test_image.py do?
test_image.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_image.py?
test_image.py defines 2 function(s): test_image_prompt_template_deserializable, test_image_prompt_template_deserializable_old.
What does test_image.py depend on?
test_image.py imports 3 module(s): json, langchain_core.load, langchain_core.prompts.
Where is test_image.py in the architecture?
test_image.py is located at libs/core/tests/unit_tests/prompts/test_image.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/prompts).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free