test_prompt_jinja2_extra_input_variables() — langchain Function Reference
Architecture documentation for the test_prompt_jinja2_extra_input_variables() function in test_few_shot.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ac0d4d52_f49c_de3f_8036_a699d9dd88e5["test_prompt_jinja2_extra_input_variables()"] e4e12a36_798e_ddc0_ab57_e44de269c7e7["test_few_shot.py"] ac0d4d52_f49c_de3f_8036_a699d9dd88e5 -->|defined in| e4e12a36_798e_ddc0_ab57_e44de269c7e7 style ac0d4d52_f49c_de3f_8036_a699d9dd88e5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_few_shot.py lines 307–330
def test_prompt_jinja2_extra_input_variables(
example_jinja2_prompt: tuple[PromptTemplate, list[dict[str, str]]],
) -> None:
"""Test error is raised when there are too many input variables."""
prefix = "Starting with {{ foo }}"
suffix = "Ending with {{ bar }}"
with pytest.warns(UserWarning, match="Extra variables:"):
FewShotPromptTemplate(
input_variables=["bar", "foo", "extra", "thing"],
suffix=suffix,
prefix=prefix,
examples=example_jinja2_prompt[1],
example_prompt=example_jinja2_prompt[0],
template_format="jinja2",
validate_template=True,
)
assert FewShotPromptTemplate(
input_variables=["bar", "foo", "extra", "thing"],
suffix=suffix,
prefix=prefix,
examples=example_jinja2_prompt[1],
example_prompt=example_jinja2_prompt[0],
template_format="jinja2",
).input_variables == ["bar", "foo"]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_prompt_jinja2_extra_input_variables() do?
test_prompt_jinja2_extra_input_variables() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_few_shot.py.
Where is test_prompt_jinja2_extra_input_variables() defined?
test_prompt_jinja2_extra_input_variables() is defined in libs/core/tests/unit_tests/prompts/test_few_shot.py at line 307.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free