_load_few_shot_prompt() — langchain Function Reference
Architecture documentation for the _load_few_shot_prompt() function in loading.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fef0572d_1685_bdaf_bb9b_9baf7d6f1856["_load_few_shot_prompt()"] fc5c0c58_eb79_058b_cc17_205426e210b8["loading.py"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|defined in| fc5c0c58_eb79_058b_cc17_205426e210b8 bc5ecb46_2beb_262d_6579_05676d62c375["_load_template()"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|calls| bc5ecb46_2beb_262d_6579_05676d62c375 03095f0c_d553_b94d_6b94_d71c43044869["load_prompt()"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|calls| 03095f0c_d553_b94d_6b94_d71c43044869 afd0dfa8_d6e1_0d44_ce7f_212370f6f020["load_prompt_from_config()"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|calls| afd0dfa8_d6e1_0d44_ce7f_212370f6f020 dd634226_6cd7_7001_1bdd_ec3afeae8bc7["_load_examples()"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|calls| dd634226_6cd7_7001_1bdd_ec3afeae8bc7 ad96e24f_68cb_28d0_a5fa_724cdcf8f3ed["_load_output_parser()"] fef0572d_1685_bdaf_bb9b_9baf7d6f1856 -->|calls| ad96e24f_68cb_28d0_a5fa_724cdcf8f3ed style fef0572d_1685_bdaf_bb9b_9baf7d6f1856 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/loading.py lines 95–114
def _load_few_shot_prompt(config: dict) -> FewShotPromptTemplate:
"""Load the "few shot" prompt from the config."""
# Load the suffix and prefix templates.
config = _load_template("suffix", config)
config = _load_template("prefix", config)
# Load the example prompt.
if "example_prompt_path" in config:
if "example_prompt" in config:
msg = (
"Only one of example_prompt and example_prompt_path should "
"be specified."
)
raise ValueError(msg)
config["example_prompt"] = load_prompt(config.pop("example_prompt_path"))
else:
config["example_prompt"] = load_prompt_from_config(config["example_prompt"])
# Load the examples.
config = _load_examples(config)
config = _load_output_parser(config)
return FewShotPromptTemplate(**config)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does _load_few_shot_prompt() do?
_load_few_shot_prompt() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/loading.py.
Where is _load_few_shot_prompt() defined?
_load_few_shot_prompt() is defined in libs/core/langchain_core/prompts/loading.py at line 95.
What does _load_few_shot_prompt() call?
_load_few_shot_prompt() calls 5 function(s): _load_examples, _load_output_parser, _load_template, load_prompt, load_prompt_from_config.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free