Uses RequestFactory to construct Requests and returns an iterable of Requests which will be sent to the LM. :param doc: The document as returned from training_docs, validation_docs, or test_docs. :param ctx: str The context string, generated by fewsho
(self, doc, ctx)
| 89 | return " " + str(doc["answer_number"]) |
| 90 | |
| 91 | def construct_requests(self, doc, ctx): |
| 92 | """Uses RequestFactory to construct Requests and returns an iterable of |
| 93 | Requests which will be sent to the LM. |
| 94 | |
| 95 | :param doc: |
| 96 | The document as returned from training_docs, validation_docs, or test_docs. |
| 97 | :param ctx: str |
| 98 | The context string, generated by fewshot_context. This includes the natural |
| 99 | language description, as well as the few shot examples, and the question |
| 100 | part of the document for `doc`. |
| 101 | """ |
| 102 | completion = rf.greedy_until(ctx, {"until": ["\n", ":", self.QUESTION]}) |
| 103 | return completion |
| 104 | |
| 105 | def _extract_answer(self, completion): |
| 106 | match = re.findall(ANS_RE, completion) |
nothing calls this directly
no test coverage detected