MCPcopy
hub / github.com/langchain-ai/langchain / _load_prompt

Function _load_prompt

libs/core/langchain_core/prompts/loading.py:109–125  ·  view source on GitHub ↗

Load the prompt template from config.

(config: dict)

Source from the content-addressed store, hash-verified

107
108
109def _load_prompt(config: dict) -> PromptTemplate:
110 """Load the prompt template from config."""
111 # Load the template from disk if necessary.
112 config = _load_template("template", config)
113 config = _load_output_parser(config)
114
115 template_format = config.get("template_format", "f-string")
116 if template_format == "jinja2":
117 # Disabled due to:
118 # https://github.com/langchain-ai/langchain/issues/4394
119 raise ValueError(
120 f"Loading templates with '{template_format}' format is no longer supported "
121 f"since it can lead to arbitrary code execution. Please migrate to using "
122 f"the 'f-string' template format, which does not suffer from this issue."
123 )
124
125 return PromptTemplate(**config)
126
127
128def load_prompt(

Callers

nothing calls this directly

Calls 4

PromptTemplateClass · 0.90
_load_templateFunction · 0.85
_load_output_parserFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected