gen_utilsΒΆ

FunctionsΒΆ

transform_chat_template_with_prompt(β†’ str)

Transform a prefix with a prompt into a chat template

Module ContentsΒΆ

gen_utils.transform_chat_template_with_prompt(prefix: str, prompt: str, tokenizer: transformers.AutoTokenizer, use_chat_template: bool = False, template_type: str = None, system_prompt: str = '', forced_prefix: str = '') strΒΆ

Transform a prefix with a prompt into a chat template

Parameters: prefix : str

The prefix to use

promptstr

The prompt to use

tokenizerAutoTokenizer

The tokenizer to use

use_chat_templatebool, optional

Whether to use a chat template, by default False

template_typestr, optional

The type of template to use, by default None

system_promptstr, optional

The system prompt to use, by default β€œβ€

Returns: str

The transformed prefix