Home / Function/ example_jinja2_prompt() — langchain Function Reference

example_jinja2_prompt() — langchain Function Reference

Architecture documentation for the example_jinja2_prompt() function in test_few_shot.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a3c01c6a_fe9a_0b82_f018_809e0d86960c["example_jinja2_prompt()"]
  e4e12a36_798e_ddc0_ab57_e44de269c7e7["test_few_shot.py"]
  a3c01c6a_fe9a_0b82_f018_809e0d86960c -->|defined in| e4e12a36_798e_ddc0_ab57_e44de269c7e7
  style a3c01c6a_fe9a_0b82_f018_809e0d86960c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_few_shot.py lines 30–45

def example_jinja2_prompt() -> tuple[PromptTemplate, list[dict[str, str]]]:
    example_template = "{{ word }}: {{ antonym }}"

    examples = [
        {"word": "happy", "antonym": "sad"},
        {"word": "tall", "antonym": "short"},
    ]

    return (
        PromptTemplate(
            input_variables=["word", "antonym"],
            template=example_template,
            template_format="jinja2",
        ),
        examples,
    )

Domain

Subdomains

Frequently Asked Questions

What does example_jinja2_prompt() do?
example_jinja2_prompt() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_few_shot.py.
Where is example_jinja2_prompt() defined?
example_jinja2_prompt() is defined in libs/core/tests/unit_tests/prompts/test_few_shot.py at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free