Method to apply a chat template to a list of chat history between user and model.
(self,
chat_history: List[Dict[str, str]],
add_generation_prompt: bool = True)
| 67 | return self.llm.tokenizer.eos_token_id |
| 68 | |
| 69 | def apply_chat_template(self, |
| 70 | chat_history: List[Dict[str, str]], |
| 71 | add_generation_prompt: bool = True) -> str: |
| 72 | """ |
| 73 | Method to apply a chat template to a list of chat history between user and model. |
| 74 | """ |
| 75 | return self.llm.tokenizer.apply_chat_template( |
| 76 | chat_history, |
| 77 | tokenize=False, |
| 78 | add_generation_prompt=add_generation_prompt, |
| 79 | continue_final_message=not add_generation_prompt, |
| 80 | **(self.chat_template_kwargs or {}), |
| 81 | ) |
| 82 | |
| 83 | @property |
| 84 | def tokenizer_name(self) -> str: |
no outgoing calls