Home / Function/ test_loading_few_shot_prompt_example_prompt() — langchain Function Reference

test_loading_few_shot_prompt_example_prompt() — langchain Function Reference

Architecture documentation for the test_loading_few_shot_prompt_example_prompt() function in test_loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  e67c8146_6c30_a0ca_6819_601941e66dca["test_loading_few_shot_prompt_example_prompt()"]
  75e88228_0950_e62b_83e4_e5087cf36dde["test_loading.py"]
  e67c8146_6c30_a0ca_6819_601941e66dca -->|defined in| 75e88228_0950_e62b_83e4_e5087cf36dde
  ae2e9200_7c62_dd7e_a0cd_4922b225638b["change_directory()"]
  e67c8146_6c30_a0ca_6819_601941e66dca -->|calls| ae2e9200_7c62_dd7e_a0cd_4922b225638b
  style e67c8146_6c30_a0ca_6819_601941e66dca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_loading.py lines 162–179

def test_loading_few_shot_prompt_example_prompt() -> None:
    """Test loading few shot when the example prompt is in its own file."""
    with change_directory(EXAMPLE_DIR):
        prompt = load_prompt("few_shot_prompt_example_prompt.json")
        expected_prompt = FewShotPromptTemplate(
            input_variables=["adjective"],
            prefix="Write antonyms for the following words.",
            example_prompt=PromptTemplate(
                input_variables=["input", "output"],
                template="Input: {input}\nOutput: {output}",
            ),
            examples=[
                {"input": "happy", "output": "sad"},
                {"input": "tall", "output": "short"},
            ],
            suffix="Input: {adjective}\nOutput:",
        )
        assert prompt == expected_prompt

Domain

Subdomains

Frequently Asked Questions

What does test_loading_few_shot_prompt_example_prompt() do?
test_loading_few_shot_prompt_example_prompt() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_loading.py.
Where is test_loading_few_shot_prompt_example_prompt() defined?
test_loading_few_shot_prompt_example_prompt() is defined in libs/core/tests/unit_tests/prompts/test_loading.py at line 162.
What does test_loading_few_shot_prompt_example_prompt() call?
test_loading_few_shot_prompt_example_prompt() calls 1 function(s): change_directory.

Analyze Your Own Codebase

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

Try Supermodel Free