Prompt Creation
FewshotPrompter
¶
Bases: LocalStep
Class for formatting fewshot examples into a string, to be used in a prompt.
The prompt template contains a placeholder for the fewshot examples; this class is used to format the examples into a string.
Source code in ragfit/processing/local_steps/prompter.py
__init__(prompt_file: str, fewshot_key: str, mapping: dict, output_key: str, **kwargs)
¶
Parameters:
-
prompt_file
(str
) –Path to the prompt file for the individual fewshot examples.
-
fewshot_key
(str
) –Key to the fewshot examples in the item.
-
mapping
(dict
) –Mapping of the placeholders in the prompt to the item keys.
-
output_key
(str
) –Key to store the formatted fewshot examples.
Source code in ragfit/processing/local_steps/prompter.py
TextPrompter
¶
Bases: LocalStep
Class for creating prompts. The input is a prompt file with placeholders, a mapping of the placeholders to the item keys, and the key to store the result.
Source code in ragfit/processing/local_steps/prompter.py
__init__(prompt_file: str, mapping: dict, output_key, **kwargs)
¶
Parameters:
-
prompt_file
(str
) –Path to the prompt file.
-
mapping
(dict
) –Mapping of the placeholders in the prompt to the item keys.
-
output_key
(str
) –Key to store the formatted prompt.