(self)
| 54 | return prompt |
| 55 | |
| 56 | def get_inference_prompt(self) -> str: |
| 57 | prompt = self.system_token + "\n" + self.system + self.end_token + "\n" |
| 58 | if self.messages is None: |
| 59 | raise ValueError("Dialogue template must have at least one message.") |
| 60 | for message in self.messages: |
| 61 | if message["role"] == "user": |
| 62 | prompt += self.user_token + "\n" + message["content"] + self.end_token + "\n" |
| 63 | else: |
| 64 | prompt += self.assistant_token + "\n" + message["content"] + self.end_token + "\n" |
| 65 | prompt += self.assistant_token |
| 66 | return prompt |
| 67 | |
| 68 | def get_dialogue(self): |
| 69 | """Helper function to format the messages as an easy-to-read dialogue.""" |
no outgoing calls
no test coverage detected