load_prompt#

langchain_core.prompts.loading.load_prompt(path: str | Path, encoding: str | None = None) BasePromptTemplate[source]#

Unified method for loading a prompt from LangChainHub or local fs.

Parameters:
  • path (str | Path) – Path to the prompt file.

  • encoding (str | None) – Encoding of the file. Defaults to None.

Returns:

A PromptTemplate object.

Raises:

RuntimeError – If the path is a Lang Chain Hub path.

Return type:

BasePromptTemplate