langtest.utils.custom_types.helpers.SimplePromptTemplate#
- class SimplePromptTemplate(input_variables: list, template: str)#
Bases:
objectSimple prompt template for formatting messages with variables.
- __init__(input_variables: list, template: str)#
Initialize the SimplePromptTemplate.
- Parameters:
input_variables (list) – A list of input variable names.
template (str) – The template string containing variables.
Methods
__init__(input_variables, template)Initialize the SimplePromptTemplate.
format(**kwargs)Format the prompt with provided variable values.
partial(**kwargs)Set partial variable values for the prompt.
- format(**kwargs) str#
Format the prompt with provided variable values.
- Parameters:
**kwargs – Variable values to substitute into the template.
- Returns:
The formatted prompt.
- Return type:
str
- Raises:
ValueError – If provided variables do not match expected input variables.
- partial(**kwargs) SimplePromptTemplate#
Set partial variable values for the prompt.
- Parameters:
**kwargs – Partial variable values to be set.
- Returns:
The modified instance with partial variables.
- Return type: