Home / Function/ test_prompt_template_add() — langchain Function Reference

test_prompt_template_add() — langchain Function Reference

Architecture documentation for the test_prompt_template_add() function in test_prompt.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  096bc6fb_69ce_3fe7_f42c_aed49471bd72["test_prompt_template_add()"]
  af1b998b_a7bf_9d5c_32ef_bab507a6bee3["test_prompt.py"]
  096bc6fb_69ce_3fe7_f42c_aed49471bd72 -->|defined in| af1b998b_a7bf_9d5c_32ef_bab507a6bee3
  style 096bc6fb_69ce_3fe7_f42c_aed49471bd72 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_prompt.py lines 703–730

def test_prompt_template_add(
    template_format: Literal["f-string", "mustache", "jinja2"],
    prompt1: str,
    prompt2: str,
) -> None:
    first_prompt = PromptTemplate.from_template(
        prompt1,
        template_format=template_format,
    )
    second_prompt = PromptTemplate.from_template(
        prompt2,
        template_format=template_format,
    )

    concated_prompt = first_prompt + second_prompt
    prompt_of_concated = PromptTemplate.from_template(
        prompt1 + prompt2,
        template_format=template_format,
    )

    assert concated_prompt.input_variables == prompt_of_concated.input_variables
    assert concated_prompt.format(
        variable="template",
        another_variable="other_template",
    ) == prompt_of_concated.format(
        variable="template",
        another_variable="other_template",
    )

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free