Home / Function/ test_loading_few_shot_prompt_from_yaml() — langchain Function Reference

test_loading_few_shot_prompt_from_yaml() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4bcf22a6_d46a_5591_bddb_a6519651f8f7["test_loading_few_shot_prompt_from_yaml()"]
  eea05055_0cc3_c5ac_867f_b44ce74a7c7b["test_loading.py"]
  4bcf22a6_d46a_5591_bddb_a6519651f8f7 -->|defined in| eea05055_0cc3_c5ac_867f_b44ce74a7c7b
  a39a8c67_0bca_5506_7c34_c56c38051b9f["change_directory()"]
  4bcf22a6_d46a_5591_bddb_a6519651f8f7 -->|calls| a39a8c67_0bca_5506_7c34_c56c38051b9f
  style 4bcf22a6_d46a_5591_bddb_a6519651f8f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_loading.py lines 102–119

def test_loading_few_shot_prompt_from_yaml() -> None:
    """Test loading few shot prompt from yaml."""
    with change_directory(EXAMPLE_DIR):
        prompt = load_prompt("few_shot_prompt.yaml")
        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

Subdomains

Frequently Asked Questions

What does test_loading_few_shot_prompt_from_yaml() do?
test_loading_few_shot_prompt_from_yaml() 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_from_yaml() defined?
test_loading_few_shot_prompt_from_yaml() is defined in libs/core/tests/unit_tests/prompts/test_loading.py at line 102.
What does test_loading_few_shot_prompt_from_yaml() call?
test_loading_few_shot_prompt_from_yaml() 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