def parse(self, test): gpt3 = GPT(engine="davinci", temperature=0.9, max_tokens=200) for instance in self.data["data"]: gpt3.add_example(Example(get_content(instance, self.c_type), get_answer(instance))) output = gpt3.get_top_reply(test).replace("output: ", "").strip() output = output[: output.find("}") + 1] output = output.replace("'", '"') key_list = [list(x["answer"].keys()) for x in self.data["data"]] return output, key_list
prompt5 = premise4 + " " + \ "The phrase decorated the wall is entailed by which part of the premise: " output5 = "displayed on a wall" gpt.add_example(Example(prompt1, output1)) gpt.add_example(Example(prompt2, output2)) #gpt.add_example(Example(prompt3, output3)) #gpt.add_example(Example(prompt4, output4)) gpt.add_example(Example(prompt5, output5)) gpt.add_example(Example(prompt6, output6)) # Inferences prompt = "Here is a premise: Three young boys enjoying a day at the beach" prompt = prompt + " " + \ "The phrase in the beach is entailed by which part of the premise: " output = gpt.get_top_reply(prompt) print(prompt, ":", output) print("----------------------------------------") prompt = "Here is a premise: While at Skidmore , Smith also designed an even taller mixed-use skyscraper , the Burj Dubai , now under construction in the United Arab Emirates ." prompt = prompt + " " + \ "The phrase Burj Dubai is in United Arab Emirates is entailed by which part of the premise: " output = gpt.get_top_reply(prompt) print(prompt, ":", output) print("----------------------------------------") prompt = "Here is a premise: While at Skidmore , Smith also designed an even taller mixed-use skyscraper , the Burj Dubai , now under construction in the United Arab Emirates ." prompt = prompt + " " + \ "The phrase Burj Dubai is under construction is entailed by which part of the premise: " output = gpt.get_top_reply(prompt) print(prompt, ":", output)