-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathquery_template.py
More file actions
27 lines (17 loc) · 892 Bytes
/
query_template.py
File metadata and controls
27 lines (17 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from typing import List, Dict
def prompt_single_yes_no_question(question:str, code:str) -> str:
question_template = f"""Does the following smart contract code "{question}"? Answer only "Yes" or "No".
{code}
"""
return question_template
def prompt_multiple_choice_scenarios(scenarios:List[str], code:str) -> str:
question_template="""Given the following smart contract code, answer the questions below and organize the result in a json format like {"""
for index, scenario in enumerate(scenarios):
question_template += f'"{index+1}": "Yes" or "No"'
if index != len(scenarios)-1:
question_template += ', '
question_template += f'}}.\n'
for index, scenario in enumerate(scenarios):
question_template += f'"{index+1}": Does it "{scenario}"?\n'
question_template += f'\n{code}'
return question_template