PromptTemplate
PromptTemplate ¶
This class embeds task inputs from GenerationInstance
or MultipleChoiceInstance
into a text that can be used
as a prompt for LanguageModel
.
Source code in flexeval/core/prompt_template/base.py
7 8 9 10 11 12 13 14 15 16 17 18 |
|
embed_inputs
abstractmethod
¶
embed_inputs(input_dict: dict[str, Any]) -> str
Embeds the input into a prompt template.
Source code in flexeval/core/prompt_template/base.py
13 14 15 16 17 18 |
|
Jinja2PromptTemplate ¶
Embed task inputs using Jinja2 template engine.
Parameters:
-
template
(str | None
, default:None
) –The Jinja2 template to use.
-
template_path
(str | None
, default:None
) –The path to a file with the Jinja2 template to use.
Source code in flexeval/core/prompt_template/jinja2.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
__init__ ¶
__init__(
template: str | None = None,
template_path: str | None = None,
) -> None
Source code in flexeval/core/prompt_template/jinja2.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
embed_inputs ¶
embed_inputs(input_dict: dict[str, Any]) -> str
Source code in flexeval/core/prompt_template/jinja2.py
43 44 |
|
__repr__ ¶
__repr__() -> str
Source code in flexeval/core/prompt_template/jinja2.py
46 47 |
|
instantiate_prompt_template_from_string ¶
instantiate_prompt_template_from_string(
template_or_path: str,
) -> Jinja2PromptTemplate
Source code in flexeval/core/prompt_template/jinja2.py
11 12 13 14 15 |
|