Home / Function/ test_loading_few_shot_prompt_when_examples_in_config() — langchain Function Reference

test_loading_few_shot_prompt_when_examples_in_config() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_loading.py lines 142–159

def test_loading_few_shot_prompt_when_examples_in_config() -> None:
    """Test loading few shot prompt when the examples are in the config."""
    with change_directory(EXAMPLE_DIR):
        prompt = load_prompt("few_shot_prompt_examples_in.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_when_examples_in_config() do?
test_loading_few_shot_prompt_when_examples_in_config() 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_when_examples_in_config() defined?
test_loading_few_shot_prompt_when_examples_in_config() is defined in libs/core/tests/unit_tests/prompts/test_loading.py at line 142.
What does test_loading_few_shot_prompt_when_examples_in_config() call?
test_loading_few_shot_prompt_when_examples_in_config() 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