(self, prompt: str='')
| 2 | |
| 3 | class HtmlPrompt: |
| 4 | def __init__(self, prompt: str='') -> None: |
| 5 | prompt = self.extract(prompt, 'xml') |
| 6 | if prompt not in prompts: |
| 7 | raise Exception('Unknown prompt: ' + prompt) |
| 8 | |
| 9 | constructors = { |
| 10 | 'refine': self.normal_prompt_constructor, |
| 11 | 'xml': self.normal_prompt_constructor, |
| 12 | 'new_data': self.new_data_prompt_constructor, |
| 13 | } |
| 14 | |
| 15 | self.name = prompt |
| 16 | self.prompt = prompts[prompt] |
| 17 | self.constructor = constructors[prompt] |
| 18 | |
| 19 | @staticmethod |
| 20 | def extract(data, default=''): |