# load_prompt

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/prompts/loading/load_prompt)

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

## Signature

```python
load_prompt(
    path: str | Path,
    encoding: str | None = None,
    *,
    allow_dangerous_paths: bool = False,
) -> BasePromptTemplate
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `str \| Path` | Yes | Path to the prompt file. |
| `encoding` | `str \| None` | No | Encoding of the file. (default: `None`) |
| `allow_dangerous_paths` | `bool` | No | If ``False`` (default), file paths referenced inside the loaded config (such as ``template_path``, ``examples``, and ``example_prompt_path``) are validated to reject absolute paths and directory traversal (``..``) sequences. Set to ``True`` only if you trust the source of the config. (default: `False`) |

## Returns

`BasePromptTemplate`

A `PromptTemplate` object.

## ⚠️ Deprecated

Deprecated since version 1.2.21.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/ee95ad6907f5eab94644183393a20aa2a032bb19/libs/core/langchain_core/prompts/loading.py#L204)