| 108 | |
| 109 | |
| 110 | class PromptString: |
| 111 | def __init__(self, prompt_string): |
| 112 | self.prompt_string = prompt_string |
| 113 | |
| 114 | def apply(self, doc): |
| 115 | doc_to_text = self.prompt_string["doc_to_text"] |
| 116 | doc_to_target = self.prompt_string["doc_to_target"] |
| 117 | |
| 118 | # TODO need a way to process doc_to_choice |
| 119 | if "doc_to_choice" in self.prompt_string: |
| 120 | raise Exception("Not yet implemented to accept doc_to_choice") |
| 121 | |
| 122 | text_string = utils.apply_template(doc_to_text, doc) |
| 123 | target_string = utils.apply_template(doc_to_target, doc) |
| 124 | |
| 125 | return [text_string, target_string] |