langchain_core.prompts.loading
.load_prompt¶
- langchain_core.prompts.loading.load_prompt(path: Union[str, Path], encoding: Optional[str] = None) BasePromptTemplate [source]¶
Unified method for loading a prompt from LangChainHub or local fs.
- Parameters
path (Union[str, Path]) – Path to the prompt file.
encoding (Optional[str]) – Encoding of the file. Defaults to None.
- Returns
A PromptTemplate object.
- Raises
RuntimeError – If the path is a Lang Chain Hub path.
- Return type