Spaces:
Running
Running
shaocongma
commited on
Commit
•
72c76c9
1
Parent(s):
3b4e6ce
bug fix. (edit keywords generation)
Browse files- section_generator.py +1 -1
- utils/prompts.py +7 -8
section_generator.py
CHANGED
@@ -94,7 +94,7 @@ def keywords_generation(input_dict):
|
|
94 |
model="gpt-3.5-turbo", temperature=0.4)
|
95 |
print(keywords)
|
96 |
output = json.loads(keywords)
|
97 |
-
return output, usage
|
98 |
except json.decoder.JSONDecodeError:
|
99 |
attempts_count += 1
|
100 |
time.sleep(20)
|
|
|
94 |
model="gpt-3.5-turbo", temperature=0.4)
|
95 |
print(keywords)
|
96 |
output = json.loads(keywords)
|
97 |
+
return output.keys(), usage
|
98 |
except json.decoder.JSONDecodeError:
|
99 |
attempts_count += 1
|
100 |
time.sleep(20)
|
utils/prompts.py
CHANGED
@@ -4,6 +4,7 @@ from langchain import PromptTemplate
|
|
4 |
|
5 |
log = logging.getLogger(__name__)
|
6 |
|
|
|
7 |
|
8 |
######################################################################################################################
|
9 |
# Some basic functions
|
@@ -33,15 +34,13 @@ def generate_experiments_prompts(paper_info):
|
|
33 |
######################################################################################################################
|
34 |
|
35 |
# two parameters: min_refs_num, max_refs_num
|
36 |
-
|
37 |
-
|
38 |
-
# - Your response should always be a Python list; e.g. ["keyword1", "keyword2", "keyword3"]
|
39 |
-
# - The length of list should between {min_refs_num} and {max_refs_num}
|
40 |
-
# - Use specific phrases as keywords and avoid using too general words (e.g. machine learning)"""
|
41 |
-
keywords_system_template = """You are an assistant designed to provide accurate and informative keywords of searching academic papers.\n
|
42 |
Instructions:\n
|
43 |
-
-
|
44 |
-
-
|
|
|
|
|
45 |
|
46 |
# two parameters: min_refs_num, max_refs_num
|
47 |
exp_methods_system_template = """You are an assistant designed to provide most related algorithms or methods to a given paper title.
|
|
|
4 |
|
5 |
log = logging.getLogger(__name__)
|
6 |
|
7 |
+
# todo: load prompts from configurations
|
8 |
|
9 |
######################################################################################################################
|
10 |
# Some basic functions
|
|
|
34 |
######################################################################################################################
|
35 |
|
36 |
# two parameters: min_refs_num, max_refs_num
|
37 |
+
keywords_system_template = """You are an assistant designed to provide accurate and informative keywords of searching academic papers.
|
38 |
+
The user will input the tile of a paper. You need to return three to five most related fields. \n
|
|
|
|
|
|
|
|
|
39 |
Instructions:\n
|
40 |
+
- Assign numbers to each field to present the importance. The larger, the more important. \n
|
41 |
+
- {max_refs_num} is the most important and {min_refs_num} is the least important. \n
|
42 |
+
- Your response should follow the following format: {{"field1": 5, "field2": 7, "field3": 8, "field4": 5}}\n
|
43 |
+
- Ensure the response can be parsed by Python json.loads"""
|
44 |
|
45 |
# two parameters: min_refs_num, max_refs_num
|
46 |
exp_methods_system_template = """You are an assistant designed to provide most related algorithms or methods to a given paper title.
|