test_loading_few_shot_prompt_from_json() — langchain Function Reference
Architecture documentation for the test_loading_few_shot_prompt_from_json() function in test_loading.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e78a1532_bdf1_c3ec_6207_1e1970b3b287["test_loading_few_shot_prompt_from_json()"] 75e88228_0950_e62b_83e4_e5087cf36dde["test_loading.py"] e78a1532_bdf1_c3ec_6207_1e1970b3b287 -->|defined in| 75e88228_0950_e62b_83e4_e5087cf36dde ae2e9200_7c62_dd7e_a0cd_4922b225638b["change_directory()"] e78a1532_bdf1_c3ec_6207_1e1970b3b287 -->|calls| ae2e9200_7c62_dd7e_a0cd_4922b225638b style e78a1532_bdf1_c3ec_6207_1e1970b3b287 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_loading.py lines 122–139
def test_loading_few_shot_prompt_from_json() -> None:
"""Test loading few shot prompt from json."""
with change_directory(EXAMPLE_DIR):
prompt = load_prompt("few_shot_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
Calls
Source
Frequently Asked Questions
What does test_loading_few_shot_prompt_from_json() do?
test_loading_few_shot_prompt_from_json() 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_json() defined?
test_loading_few_shot_prompt_from_json() is defined in libs/core/tests/unit_tests/prompts/test_loading.py at line 122.
What does test_loading_few_shot_prompt_from_json() call?
test_loading_few_shot_prompt_from_json() 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