(df, idx, include_answer=True)
| 61 | return s |
| 62 | |
| 63 | def format_example(df, idx, include_answer=True): |
| 64 | prompt = df.iloc[idx, 0] |
| 65 | k = df.shape[1] - 2 |
| 66 | for j in range(k): |
| 67 | prompt += "\n{}. {}".format(choices[j], df.iloc[idx, j+1]) |
| 68 | prompt += "\nAnswer:" |
| 69 | if include_answer: |
| 70 | prompt += " {}\n\n".format(df.iloc[idx, k + 1]) |
| 71 | return prompt |
| 72 | |
| 73 | def generate_few_shot_prompt(train_df, subject, k=-1): |
| 74 | prompt = "The following are multiple choice questions (with answers) about {}.\n\n".format(format_subject(subject)) |
no outgoing calls
no test coverage detected