load_prompt#

load_prompt(file_path: str | Path, **kwargs: list | str) str[source]#

Load and render a single prompt template from a file.

Parameters:
file_pathstr or Path

Path to the template file to load.

**kwargslist or str

Additional keyword arguments to pass to the template renderer. For example, you can pass examples as a list or string to provide example data for rendering.

Returns:
str

The rendered template content.

Examples

>>> prompt = load_prompt("/path/to/template.md")
>>> prompt_with_examples = load_prompt(
...     "/path/to/template.md", examples=[]"example1", "example2"]
... )