change prompt reader & web front
Browse files- app.py +9 -5
- assets/prompt/compare_all.xml +57 -0
- assets/prompt/compare_feasibility.xml +49 -0
- assets/prompt/compare_novelty.xml +49 -0
- assets/prompt/compare_novelty_and_feasibility.xml +51 -0
- assets/prompt/compare_same.xml +65 -0
- assets/prompt/filter_idea.xml +40 -0
- assets/prompt/generate_brainstorm.xml +33 -0
- assets/prompt/generate_entity_list.xml +61 -0
- assets/prompt/generate_ground_truth.xml +38 -0
- assets/prompt/generate_idea.xml +41 -0
- assets/prompt/generate_idea_by_inspiration.xml +41 -0
- assets/prompt/generate_idea_by_inspiration_with_cue_words.xml +44 -0
- assets/prompt/generate_idea_with_cue_words.xml +44 -0
- assets/prompt/generate_inspiration.xml +39 -0
- assets/prompt/generate_inspiration_with_cue_words.xml +42 -0
- assets/prompt/generate_problem.xml +38 -0
- assets/prompt/generate_problem_with_cue_words.xml +41 -0
- assets/prompt/get_similarity_score.xml +34 -0
- assets/prompt/integrate_idea.xml +41 -0
- assets/prompt/modify_idea.xml +44 -0
- assets/prompt/novelty_eval.xml +57 -0
- assets/prompt/select_contribution.xml +30 -0
- assets/prompt/transfer_form.xml +25 -0
- environment.yml +1 -1
- requirements.txt +2 -1
- src/app_pages/app_gradio_backup.py +89 -0
- src/app_pages/button_interface.py +123 -0
- src/app_pages/homepage.py +23 -0
- src/app_pages/locale.py +14 -0
- src/app_pages/one_click_generation.py +134 -0
- src/app_pages/sidebar_components.py +35 -0
- src/app_pages/step_by_step_generation.py +201 -0
- src/prompt/__init__.py +24 -0
- src/prompt/data.py +119 -0
- src/prompt/pool.py +55 -0
- src/prompt/utils.py +24 -0
- src/utils/api/base_helper.py +0 -1
- src/utils/base_company.py +7 -7
- src/utils/header.py +8 -2
- src/utils/llms_api.py +224 -918
- src/utils/path_pool.py +16 -0
app.py
CHANGED
@@ -1,21 +1,25 @@
|
|
1 |
import sys
|
2 |
-
import os
|
3 |
sys.path.append("./src")
|
4 |
import streamlit as st
|
5 |
-
from
|
|
|
6 |
from utils.hash import check_env, check_embedding
|
7 |
|
8 |
if __name__ == "__main__":
|
9 |
check_env()
|
10 |
-
check_embedding()
|
11 |
backend = button_interface.Backend()
|
|
|
12 |
st.set_page_config(layout="wide")
|
|
|
|
|
13 |
def fn1():
|
14 |
one_click_generation.one_click_generation(backend)
|
15 |
def fn2():
|
16 |
step_by_step_generation.step_by_step_generation(backend)
|
17 |
pg = st.navigation([
|
18 |
-
st.Page(
|
19 |
-
st.Page(
|
|
|
20 |
])
|
21 |
pg.run()
|
|
|
1 |
import sys
|
|
|
2 |
sys.path.append("./src")
|
3 |
import streamlit as st
|
4 |
+
from app_pages import button_interface, step_by_step_generation, one_click_generation, homepage
|
5 |
+
from app_pages.locale import _
|
6 |
from utils.hash import check_env, check_embedding
|
7 |
|
8 |
if __name__ == "__main__":
|
9 |
check_env()
|
10 |
+
# check_embedding()
|
11 |
backend = button_interface.Backend()
|
12 |
+
# backend = None
|
13 |
st.set_page_config(layout="wide")
|
14 |
+
if "language" not in st.session_state:
|
15 |
+
st.session_state["language"] = "zh"
|
16 |
def fn1():
|
17 |
one_click_generation.one_click_generation(backend)
|
18 |
def fn2():
|
19 |
step_by_step_generation.step_by_step_generation(backend)
|
20 |
pg = st.navigation([
|
21 |
+
st.Page(homepage.home_page, title=_("🏠️ Homepage")),
|
22 |
+
st.Page(fn1, title=_("💧 One-click Generation")),
|
23 |
+
st.Page(fn2, title=_("💦 Step-by-step Generation")),
|
24 |
])
|
25 |
pg.run()
|
assets/prompt/compare_all.xml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an artificial intelligence researcher with extensive knowledge in this field, and now you need to make a comprehensive comparison among five ideas.
|
10 |
+
You will obtain a comparison standard, compare every point on the standard, and make a overall ranking at the end.
|
11 |
+
</text>
|
12 |
+
</query>
|
13 |
+
<query rank="1">
|
14 |
+
<title>User Message</title>
|
15 |
+
<text>
|
16 |
+
### Comparison Standard:
|
17 |
+
"""
|
18 |
+
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
19 |
+
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
20 |
+
**Clarity**: It evaluates whether the method is articulated in a straightforward and coherent manner, facilitating a comprehensive understanding for both practitioners and researchers, thus enabling effective application and potential adaptation in similar studies.
|
21 |
+
**Generalizability**: It determines how broadly the method can be extended or adapted to various contexts, populations, or situations, evaluating its applicability beyond the specific conditions of the study while maintaining relevance and effectiveness.
|
22 |
+
"""
|
23 |
+
|
24 |
+
### You should compare these five ideas:
|
25 |
+
"""IDEA1
|
26 |
+
{idea1}
|
27 |
+
"""
|
28 |
+
"""IDEA2
|
29 |
+
{idea2}
|
30 |
+
"""
|
31 |
+
|
32 |
+
### Respond in the following format:
|
33 |
+
|
34 |
+
THOUGHT:
|
35 |
+
```thought
|
36 |
+
< THOUGHT >
|
37 |
+
```
|
38 |
+
|
39 |
+
RESPONSE:
|
40 |
+
```json
|
41 |
+
< JSON >
|
42 |
+
```
|
43 |
+
|
44 |
+
In < THOUGHT > , You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
45 |
+
|
46 |
+
In < JSON > , respond in JSON format with ONLY the following field:
|
47 |
+
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
48 |
+
- "Feasibility": Same as above.
|
49 |
+
- "clarity": Same as above.
|
50 |
+
- "Generalizability": Same as above.
|
51 |
+
- "Overall Ranking": Same as above.
|
52 |
+
|
53 |
+
|
54 |
+
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise.
|
55 |
+
</text>
|
56 |
+
</query>
|
57 |
+
</body>
|
assets/prompt/compare_feasibility.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an artificial intelligence researcher with extensive knowledge in this field, and now you need to make a comparison between two ideas.
|
10 |
+
You will obtain a comparison standard, compare the feasibility between the ideas, and make a ranking at the end.
|
11 |
+
</text>
|
12 |
+
</query>
|
13 |
+
<query rank="1">
|
14 |
+
<title>User Message</title>
|
15 |
+
<text>
|
16 |
+
### Comparison Standard:
|
17 |
+
"""
|
18 |
+
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
19 |
+
"""
|
20 |
+
|
21 |
+
### You should compare these five ideas:
|
22 |
+
"""IDEA1
|
23 |
+
{idea1}
|
24 |
+
"""
|
25 |
+
"""IDEA2
|
26 |
+
{idea2}
|
27 |
+
"""
|
28 |
+
|
29 |
+
### Respond in the following format:
|
30 |
+
|
31 |
+
THOUGHT:
|
32 |
+
```thought
|
33 |
+
< THOUGHT >
|
34 |
+
```
|
35 |
+
|
36 |
+
RESPONSE:
|
37 |
+
```json
|
38 |
+
< JSON >
|
39 |
+
```
|
40 |
+
|
41 |
+
In < THOUGHT >, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
42 |
+
|
43 |
+
In < JSON >, respond in JSON format with ONLY the following field:
|
44 |
+
- "Feasibility": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
45 |
+
|
46 |
+
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise and don't forget the label "Feasibility".
|
47 |
+
</text>
|
48 |
+
</query>
|
49 |
+
</body>
|
assets/prompt/compare_novelty.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an artificial intelligence researcher with extensive knowledge in this field, and now you need to make a comparison between two ideas.
|
10 |
+
You will obtain a comparison standard, compare the novelty between the ideas, and make a ranking at the end.
|
11 |
+
</text>
|
12 |
+
</query>
|
13 |
+
<query rank="1">
|
14 |
+
<title>User Message</title>
|
15 |
+
<text>
|
16 |
+
### Comparison Standard:
|
17 |
+
"""
|
18 |
+
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
19 |
+
"""
|
20 |
+
|
21 |
+
### You should compare these five ideas:
|
22 |
+
"""IDEA1
|
23 |
+
{idea1}
|
24 |
+
"""
|
25 |
+
"""IDEA2
|
26 |
+
{idea2}
|
27 |
+
"""
|
28 |
+
|
29 |
+
### Respond in the following format:
|
30 |
+
|
31 |
+
THOUGHT:
|
32 |
+
```thought
|
33 |
+
< THOUGHT >
|
34 |
+
```
|
35 |
+
|
36 |
+
RESPONSE:
|
37 |
+
```json
|
38 |
+
< JSON >
|
39 |
+
```
|
40 |
+
|
41 |
+
In < THOUGHT >, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
42 |
+
|
43 |
+
In < JSON >, respond in JSON format with ONLY the following field:
|
44 |
+
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
45 |
+
|
46 |
+
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise and don't forget the label "Novelty".
|
47 |
+
</text>
|
48 |
+
</query>
|
49 |
+
</body>
|
assets/prompt/compare_novelty_and_feasibility.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an artificial intelligence researcher with extensive knowledge in this field, and now you need to make a comprehensive comparison between two ideas.
|
10 |
+
You will obtain a comparison standard, compare every point on the standard, and make a ranking at the end.
|
11 |
+
</text>
|
12 |
+
</query>
|
13 |
+
<query rank="1">
|
14 |
+
<title>User Message</title>
|
15 |
+
<text>
|
16 |
+
### Comparison Standard:
|
17 |
+
"""
|
18 |
+
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
19 |
+
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
20 |
+
"""
|
21 |
+
|
22 |
+
### You should compare these five ideas:
|
23 |
+
"""IDEA1
|
24 |
+
{idea1}
|
25 |
+
"""
|
26 |
+
"""IDEA2
|
27 |
+
{idea2}
|
28 |
+
"""
|
29 |
+
|
30 |
+
### Respond in the following format:
|
31 |
+
|
32 |
+
THOUGHT:
|
33 |
+
```thought
|
34 |
+
< THOUGHT >
|
35 |
+
```
|
36 |
+
|
37 |
+
RESPONSE:
|
38 |
+
```json
|
39 |
+
< JSON >
|
40 |
+
```
|
41 |
+
|
42 |
+
In < THOUGHT >, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
43 |
+
|
44 |
+
In < JSON >, respond in JSON format with ONLY the following field:
|
45 |
+
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
46 |
+
- "Feasibility": Same as above.
|
47 |
+
|
48 |
+
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise.
|
49 |
+
</text>
|
50 |
+
</query>
|
51 |
+
</body>
|
assets/prompt/compare_same.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an artificial intelligence researcher with extensive knowledge in this field, and now you need to make a comprehensive comparison among five ideas.
|
10 |
+
You will obtain a comparison standard, compare every point on the standard.
|
11 |
+
</text>
|
12 |
+
</query>
|
13 |
+
<query rank="1">
|
14 |
+
<title>User Message</title>
|
15 |
+
<text>
|
16 |
+
### Comparison Standard:
|
17 |
+
"""
|
18 |
+
**Clarity**: It evaluates whether the method is articulated in a straightforward and coherent manner, facilitating a comprehensive understanding for both practitioners and researchers, thus enabling effective application and potential adaptation in similar studies.
|
19 |
+
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
20 |
+
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
21 |
+
**Generalizability**: It determines how broadly the method can be extended or adapted to various contexts, populations, or situations, evaluating its applicability beyond the specific conditions of the study while maintaining relevance and effectiveness.
|
22 |
+
"""
|
23 |
+
|
24 |
+
### You should compare these five ideas:
|
25 |
+
"""IDEA1
|
26 |
+
{idea1}
|
27 |
+
"""
|
28 |
+
"""IDEA2
|
29 |
+
{idea2}
|
30 |
+
"""
|
31 |
+
"""IDEA3
|
32 |
+
{idea3}
|
33 |
+
"""
|
34 |
+
"""IDEA4
|
35 |
+
{idea4}
|
36 |
+
"""
|
37 |
+
"""IDEA5
|
38 |
+
{idea5}
|
39 |
+
"""
|
40 |
+
|
41 |
+
### Respond in the following format:
|
42 |
+
|
43 |
+
THOUGHT:
|
44 |
+
```thought
|
45 |
+
< THOUGHT >
|
46 |
+
```
|
47 |
+
|
48 |
+
RESPONSE:
|
49 |
+
```json
|
50 |
+
< JSON >
|
51 |
+
```
|
52 |
+
|
53 |
+
In < THOUGHT > , You can record your reasoning process to make your comparison more organized..
|
54 |
+
|
55 |
+
In < JSON > , respond in JSON format with ONLY the following field:
|
56 |
+
- "Clarity": Provide an array consisting of 1-5, representing each idea separately, with the better idea placed at the beginning (e.g. [4, 5, 3, 2, 1])
|
57 |
+
- "Novelty": Same as above.
|
58 |
+
- "Feasibility": Same as above.
|
59 |
+
- "Generalizability": Same as above.
|
60 |
+
- "Overall Ranking": Same as above.
|
61 |
+
|
62 |
+
This JSON will be automatically parsed, so ensure the format is precise.
|
63 |
+
</text>
|
64 |
+
</query>
|
65 |
+
</body>
|
assets/prompt/filter_idea.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI. You are good at selecting the ideas that meet the requirements.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with some ideas you previously generated, and a research background. Your task is to select 5-6 ideas that best address the problems described in the research background (priority) and ideas that are relatively novel and feasible (secondary), and then record the ideas and their content in given format. Remember that the content of idea includes everything about the idea.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Ideas**: These are the ideas you previously generated based on the research background and several related papers.
|
20 |
+
2. **Research Background**: This document describes specific problems and challenges that need to be addressed.
|
21 |
+
|
22 |
+
### Approach:
|
23 |
+
Your approach should be systematic:
|
24 |
+
- **Step 1**: Analyze the research background to understand the specific problems that need solutions.
|
25 |
+
- **Step 2**: Critically review the ideas, selecting 5-6 ideas that are most effective in solving the problems in the research background (priority) and that are also relatively novel and feasible (secondary).
|
26 |
+
|
27 |
+
### Specific Information:
|
28 |
+
I will provide you with specific information now; please use them according to the instructions above:
|
29 |
+
1. **Ideas**: {idea}
|
30 |
+
2. **Research Background**: {background}
|
31 |
+
|
32 |
+
### Format for Your Response:
|
33 |
+
Please ensure that your final ideas include 5-6 entries, whose content has not been modified. Don't generate any explanation and just present the filtered ideas as well as their content in the following format:
|
34 |
+
**Idea 1**: [The first method idea]
|
35 |
+
**Idea 2**: [The second method idea]
|
36 |
+
**Idea 3**: [The third method idea]
|
37 |
+
...
|
38 |
+
</text>
|
39 |
+
</query>
|
40 |
+
</body>
|
assets/prompt/generate_brainstorm.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at generating creative and original ideas.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
trunkYou are an AI researcher tasked with brainstorming initial, innovative ideas to address a given research problem in AI. Focus on generating diverse and creative approaches rather than finalized methods. The ideas can be rough and in their infancy but should cover a range of possible directions that could be explored further.
|
17 |
+
|
18 |
+
trunk### Information Provided:
|
19 |
+
trunk- **Research Background**: {background}
|
20 |
+
|
21 |
+
trunk### Approach:
|
22 |
+
trunkYour brainstorming should be systematic:
|
23 |
+
trunk- **Step 1**: Thoroughly understand the research background.
|
24 |
+
trunk- **Step 2**: Generate a list of 4 to 6 high-level ideas or directions that could potentially solve problems in the given background. Be creative, think outside the box, and avoid merely rephrasing existing methods.
|
25 |
+
|
26 |
+
trunk### Format for Your Response:
|
27 |
+
trunkPlease present 4 to 6 ideas in the following format:
|
28 |
+
trunk**Idea 1**: [Brief description of the first idea]
|
29 |
+
trunk**Idea 2**: [Brief description of the second idea]
|
30 |
+
trunk...
|
31 |
+
</text>
|
32 |
+
</query>
|
33 |
+
</body>
|
assets/prompt/generate_entity_list.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are an expert in extracting key entities from research contents. You are good at identifying the most important keywords or phrases that summarize the main topics or concepts discussed in the content.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You are an AI researcher tasked with extracting the key entities from a given research paper content. These entities should represent the most important keywords or phrases that summarize the main topics or concepts discussed in the content.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
**Content**: Focus on this content, and extract entities that serve as concrete manifestations of the main themes and topics within it.
|
20 |
+
|
21 |
+
### Approach:
|
22 |
+
Your entity extraction should be systematic:
|
23 |
+
- **Step 1**: Carefully read through the content to fully understand its main themes and topics.
|
24 |
+
- **Step 2**: Identify and list key entities central to the content, ensuring each entity is relevant, meaningful, and accurately represents the content.
|
25 |
+
|
26 |
+
### Entity Guidelines:
|
27 |
+
- Each entity should be no longer than 5 words and contain at least 2 words.
|
28 |
+
- The entities should be nouns or noun phrases.
|
29 |
+
- The total number of entities should be less than or equal to {max_num}.
|
30 |
+
|
31 |
+
### Examples:
|
32 |
+
{examples}
|
33 |
+
|
34 |
+
### Specific information:
|
35 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
36 |
+
**Content**: {content}
|
37 |
+
|
38 |
+
### Format for Your Response:
|
39 |
+
Please just give me the entities and spilt them by ", ":
|
40 |
+
< entity 1 >,< entity 2 >,...
|
41 |
+
</text>
|
42 |
+
<data>
|
43 |
+
<trunk>
|
44 |
+
<content>This paper presents a novel approach to automatic captioning of geo-tagged images by summarizing multiple webdocuments that contain information related to an image's location. The summarizer is biased by dependency pattern models towards sentences which contain features typically provided for different scene types such as those of churches, bridges, etc. Our results show that summaries biased by dependency pattern models lead to significantly higher ROUGE scores than both n-gram language models reported in previous work and also Wikipedia baseline summaries. Summaries generated using dependency patterns also lead to more readable summaries than those generated without dependency patterns.</content>
|
45 |
+
<entities>dependency pattern models, automatic captioning</entities>
|
46 |
+
</trunk>
|
47 |
+
<trunk>
|
48 |
+
<content>In this paper, we describe the 2015 iteration of the SemEval shared task on Sentiment Analysis in Twitter. This was the most popular sentiment analysis shared task to date with more than 40 teams participating in each of the last three years. This year's shared task competition consisted of five sentiment prediction subtasks. Two were reruns from previous years: (A) sentiment expressed by a phrase in the context of a tweet, and (B) overall sentiment of a tweet. We further included three new subtasks asking to predict (C) the sentiment towards a topic in a single tweet, (D) the overall sentiment towards a topic in a set of tweets, and (E) the degree of prior polarity of a phrase.</content>
|
49 |
+
<entities>sentiment analysis, shared task</entities>
|
50 |
+
</trunk>
|
51 |
+
<trunk>
|
52 |
+
<content>This paper presents two different tools which may be used as a support of speech recognition. The tool "transc" is the first one and it generates the phonetic transcription (pronunciation) of given utterance. It is based mainly on fixed rules which can be defined for Czech pronunciation but it can work also with specified list of exceptions which is defined on lexicon basis. It allows the usage of "transc" for unknown text with high probability of correct phonetic transcription generation. The second part is devoted to lexicon management tool "lexedit" which may be useful in the phase of generation of pronunciation lexicon for collected corpora. The presented tool allows editing of pronunciation, playing examples of pronunciation, comparison with reference lexicon, updating of reference lexicon, etc.</content>
|
53 |
+
<entities>speech recognition, phonetic transcription, lexicon management</entities>
|
54 |
+
</trunk>
|
55 |
+
<trunk>
|
56 |
+
<content>Previous research applying kernel methods to natural language parsing have focussed on proposing kernels over parse trees, which are hand-crafted based on domain knowledge and computational considerations. In this paper we propose a method for defining kernels in terms of a probabilistic model of parsing. This model is then trained, so that the parameters of the probabilistic model reflect the generalizations in the training data. The method we propose then uses these trained parameters to define a kernel for reranking parse trees. In experiments, we use a neural network based statistical parser as the probabilistic model, and use the resulting kernel with the Voted Perceptron algorithm to rerank the top 20 parses from the probabilistic model. This method achieves a significant improvement over the accuracy of the probabilistic model.</content>
|
57 |
+
<entities>parse trees, probabilistic model, natural language parsing</entities>
|
58 |
+
</trunk>
|
59 |
+
</data>
|
60 |
+
</query>
|
61 |
+
</body>
|
assets/prompt/generate_ground_truth.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>User Message</title>
|
8 |
+
<text>
|
9 |
+
### Task Description:
|
10 |
+
You will be provided with the abstract and a text extracted from a paper and three contributions of the paper. Your task is to filter, refine, and revise the content of the contributions through the text provided to you.
|
11 |
+
|
12 |
+
### Information Provided:
|
13 |
+
1. **Abstract**: It's the abstract directly extracted from the paper.
|
14 |
+
2. **Contributions**: These are the contributions (methods) we have summarized based on the abstract and introduction of the paper.
|
15 |
+
3. **Text**: It's the text directly extracted from the paper, containing the methodology of the paper.
|
16 |
+
|
17 |
+
### Approach:
|
18 |
+
Your approach should be systematic:
|
19 |
+
- **Step 1**: Start by reading the abstract and contributions, to understand the main work of this paper.
|
20 |
+
- **Step 2**: Then, read the text, to find information related to the contributions and ignore other information. If you think there is missing content in the contributions section, you can add one. On the contrary, if you think there is content duplication, merge or delete one. Please ensure that the final contributions have 2 to 4 entries.
|
21 |
+
- **Step 3**: Finally, provide specific details for each contribution as detailed and comprehensive as possible based on the content in the text. If applicable, you may include formulas or algorithms to support the ideas.
|
22 |
+
|
23 |
+
### Specific Information:
|
24 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
25 |
+
1. **Abstract**: {abstract}
|
26 |
+
2. **Contribution**: {contribution}
|
27 |
+
3. **Text**: {text}
|
28 |
+
|
29 |
+
### Format for Your Response:
|
30 |
+
Your output should follow the format, and please note that your subject should not be 'the paper' but 'this method' or the specific method name:
|
31 |
+
**Idea 1**: [The first method idea]
|
32 |
+
- **Details**: [Details of the first idea]
|
33 |
+
**Idea 2**: [The second method idea]
|
34 |
+
- **Details**: [Details of the second idea]
|
35 |
+
...
|
36 |
+
</text>
|
37 |
+
</query>
|
38 |
+
</body>
|
assets/prompt/generate_idea.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem along with its rationales. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem. Additionally, some cue words along with summaries, backgrounds, and contributions (methods) of related papers will be provided as sources of inspiration for generating novel ideas.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research Problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
20 |
+
2. **Related Papers**: Draw inspiration from the abstracts, backgrounds, and methods of these papers. Delve deeply into these methods, understand the motivations behind them, and think critically about how they might inform your approach. Avoid merely stacking existing methods; instead, integrate relevant aspects with your own insights to create original solutions.
|
21 |
+
|
22 |
+
### Approach:
|
23 |
+
Your approach should be systematic:
|
24 |
+
- **Step 1**: Thoroughly read the research problem to understand your primary focus.
|
25 |
+
- **Step 2**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain a broader perspective and insights relevant to the problem.
|
26 |
+
- **Step 3**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
27 |
+
|
28 |
+
### Specific Information:
|
29 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
30 |
+
1. **Research Problem & Rationales**: {problem}
|
31 |
+
2. **Related Papers**: {related_papers_information}
|
32 |
+
|
33 |
+
### Format for Your Response:
|
34 |
+
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
35 |
+
**Idea 1**: [The first method idea]
|
36 |
+
**Idea 2**: [The second method idea]
|
37 |
+
**Idea 3**: [The third method idea]
|
38 |
+
...
|
39 |
+
</text>
|
40 |
+
</query>
|
41 |
+
</body>
|
assets/prompt/generate_idea_by_inspiration.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem and its rationales, along with inspirations and their rationales extracted from related papers. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
20 |
+
2. **Inspirations**: Insights and ideas extracted from related papers that may provide valuable perspectives or techniques applicable to the research problem.
|
21 |
+
|
22 |
+
### Approach:
|
23 |
+
Your approach should be systematic:
|
24 |
+
- **Step 1**: Thoroughly read and understand the research problem to identify your primary focus.
|
25 |
+
- **Step 2**: Review the inspirations extracted from the related papers to gain a broader perspective and insights relevant to the research topic.
|
26 |
+
- **Step 3**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
27 |
+
|
28 |
+
### Specific Information:
|
29 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
30 |
+
1. **Research problem & Rationales**: {problem}
|
31 |
+
2. **Inspirations**: {inspirations_text}
|
32 |
+
|
33 |
+
### Format for Your Response:
|
34 |
+
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
35 |
+
**Idea 1**: [The first method idea]
|
36 |
+
**Idea 2**: [The second method idea]
|
37 |
+
**Idea 3**: [The third method idea]
|
38 |
+
...
|
39 |
+
</text>
|
40 |
+
</query>
|
41 |
+
</body>
|
assets/prompt/generate_idea_by_inspiration_with_cue_words.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem, its rationales and some cue words, along with inspirations and their rationales extracted from related papers. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
20 |
+
2. **Cue Words**: Some of these words can inspire or provide direction for you to generate ideas. You can try to think deeply in these directions and perspectives.
|
21 |
+
3. **Inspirations**: Insights and ideas extracted from related papers that may provide valuable perspectives or techniques applicable to the research problem.
|
22 |
+
|
23 |
+
### Approach:
|
24 |
+
Your approach should be systematic:
|
25 |
+
- **Step 1**: Thoroughly read and understand the research problem to identify your primary focus.
|
26 |
+
- **Step 2**: Read the cue words and think about whether these words can inspire or provide direction for you to come up with ideas.
|
27 |
+
- **Step 3**: Review the inspirations extracted from the related papers to gain a broader perspective and insights relevant to the research topic.
|
28 |
+
- **Step 4**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
29 |
+
|
30 |
+
### Specific Information:
|
31 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
32 |
+
1. **Research problem & Rationales**: {problem}
|
33 |
+
2. **Cue Words**: {cue_words}
|
34 |
+
3. **Inspirations**: {inspirations_text}
|
35 |
+
|
36 |
+
### Format for Your Response:
|
37 |
+
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
38 |
+
**Idea 1**: [The first method idea]
|
39 |
+
**Idea 2**: [The second method idea]
|
40 |
+
**Idea 3**: [The third method idea]
|
41 |
+
...
|
42 |
+
</text>
|
43 |
+
</query>
|
44 |
+
</body>
|
assets/prompt/generate_idea_with_cue_words.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem along with its rationales. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem. Additionally, some cue words along with summaries, backgrounds, and contributions (methods) of related papers will be provided as sources of inspiration for generating novel ideas.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research Problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
20 |
+
2. **Cue Words**: Some of these words can inspire or provide direction for you to generate ideas. You can try to think deeply in these directions and perspectives.
|
21 |
+
3. **Related Papers**: Draw inspiration from the abstracts, backgrounds, and methods of these papers. Delve deeply into these methods, understand the motivations behind them, and think critically about how they might inform your approach. Avoid merely stacking existing methods; instead, integrate relevant aspects with your own insights to create original solutions.
|
22 |
+
|
23 |
+
### Approach:
|
24 |
+
Your approach should be systematic:
|
25 |
+
- **Step 1**: Thoroughly read the research problem to understand your primary focus.
|
26 |
+
- **Step 2**: Read the cue words and think about whether these words can inspire or provide direction for you to come up with ideas.
|
27 |
+
- **Step 3**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain a broader perspective and insights relevant to the problem.
|
28 |
+
- **Step 4**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
29 |
+
|
30 |
+
### Specific Information:
|
31 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
32 |
+
1. **Research Problem & Rationales**: {problem}
|
33 |
+
2. **Cue Words**: {cue_words}
|
34 |
+
3. **Related Papers**: {related_papers_information}
|
35 |
+
|
36 |
+
### Format for Your Response:
|
37 |
+
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
38 |
+
**Idea 1**: [The first method idea]
|
39 |
+
**Idea 2**: [The second method idea]
|
40 |
+
**Idea 3**: [The third method idea]
|
41 |
+
...
|
42 |
+
</text>
|
43 |
+
</query>
|
44 |
+
</body>
|
assets/prompt/generate_inspiration.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at extracting novel and valuable inspirations from papers.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem, as well as the summary, backgrounds and contributions (methods) of a related paper. Your task is to extract a novel, effective, and specific inspiration from the related paper that can help addressing the research problem, and provide a brief rationale for this inspiration.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research problem**: The key issues or aspects of the problem that need to be addressed. These will serve as the foundation for generating your inspiration.
|
20 |
+
2. **Related paper**: Draw insights from the abstract, background, and methods of the related paper. Delve deeply into these methods, understand the motivations behind them, and critically assess how they might contribute to solving the research problem. Avoid merely replicating the methods; instead, synthesize relevant aspects with your own insights to derive a novel inspiration.
|
21 |
+
|
22 |
+
### Approach:
|
23 |
+
Your approach should be systematic:
|
24 |
+
- **Step 1**: Thoroughly read the research problem to clearly understand the primary focus.
|
25 |
+
- **Step 2**: Review the summary, background, and contributions (methods) of the related paper. Evaluate whether the methods proposed in the paper can provide solutions or insights relevant to the research problem.
|
26 |
+
- **Step 3**: Based on the information provided in the paper and your own analysis, propose a novel, effective, and specific inspiration. Include a rationale explaining how this inspiration helps addressing the research problem.
|
27 |
+
|
28 |
+
### Specific Information:
|
29 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
30 |
+
1. **Research problem**: {problem}
|
31 |
+
2. **Related paper**: {related_paper_information}
|
32 |
+
|
33 |
+
### Format for Your Response:
|
34 |
+
Your output should be around 200 words and follow the format:
|
35 |
+
**Inspiration**: [Your novel, effective, and specific idea derived from the related paper]
|
36 |
+
- **Rationale**: [The brief reasoning behind how this inspiration help addressing the research problem]
|
37 |
+
</text>
|
38 |
+
</query>
|
39 |
+
</body>
|
assets/prompt/generate_inspiration_with_cue_words.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at extracting novel and valuable inspirations from papers.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with a research problem, some cue words as well as the summary, backgrounds and contributions (methods) of a related paper. Your task is to extract a novel, effective, and specific inspiration from the related paper that can help addressing the research problem, and provide a brief rationale for this inspiration.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research problem**: The key issues or aspects of the problem that need to be addressed. These will serve as the foundation for generating your inspiration.
|
20 |
+
2. **Cue Words**: Some of these words can provide direction for you to extract inspiration. They should be the focus of your attention.
|
21 |
+
3. **Related paper**: Draw insights from the abstract, background, and methods of the related paper. Delve deeply into these methods, understand the motivations behind them, and critically assess how they might contribute to solving the research problem. Avoid merely replicating the methods; instead, synthesize relevant aspects with your own insights to derive a novel inspiration.
|
22 |
+
|
23 |
+
### Approach:
|
24 |
+
Your approach should be systematic:
|
25 |
+
- **Step 1**: Thoroughly read the research problem to clearly understand the primary focus.
|
26 |
+
- **Step 2**: Review the summary, background, and contributions (methods) of the related paper. Evaluate whether the methods proposed in the paper can provide solutions or insights relevant to the research problem.
|
27 |
+
- **Step 3**: Read the cue words and consider whether these words can be combined with information of the related paper to help providing inspiration.
|
28 |
+
- **Step 4**: Based on the information provided in the paper and your own analysis, propose a novel, effective, and specific inspiration. Include a rationale explaining how this inspiration helps addressing the research problem.
|
29 |
+
|
30 |
+
### Specific Information:
|
31 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
32 |
+
1. **Research problem**: {problem}
|
33 |
+
2. **Cue Words**: {cue_words}
|
34 |
+
3. **Related paper**: {related_paper_information}
|
35 |
+
|
36 |
+
### Format for Your Response:
|
37 |
+
Your output should be around 200 words and follow the format:
|
38 |
+
**Inspiration**: [Your novel, effective, and specific idea derived from the related paper]
|
39 |
+
- **Rationale**: [The brief reasoning behind how this inspiration help addressing the research problem]
|
40 |
+
</text>
|
41 |
+
</query>
|
42 |
+
</body>
|
assets/prompt/generate_problem.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at proposing novel and valuable questions based on research background.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will receive a research background along with summaries, backgrounds, and contributions (methods) of several related papers. Your task is to carefully analyze this information and propose a research problem that is original, clear, feasible, relevant, and significant to its field. Additionally, provide the rationales behind the proposed problem.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research Background**: This is your primary focus. The research problem you propose should be a direct reflection of this background.
|
20 |
+
2. **Related Papers**: These papers offer studies directly related to the primary research topic, providing additional insights and knowledge that will inform your proposed problem.
|
21 |
+
|
22 |
+
### Approach:
|
23 |
+
Your approach should be systematic:
|
24 |
+
- **Step 1**: Begin by thoroughly understanding the core focus of the research background.
|
25 |
+
- **Step 2**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain broader insights into the primary research topic.
|
26 |
+
- **Step 3**: Based on the provided information, propose a research problem that meets the criteria of being original, clear, feasible, relevant, and significant. Support your problem statement with clear rationales.
|
27 |
+
|
28 |
+
### Specific information:
|
29 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
30 |
+
1. **Research Background**: {background}
|
31 |
+
2. **Related Papers**: {related_papers_information}
|
32 |
+
|
33 |
+
### Format for Your Response:
|
34 |
+
**Research Problem**: [your problem]
|
35 |
+
- **Rationales**: [the rationale behind your problem]
|
36 |
+
</text>
|
37 |
+
</query>
|
38 |
+
</body>
|
assets/prompt/generate_problem_with_cue_words.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at proposing novel and valuable questions based on research background.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will receive a research background and some cue words along with summaries, backgrounds, and contributions (methods) of several related papers. Your task is to carefully analyze this information and propose a research problem that is original, clear, feasible, relevant, and significant to its field. Additionally, provide the rationales behind the proposed problem.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research Background**: This is your primary focus. The research problem you propose should be a direct reflection of this background.
|
20 |
+
2. **Cue Words**: Some of these words can provide direction and ideas for you to ask questions. They should be the focus of your attention.
|
21 |
+
3. **Related Papers**: These papers offer studies directly related to the primary research topic, providing additional insights and knowledge that will inform your proposed problem.
|
22 |
+
|
23 |
+
### Approach:
|
24 |
+
Your approach should be systematic:
|
25 |
+
- **Step 1**: Begin by thoroughly understanding the core focus of the research background.
|
26 |
+
- **Step 2**: Read the cue words and then determine the approximate direction of your problem.
|
27 |
+
- **Step 3**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain broader insights into the primary research topic.
|
28 |
+
- **Step 4**: Based on the provided information, propose a research problem that meets the criteria of being original, clear, feasible, relevant, and significant. Support your problem statement with clear rationales.
|
29 |
+
|
30 |
+
### Specific information:
|
31 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
32 |
+
1. **Research Background**: {background}
|
33 |
+
2. **Cue Words**: {cue_words}
|
34 |
+
3. **Related Papers**: {related_papers_information}
|
35 |
+
|
36 |
+
### Format for Your Response:
|
37 |
+
**Research Problem**: [your problem]
|
38 |
+
- **Rationales**: [the rationale behind your problem]
|
39 |
+
</text>
|
40 |
+
</query>
|
41 |
+
</body>
|
assets/prompt/get_similarity_score.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>User Message</title>
|
8 |
+
<text>
|
9 |
+
### Task Description:
|
10 |
+
You will be provided with an idea you previously generated, and a reference idea. Your task is to determine the similarity between the generated idea and the reference idea and give a score from 0 to 5.
|
11 |
+
|
12 |
+
### Information Provided:
|
13 |
+
1. **Generated Idea**: This is the idea you previously generated based on research background and several related papers.
|
14 |
+
2. **Reference Idea**: This is the idea we provide you with that you need to compare with the generated idea.
|
15 |
+
|
16 |
+
### Approach:
|
17 |
+
You should follow the following scoring criteria:
|
18 |
+
- **0**: The generated idea and reference idea are completely unrelated with no discernible similarities.
|
19 |
+
- **1**: The generated idea and reference idea have a vague connection, but differ significantly in their main concepts or approach.
|
20 |
+
- **2**: The generated idea and reference idea share a general concept but differ in most key aspects such as methodology or application.
|
21 |
+
- **3**: The generated idea and reference idea are similar in several areas, including general concept and some aspects of methodology, but differ in details or specific approaches.
|
22 |
+
- **4**: The generated idea and reference idea are largely similar in concept, methodology, and approach, with only minor differences in specifics.
|
23 |
+
- **5**: The generated idea and reference idea are nearly identical in all key aspects, including concept, methodology, and approach.
|
24 |
+
|
25 |
+
### Specific Information:
|
26 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
27 |
+
1. **Generated Idea**: {idea}
|
28 |
+
2. **Reference Idea**: {reference_idea}
|
29 |
+
|
30 |
+
### Format for Your Response:
|
31 |
+
Your answer can only have one number (from 0 to 5), indicating the similarity score, and cannot contain any other content.
|
32 |
+
</text>
|
33 |
+
</query>
|
34 |
+
</body>
|
assets/prompt/integrate_idea.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at generating innovative and original ideas to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
Task Description:
|
16 |
+
You will be provided with research background information along with a set of ideas you generated previously from with the related paper information, and a set of brainstorming ideas concerning the same research topic. Your task is to combine these ideas and generate new ones, the new ideas you generate should base on the ideas you generated previously, and integrate creative parts of the brainstorming ideas. Consider the background thoroughly, taking into account the novelty and practicability of each idea. If you think an idea you generate is reasonable and valuable, feel free to retain it.
|
17 |
+
|
18 |
+
### Information Provided:
|
19 |
+
1. **Research Background**: The starting point for idea generation based on the research context.
|
20 |
+
2. **Brainstorming Ideas**: These ideas were generated purely from the research background, focusing on innovation and may not be directly related to the problem.
|
21 |
+
3. **Generated Ideas**: These are the ideas you previously generated by considering both the research background and related papers.
|
22 |
+
|
23 |
+
### Approach:
|
24 |
+
- **Step 1**: Review the research background and original ideas to understand the foundation of the problem.
|
25 |
+
- **Step 2**: Consider the brainstorming ideas and original ideas together. Combine, improve, or expand upon them, integrating insights from the related papers.
|
26 |
+
- **Step 3**: Propose new ideas that are innovative and practical, ensuring they align with the research background.
|
27 |
+
|
28 |
+
### Specific Information:
|
29 |
+
1. **Research Background**: {background}
|
30 |
+
2. **Brainstorming Ideas**: {brainstorm}
|
31 |
+
3. **Generated Ideas**: {idea}
|
32 |
+
|
33 |
+
### Format for Your Response:
|
34 |
+
Please ensure that your final ideas include 5-6 entries and present the integrated ideas in the following format:
|
35 |
+
**Idea 1**: [The first method idea]
|
36 |
+
**Idea 2**: [The second method idea]
|
37 |
+
**Idea 3**: [The third method idea]
|
38 |
+
...
|
39 |
+
</text>
|
40 |
+
</query>
|
41 |
+
</body>
|
assets/prompt/modify_idea.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI.
|
10 |
+
</text>
|
11 |
+
</query>
|
12 |
+
<query rank="1">
|
13 |
+
<title>User Message</title>
|
14 |
+
<text>
|
15 |
+
### Task Description:
|
16 |
+
You will be provided with the research background and the original ideas you previously generated. Your task is to refine these original ideas by filtering out those with low feasibility and insufficient novelty while enhancing the most critical and relevant ideas to make them more novel, feasible, targeted, and specific. If applicable, you may include formulas or algorithms to support the ideas. Additionally, please adhere to the following requirements:
|
17 |
+
1. Do not generate ideas that are repetitive or contradictory.
|
18 |
+
2. Ensure that the generated ideas are coherent and form a cohesive whole.
|
19 |
+
|
20 |
+
### Information Provided:
|
21 |
+
1. **Research background**: This is the starting point of the original idea and the basis for analyzing whether the idea should be filtered.
|
22 |
+
2. **Original ideas**: These are the ideas you previously generated based on research background and several related papers.
|
23 |
+
|
24 |
+
### Approach:
|
25 |
+
Your approach should be systematic:
|
26 |
+
- **Step 1**: Thoroughly review the research background to understand the context and objectives.
|
27 |
+
- **Step 2**: Analyze the original ideas critically, identifying aspects with low feasibility or insufficient novelty, and then filter out them.
|
28 |
+
- **Step 3**: Enhance the most critical and relevant ideas by making them more novel, feasible, targeted, and specific. Incorporate formulas or algorithms if they strengthen the ideas.
|
29 |
+
|
30 |
+
### Specific Information:
|
31 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
32 |
+
1. **Research background**: {background}
|
33 |
+
2. **Original idea**: {idea}
|
34 |
+
|
35 |
+
### Format for Your Response:
|
36 |
+
Please ensure that your response only includes the final ideas, which include 2 to 4 entries, presented in the following format:
|
37 |
+
**Idea 1**: [The first method idea]
|
38 |
+
- **Details**: [Details of the first idea]
|
39 |
+
**Idea 2**: [The second method idea]
|
40 |
+
- **Details**: [Details of the second idea]
|
41 |
+
...
|
42 |
+
</text>
|
43 |
+
</query>
|
44 |
+
</body>
|
assets/prompt/novelty_eval.xml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>System Message</title>
|
8 |
+
<text>
|
9 |
+
You are an ambitious AI PhD student who is looking to publish a paper that will contribute significantly to the field.
|
10 |
+
You have an idea and you want to check if it is novel or not. I.e., not overlapping significantly with existing literature or already well explored.
|
11 |
+
Be a harsh critic for novelty, ensure there is a sufficient contribution in the idea for a new conference or workshop paper.
|
12 |
+
You will be given access to the Semantic Scholar API, which you may use to survey the literature and find relevant papers to help you make your decision.
|
13 |
+
The top 10 results for any search query will be presented to you with the abstracts.
|
14 |
+
|
15 |
+
You will be given {num_rounds} rounds to decide on the paper.
|
16 |
+
At any round, compare the provided idea with the information found in the article and provide a novelty score from 0 to 10.
|
17 |
+
In each search round, you should give a query and a novelty score based on the information in the relevant papers.
|
18 |
+
If there are no relevant papers, give a novelty score based on your own feelings.
|
19 |
+
</text>
|
20 |
+
</query>
|
21 |
+
<query rank="1">
|
22 |
+
<title>User Message</title>
|
23 |
+
<text>
|
24 |
+
Round {current_round}/{num_rounds}.
|
25 |
+
You have this idea:
|
26 |
+
|
27 |
+
"""
|
28 |
+
{idea}
|
29 |
+
"""
|
30 |
+
|
31 |
+
The results of the last query are (empty on first round):
|
32 |
+
"""
|
33 |
+
{last_query_results}
|
34 |
+
"""
|
35 |
+
|
36 |
+
Respond in the following format:
|
37 |
+
|
38 |
+
THOUGHT:
|
39 |
+
< THOUGHT >
|
40 |
+
|
41 |
+
RESPONSE:
|
42 |
+
```json
|
43 |
+
< JSON >
|
44 |
+
```
|
45 |
+
|
46 |
+
In < THOUGHT > , first briefly reason over the idea and identify any query that could help you suggest a score based on its novelty. Then give your perceived novelty score.
|
47 |
+
|
48 |
+
In < JSON > , respond in JSON format with ONLY the following field:
|
49 |
+
- "Query": An optional search query to search the literature (e.g. attention is all you need). You must make a query if you have not decided this round.
|
50 |
+
- "Novelty Score": A novelty score from 0 to 10.
|
51 |
+
|
52 |
+
A query will work best if you are able to recall the exact name of the paper you are looking for, or the authors.
|
53 |
+
This JSON will be automatically parsed, so ensure the format is precise. (the JSON MUST contain the "Query" and the "Novelty Score")
|
54 |
+
In the last round, you should assign a "" value to the "Query" even if you don't need to generate it.
|
55 |
+
</text>
|
56 |
+
</query>
|
57 |
+
</body>
|
assets/prompt/select_contribution.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>User Message</title>
|
8 |
+
<text>
|
9 |
+
### Task Description:
|
10 |
+
You will be provided with an idea you previously generated, and some reference ideas. Your task is to select the idea that is most similar to the one you generated from the reference ideas.
|
11 |
+
|
12 |
+
### Information Provided:
|
13 |
+
1. **Generated Idea**: This is the idea you previously generated based on research background and several related papers.
|
14 |
+
2. **Reference Ideas**: These are the ideas that you should select from.
|
15 |
+
|
16 |
+
### Approach:
|
17 |
+
Your approach should be systematic:
|
18 |
+
- **Step 1**: Analyze the generated idea to understand the methods it describes.
|
19 |
+
- **Step 2**: Critically review the reference ideas, selecting the idea that is most similar to the methods in the generated idea.
|
20 |
+
|
21 |
+
### Specific Information:
|
22 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
23 |
+
1. **Idea**: {idea}
|
24 |
+
2. **Reference Ideas**: {reference_ideas}
|
25 |
+
|
26 |
+
### Format for Your Response:
|
27 |
+
Your answer can only have one number (strating from 1), indicating the number of the most similar idea, and cannot contain any other content.
|
28 |
+
</text>
|
29 |
+
</query>
|
30 |
+
</body>
|
assets/prompt/transfer_form.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE body [
|
3 |
+
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
4 |
+
]>
|
5 |
+
<body>
|
6 |
+
<query rank="0">
|
7 |
+
<title>User Message</title>
|
8 |
+
<text>
|
9 |
+
### Task Description:
|
10 |
+
I will give you some ideas, please standardize the output format of the ideas without changing any characters in their content. Note that the content of each idea includes everything about the idea。
|
11 |
+
|
12 |
+
### Specific Information:
|
13 |
+
I will provide you with specific information now, please use them according to the instructions above:
|
14 |
+
**Ideas**:
|
15 |
+
'''
|
16 |
+
{idea}
|
17 |
+
'''
|
18 |
+
### Format for Your Response:
|
19 |
+
Please ensure that your final answer is strictly presented in the following format:
|
20 |
+
**1.**< The content of the first idea > .
|
21 |
+
**2.**< The content of the second idea > .
|
22 |
+
...
|
23 |
+
</text>
|
24 |
+
</query>
|
25 |
+
</body>
|
environment.yml
CHANGED
@@ -162,5 +162,5 @@ dependencies:
|
|
162 |
- wrapt==1.16.0
|
163 |
- wsproto==1.2.0
|
164 |
- zhipuai==2.1.5.20230904
|
165 |
-
- streamlit==1.
|
166 |
- huggingface-hub==0.26.2
|
|
|
162 |
- wrapt==1.16.0
|
163 |
- wsproto==1.2.0
|
164 |
- zhipuai==2.1.5.20230904
|
165 |
+
- streamlit==1.40.0
|
166 |
- huggingface-hub==0.26.2
|
requirements.txt
CHANGED
@@ -39,6 +39,7 @@ gmpy2==2.1.2
|
|
39 |
h11==0.14.0
|
40 |
httpcore==1.0.6
|
41 |
httpx==0.27.2
|
|
|
42 |
idna==3.7
|
43 |
interchange==2021.0.4
|
44 |
ipykernel==6.29.5
|
@@ -122,7 +123,7 @@ spacy-legacy==3.0.12
|
|
122 |
spacy-loggers==1.0.5
|
123 |
srsly==2.4.8
|
124 |
stack-data==0.6.3
|
125 |
-
streamlit==1.
|
126 |
sympy==1.13.2
|
127 |
tenacity==9.0.0
|
128 |
textstat==0.7.4
|
|
|
39 |
h11==0.14.0
|
40 |
httpcore==1.0.6
|
41 |
httpx==0.27.2
|
42 |
+
huggingface-hub==0.26.2
|
43 |
idna==3.7
|
44 |
interchange==2021.0.4
|
45 |
ipykernel==6.29.5
|
|
|
123 |
spacy-loggers==1.0.5
|
124 |
srsly==2.4.8
|
125 |
stack-data==0.6.3
|
126 |
+
streamlit==1.40.0
|
127 |
sympy==1.13.2
|
128 |
tenacity==9.0.0
|
129 |
textstat==0.7.4
|
src/app_pages/app_gradio_backup.py
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from button_interface import Backend
|
3 |
+
from generator import APIHelper
|
4 |
+
from utils.header import ConfigReader
|
5 |
+
|
6 |
+
DEBUG_MODE = False
|
7 |
+
|
8 |
+
def generate_page(backend):
|
9 |
+
with gr.Blocks(title="Scientific Paper Idea Proposer") as demo:
|
10 |
+
## Background, keywords parts
|
11 |
+
gr.Markdown(
|
12 |
+
"""
|
13 |
+
# Scientific Paper Idea Proposer
|
14 |
+
"""
|
15 |
+
)
|
16 |
+
# with gr.Blocks(theme="earneleh/paris") as d:
|
17 |
+
with gr.Blocks() as d:
|
18 |
+
with gr.Tab("Keywords"):
|
19 |
+
key_words = gr.Textbox(placeholder="Interested key words", label="Keywords (Provide at least 1 keyword)")
|
20 |
+
with gr.Tab("Background"):
|
21 |
+
background = gr.Textbox(placeholder="Background", label="Background")
|
22 |
+
if DEBUG_MODE:
|
23 |
+
with gr.Tab("Json"):
|
24 |
+
json_file = gr.File()
|
25 |
+
json_background = gr.Textbox(placeholder="Background", label="Background")
|
26 |
+
json_strs = gr.Textbox(visible=False)
|
27 |
+
json_file.upload(backend.upload_json_callback, inputs=[json_file], outputs=[json_background])
|
28 |
+
else:
|
29 |
+
json_strs = None
|
30 |
+
|
31 |
+
## brainstorm ideas parts
|
32 |
+
# background2brainstorm = gr.Button("Continue (background2brainstorm)")
|
33 |
+
with gr.Row(equal_height=True):
|
34 |
+
gr.ClearButton(value="🆑 Clear", components=[background], scale=1)
|
35 |
+
background2brainstorm = gr.Button("😈 Brainstorm", scale=1)
|
36 |
+
# @gr.render(inputs=None, triggers=[background2brainstorm.click])
|
37 |
+
# def show_brainstorm():
|
38 |
+
# with gr.Accordion("Braining Ideas", open=False) as a1:
|
39 |
+
with gr.Row(equal_height=True):
|
40 |
+
brainstorm_txt = gr.Textbox(placeholder="Generated brainstorm ideas", label="Brainstorm ideas", info="Feel free to improve them before next step", max_lines=500)
|
41 |
+
brainstorm_md = gr.Markdown(label="Brainstorm ideas")
|
42 |
+
|
43 |
+
## Expanded key words parts
|
44 |
+
# brainstorm2entities = gr.Button("Continue (brainstorm2entities)")
|
45 |
+
with gr.Row(equal_height=True):
|
46 |
+
gr.ClearButton(value="🆑 Clear", components=[brainstorm_txt], scale=1)
|
47 |
+
brainstorm2entities = gr.Button("Extract Entities", scale=1)
|
48 |
+
entities = gr.CheckboxGroup([], label="Expanded key words", visible=True)
|
49 |
+
entities2literature = gr.Button("📖 Retrieve Literature")
|
50 |
+
literature_intact = gr.State()
|
51 |
+
# entities2literature = gr.Button("Continue (retrieve literature)")
|
52 |
+
|
53 |
+
## Retrieved literature parts
|
54 |
+
retrieved_literature = gr.Textbox(placeholder="Retrieved literature", label="Retrieved related works", info="", max_lines=500)
|
55 |
+
# literature2initial_ideas = gr.Button("Continue (generate initial ideas)")
|
56 |
+
with gr.Row(equal_height=True):
|
57 |
+
gr.ClearButton(value="🆑 Clear", components=[retrieved_literature], scale=1)
|
58 |
+
literature2initial_ideas = gr.Button("🤖 Generate Initial ideas", scale=1)
|
59 |
+
|
60 |
+
|
61 |
+
## Initial ideas parts
|
62 |
+
with gr.Row():
|
63 |
+
initial_ideas_txt = gr.Textbox(placeholder="Initial ideas", label="Initial ideas", info="Feel free to improve them before next step", max_lines=500)
|
64 |
+
initial_ideas_md = gr.Markdown(label="Initial ideas")
|
65 |
+
# initial2final = gr.Button("Continue (generate final ideas)")
|
66 |
+
with gr.Row(equal_height=True):
|
67 |
+
gr.ClearButton(value="🆑 Clear", components=[initial_ideas_txt], scale=1)
|
68 |
+
initial2final = gr.Button("🔥 Refine Ideas")
|
69 |
+
|
70 |
+
## Final ideas parts
|
71 |
+
with gr.Row():
|
72 |
+
final_ideas_txt = gr.Textbox(placeholder="Final ideas", label="Final ideas", info="", max_lines=500)
|
73 |
+
final_ideas_md = gr.Markdown(label="Final ideas")
|
74 |
+
|
75 |
+
# register callback
|
76 |
+
background2brainstorm.click(backend.background2brainstorm_callback, inputs=[background], outputs=[brainstorm_txt])
|
77 |
+
brainstorm2entities.click(backend.brainstorm2entities_callback, inputs=[background, brainstorm_txt], outputs=[entities])
|
78 |
+
brainstorm_txt.change(lambda input: input, inputs=brainstorm_txt, outputs=brainstorm_md)
|
79 |
+
initial_ideas_txt.change(lambda input: input, inputs=initial_ideas_txt, outputs=initial_ideas_md)
|
80 |
+
final_ideas_txt.change(lambda input: input, inputs=final_ideas_txt, outputs=final_ideas_md)
|
81 |
+
entities2literature.click(backend.entities2literature_callback, inputs=[background, entities], outputs=[retrieved_literature, literature_intact])
|
82 |
+
literature2initial_ideas.click(backend.literature2initial_ideas_callback, inputs=[background, literature_intact], outputs=[initial_ideas_txt, final_ideas_txt])
|
83 |
+
initial2final.click(backend.initial2final_callback, inputs=[initial_ideas_txt], outputs=[final_ideas_txt])
|
84 |
+
return demo
|
85 |
+
|
86 |
+
if __name__ == "__main__":
|
87 |
+
backend = Backend()
|
88 |
+
demo = generate_page(backend)
|
89 |
+
demo.launch(server_name="0.0.0.0", share=True)
|
src/app_pages/button_interface.py
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
from utils.paper_retriever import RetrieverFactory
|
3 |
+
from utils.llms_api import APIHelper
|
4 |
+
from utils.header import ConfigReader
|
5 |
+
from generator import IdeaGenerator
|
6 |
+
|
7 |
+
class Backend(object):
|
8 |
+
def __init__(self) -> None:
|
9 |
+
CONFIG_PATH = "./configs/datasets.yaml"
|
10 |
+
EXAMPLE_PATH = "./assets/data/example.json"
|
11 |
+
USE_INSPIRATION = True
|
12 |
+
BRAINSTORM_MODE = "mode_c"
|
13 |
+
|
14 |
+
self.config = ConfigReader.load(CONFIG_PATH)
|
15 |
+
RETRIEVER_NAME = self.config.RETRIEVE.retriever_name
|
16 |
+
self.api_helper = APIHelper(self.config)
|
17 |
+
self.retriever_factory = RetrieverFactory.get_retriever_factory().create_retriever(
|
18 |
+
RETRIEVER_NAME,
|
19 |
+
self.config
|
20 |
+
)
|
21 |
+
self.idea_generator = IdeaGenerator(self.config, None)
|
22 |
+
self.use_inspiration = USE_INSPIRATION
|
23 |
+
self.brainstorm_mode = BRAINSTORM_MODE
|
24 |
+
self.examples = self.load_examples(EXAMPLE_PATH)
|
25 |
+
|
26 |
+
def load_examples(self, path):
|
27 |
+
try:
|
28 |
+
with open(path, "r") as f:
|
29 |
+
data = json.load(f)
|
30 |
+
return data
|
31 |
+
except (FileNotFoundError, json.JSONDecodeError) as e:
|
32 |
+
print(f"Error loading examples from {path}: {e}")
|
33 |
+
return []
|
34 |
+
|
35 |
+
def background2brainstorm_callback(self, background, json_strs=None):
|
36 |
+
if json_strs is not None: # only for DEBUG_MODE
|
37 |
+
json_contents = json.loads(json_strs)
|
38 |
+
return json_contents["brainstorm"]
|
39 |
+
else:
|
40 |
+
return self.api_helper.generate_brainstorm(background)
|
41 |
+
|
42 |
+
def brainstorm2entities_callback(self, background, brainstorm, json_strs=None):
|
43 |
+
if json_strs is not None: # only for DEBUG_MODE
|
44 |
+
json_contents = json.loads(json_strs)
|
45 |
+
entities_bg = json_contents["entities_bg"]
|
46 |
+
entities_bs = json_contents["entities_bs"]
|
47 |
+
entities_all = entities_bg + entities_bs
|
48 |
+
# return gr.CheckboxGroup(choices=entities, value=entities, label="Expanded key words", visible=True)
|
49 |
+
return entities_all
|
50 |
+
else:
|
51 |
+
entities_bg = self.api_helper.generate_entity_list(background)
|
52 |
+
entities_bs = self.api_helper.generate_entity_list(brainstorm, 10)
|
53 |
+
entities_all = list(set(entities_bg) | set(entities_bs))
|
54 |
+
# return extracted_entities
|
55 |
+
# return gr.CheckboxGroup(choices=entities_all, value=entities_all, label="Expanded key words", visible=True)
|
56 |
+
return entities_all
|
57 |
+
|
58 |
+
def upload_json_callback(self, input):
|
59 |
+
# print(type(input))
|
60 |
+
# print(len(input))
|
61 |
+
# print(input) # temp file path
|
62 |
+
with open(input, "r") as json_file:
|
63 |
+
contents = json_file.read()
|
64 |
+
json_contents = json.loads(contents)
|
65 |
+
return [json_contents["background"], contents]
|
66 |
+
|
67 |
+
def entities2literature_callback(self, background, entities, json_strs=None):
|
68 |
+
if json_strs is not None:
|
69 |
+
json_contents = json.loads(json_strs)
|
70 |
+
res = ""
|
71 |
+
for i, p in enumerate(json_contents["related_paper"]):
|
72 |
+
res += "%d. " % (i + 1) + str(p)
|
73 |
+
if i < len(json_contents["related_paper"]) - 1:
|
74 |
+
res += "\n"
|
75 |
+
return res, res
|
76 |
+
else:
|
77 |
+
result = self.retriever_factory.retrieve(background, entities, need_evaluate=False, target_paper_id_list=[])
|
78 |
+
res = ""
|
79 |
+
for i, p in enumerate(result["related_paper"]):
|
80 |
+
res += "%d. " % (i + 1) + str(p["title"])
|
81 |
+
if i < len(result["related_paper"]) - 1:
|
82 |
+
res += "\n"
|
83 |
+
return res, result["related_paper"]
|
84 |
+
|
85 |
+
def literature2initial_ideas_callback(self, background, brainstorms, retrieved_literature, json_strs=None):
|
86 |
+
if json_strs is not None:
|
87 |
+
json_contents = json.loads(json_strs)
|
88 |
+
return json_contents["median"]["initial_idea"]
|
89 |
+
else:
|
90 |
+
self.idea_generator.paper_list = retrieved_literature
|
91 |
+
self.idea_generator.brainstorm = brainstorms
|
92 |
+
if self.use_inspiration:
|
93 |
+
message_input, idea_modified, median = (
|
94 |
+
self.idea_generator.generate_by_inspiration(
|
95 |
+
background, "new_idea", self.brainstorm_mode, False)
|
96 |
+
)
|
97 |
+
else:
|
98 |
+
message_input, idea_modified, median = self.idea_generator.generate(
|
99 |
+
background, "new_idea", self.brainstorm_mode, False
|
100 |
+
)
|
101 |
+
return median["initial_idea"], idea_modified
|
102 |
+
|
103 |
+
def initial2final_callback(self, initial_ideas, final_ideas, json_strs=None):
|
104 |
+
if json_strs is not None:
|
105 |
+
json_contents = json.loads(json_strs)
|
106 |
+
return json_contents["median"]["modified_idea"]
|
107 |
+
else:
|
108 |
+
return final_ideas
|
109 |
+
|
110 |
+
def get_demo_i(self, i):
|
111 |
+
if 0 <= i < len(self.examples):
|
112 |
+
return self.examples[i].get("background", "Background not found.")
|
113 |
+
else:
|
114 |
+
return "Example not found. Please select a valid index."
|
115 |
+
# return ("The application scope of large-scale language models such as GPT-4 and LLaMA "
|
116 |
+
# "has rapidly expanded, demonstrating powerful capabilities in natural language processing "
|
117 |
+
# "and multimodal tasks. However, as the size and complexity of the models increase, understanding "
|
118 |
+
# "how they make decisions becomes increasingly difficult. Challenge: 1 The complexity of model "
|
119 |
+
# "interpretation: The billions of parameters and nonlinear decision paths within large-scale language "
|
120 |
+
# "models make it very difficult to track and interpret specific outputs. The existing interpretation "
|
121 |
+
# "methods usually only provide a local perspective and are difficult to systematize. 2. Transparency "
|
122 |
+
# "and Fairness: In specific scenarios, models may exhibit biased or discriminatory behavior. Ensuring "
|
123 |
+
# "the transparency of these models, reducing bias, and providing credible explanations is one of the current challenges.")
|
src/app_pages/homepage.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import streamlit as st
|
3 |
+
from .locale import _
|
4 |
+
from .sidebar_components import get_sidebar_header, get_sidebar_supported_fields, get_help_us_improve, get_language_select
|
5 |
+
|
6 |
+
def generate_sidebar():
|
7 |
+
get_sidebar_header()
|
8 |
+
st.sidebar.markdown("Make AI research easy")
|
9 |
+
get_sidebar_supported_fields()
|
10 |
+
get_help_us_improve()
|
11 |
+
get_language_select()
|
12 |
+
|
13 |
+
|
14 |
+
def generate_mainpage():
|
15 |
+
st.title("🏠️ 💡SciPIP: An LLM-based Scientific Paper Idea Proposer")
|
16 |
+
# st.image("./assets/pic/logo.pdf")
|
17 |
+
st.header("Introduction")
|
18 |
+
st.markdown("SciPIP is a scientific paper idea generation tool powered by a large language model (LLM) designed to **assist researchers in quickly generating novel research ideas**. Based on the background information provided by the user, SciPIP first conducts a literature review to identify relevant research, then generates fresh ideas for potential studies.")
|
19 |
+
|
20 |
+
|
21 |
+
def home_page():
|
22 |
+
generate_sidebar()
|
23 |
+
generate_mainpage()
|
src/app_pages/locale.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
json_contents = json.loads(open("./src/app_pages/locale.json", "r").read())
|
5 |
+
|
6 |
+
def _(content: str):
|
7 |
+
if st.session_state["language"] == "en":
|
8 |
+
return content
|
9 |
+
a = json_contents.get(content, content)
|
10 |
+
if isinstance(a, dict):
|
11 |
+
return a.get(st.session_state["language"], content)
|
12 |
+
else:
|
13 |
+
return content
|
14 |
+
|
src/app_pages/one_click_generation.py
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from .locale import _
|
3 |
+
from .sidebar_components import get_sidebar_header, get_sidebar_supported_fields, get_help_us_improve, get_language_select
|
4 |
+
|
5 |
+
# st.set_page_config(layout="wide", page_title="🦜🔗 Generate Idea Step-by-step")
|
6 |
+
|
7 |
+
## Pipeline global state
|
8 |
+
# 1.0: Input background is in progress
|
9 |
+
# 2.0: Brainstorming is in progress
|
10 |
+
# 2.5 Brainstorming is finished
|
11 |
+
# 3.0: Extracting entities is in progress
|
12 |
+
# 3.5 Extracting entities is finished
|
13 |
+
# 4.0: Retrieving literature is in progress
|
14 |
+
# 4.5 Retrieving ideas is finished
|
15 |
+
# 5.0: Generating initial ideas is in progress
|
16 |
+
# 5.5 Generating initial ideas is finished
|
17 |
+
# 6.0: Generating final ideas is in progress
|
18 |
+
# 6.5 Generating final ideas is finished
|
19 |
+
if "global_state_one_click" not in st.session_state:
|
20 |
+
st.session_state["global_state_one_click"] = 1.0
|
21 |
+
|
22 |
+
def generate_sidebar():
|
23 |
+
get_sidebar_header()
|
24 |
+
st.sidebar.markdown(
|
25 |
+
_("SciPIP will generate ideas in one click. The generation pipeline is the same as "
|
26 |
+
"step-by-step generation, but you are free from caring about intermediate outputs.")
|
27 |
+
)
|
28 |
+
|
29 |
+
pipeline_list = [_("1. Input Background"), _("2. Brainstorming"), _("3. Extracting Entities"), _("4. Retrieving Related Works"),
|
30 |
+
_("5. Generate Initial Ideas"), _("6. Generate Final Ideas")]
|
31 |
+
st.sidebar.header(_("Pipeline"), divider="red")
|
32 |
+
for i in range(6):
|
33 |
+
st.sidebar.markdown(f"<font color='black'>{pipeline_list[i]}</font>", unsafe_allow_html=True)
|
34 |
+
|
35 |
+
get_sidebar_supported_fields()
|
36 |
+
get_help_us_improve()
|
37 |
+
get_language_select()
|
38 |
+
|
39 |
+
def generate_mainpage(backend):
|
40 |
+
st.title(_("💧 One-click Generation"))
|
41 |
+
|
42 |
+
if "messages" not in st.session_state:
|
43 |
+
st.session_state["messages"] = [{"role": "assistant", "content": "Please give me some key words or a background"}]
|
44 |
+
if "intermediate_output" not in st.session_state:
|
45 |
+
st.session_state["intermediate_output"] = {}
|
46 |
+
|
47 |
+
for msg in st.session_state.messages:
|
48 |
+
st.chat_message(msg["role"]).write(msg["content"])
|
49 |
+
|
50 |
+
def disable_submit():
|
51 |
+
st.session_state["enable_submmit"] = False
|
52 |
+
|
53 |
+
if prompt := st.chat_input(disabled=not st.session_state.get("enable_submmit", True), on_submit=disable_submit):
|
54 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
55 |
+
st.chat_message("user").write(prompt)
|
56 |
+
generate_ideas(backend, prompt)
|
57 |
+
elif st.session_state.get("use_demo_input", False):
|
58 |
+
generate_ideas(backend, st.session_state.get("demo_input"))
|
59 |
+
st.session_state["use_demo_input"] = False
|
60 |
+
del(st.session_state["demo_input"])
|
61 |
+
|
62 |
+
def get_demo_n(i):
|
63 |
+
demo_input = backend.get_demo_i(i)
|
64 |
+
st.session_state["enable_submmit"] = False
|
65 |
+
st.session_state.messages.append({"role": "user", "content": demo_input})
|
66 |
+
st.session_state["use_demo_input"] = True
|
67 |
+
st.session_state["demo_input"] = demo_input
|
68 |
+
|
69 |
+
cols = st.columns([1, 1, 1, 1])
|
70 |
+
cols[0].button(_("Example 1"), on_click=get_demo_n, args=(0,), use_container_width=True, disabled=not st.session_state.get("enable_submmit", True))
|
71 |
+
cols[1].button(_("Example 2"), on_click=get_demo_n, args=(1,), use_container_width=True, disabled=not st.session_state.get("enable_submmit", True))
|
72 |
+
cols[2].button(_("Example 3"), on_click=get_demo_n, args=(2,), use_container_width=True, disabled=not st.session_state.get("enable_submmit", True))
|
73 |
+
cols[3].button(_("Example 4"), on_click=get_demo_n, args=(3,), use_container_width=True, disabled=not st.session_state.get("enable_submmit", True))
|
74 |
+
|
75 |
+
def check_intermediate_outputs(id="brainstorms"):
|
76 |
+
msg = st.session_state["intermediate_output"].get(id, None)
|
77 |
+
if msg is not None:
|
78 |
+
st.session_state.messages.append(msg)
|
79 |
+
else:
|
80 |
+
st.toast(f"No {id} now!")
|
81 |
+
|
82 |
+
def reset():
|
83 |
+
del(st.session_state["messages"])
|
84 |
+
st.session_state["enable_submmit"] = True
|
85 |
+
st.session_state["global_state_one_click"] = 1.0
|
86 |
+
st.toast(f"The chat has been reset!")
|
87 |
+
|
88 |
+
cols = st.columns([1, 1, 1, 1])
|
89 |
+
cols[0].button(_("Check Brainstorms"), on_click=check_intermediate_outputs, args=("brainstorms",), use_container_width=True)
|
90 |
+
cols[1].button(_("Check Entities"), on_click=check_intermediate_outputs, args=("entities",), use_container_width=True)
|
91 |
+
cols[2].button(_("Check Retrieved Papers"), on_click=check_intermediate_outputs, args=("related_works",), use_container_width=True)
|
92 |
+
cols[3].button(_("Reset Chat"), on_click=reset, use_container_width=True, type="primary")
|
93 |
+
|
94 |
+
def generate_ideas(backend, background):
|
95 |
+
with st.spinner(text=("Brainstorming...")):
|
96 |
+
brainstorms = backend.background2brainstorm_callback(background)
|
97 |
+
st.session_state["intermediate_output"]["brainstorms"] = {"role": "assistant", "content": brainstorms}
|
98 |
+
# st.chat_message("assistant").write(brainstorms)
|
99 |
+
st.session_state["global_state_one_click"] = 2.5
|
100 |
+
|
101 |
+
with st.spinner(text=("Extracting entities...")):
|
102 |
+
entities = backend.brainstorm2entities_callback(background, brainstorms)
|
103 |
+
st.session_state["intermediate_output"]["entities"] = {"role": "assistant", "content": entities}
|
104 |
+
# st.chat_message("assistant").write(entities)
|
105 |
+
st.session_state["global_state_one_click"] = 3.5
|
106 |
+
|
107 |
+
with st.spinner(text=("Retrieving related works...")):
|
108 |
+
msg = "My initial ideas are:"
|
109 |
+
related_works, related_works_intact = backend.entities2literature_callback(background, entities)
|
110 |
+
st.session_state["intermediate_output"]["related_works"] = {"role": "assistant", "content": related_works}
|
111 |
+
# st.chat_message("assistant").write(related_works)
|
112 |
+
st.session_state["global_state_one_click"] = 4.5
|
113 |
+
|
114 |
+
with st.spinner(text="Generating initial ideas..."):
|
115 |
+
msg = "My initial ideas are:"
|
116 |
+
initial_ideas, final_ideas = backend.literature2initial_ideas_callback(background, brainstorms, related_works_intact)
|
117 |
+
st.session_state.messages.append({"role": "assistant", "content": msg})
|
118 |
+
st.chat_message("assistant").write(msg)
|
119 |
+
st.session_state.messages.append({"role": "assistant", "content": initial_ideas})
|
120 |
+
st.chat_message("assistant").write(initial_ideas)
|
121 |
+
st.session_state["global_state_one_click"] = 5.5
|
122 |
+
|
123 |
+
with st.spinner(text=("Generating final ideas...")):
|
124 |
+
msg = "My final ideas after refinement are:"
|
125 |
+
final_ideas = backend.initial2final_callback(initial_ideas, final_ideas)
|
126 |
+
st.session_state.messages.append({"role": "assistant", "content": msg})
|
127 |
+
st.chat_message("assistant").write(msg)
|
128 |
+
st.session_state.messages.append({"role": "assistant", "content": final_ideas})
|
129 |
+
st.chat_message("assistant").write(final_ideas)
|
130 |
+
st.session_state["global_state_one_click"] = 6.5
|
131 |
+
|
132 |
+
def one_click_generation(backend):
|
133 |
+
generate_sidebar()
|
134 |
+
generate_mainpage(backend)
|
src/app_pages/sidebar_components.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from .locale import _
|
3 |
+
|
4 |
+
# def generate_sidebar():
|
5 |
+
|
6 |
+
def get_sidebar_header():
|
7 |
+
st.sidebar.header("SciPIP", divider="rainbow")
|
8 |
+
|
9 |
+
def get_sidebar_supported_fields():
|
10 |
+
st.sidebar.header(_("Supported Fields"), divider="orange")
|
11 |
+
st.sidebar.caption(_("The supported fields are temporarily limited because we only collect literature "
|
12 |
+
"from ICML, ICLR, NeurIPS, ACL, and EMNLP. Support for other fields are in progress."))
|
13 |
+
st.sidebar.checkbox(_("Natural Language Processing (NLP)"), value=True, disabled=True)
|
14 |
+
st.sidebar.checkbox(_("Computer Vision (CV)"), value=False, disabled=True)
|
15 |
+
|
16 |
+
st.sidebar.checkbox(_("[Partial] Multimodal"), value=True, disabled=True)
|
17 |
+
st.sidebar.checkbox(_("Incoming Other Fields"), value=False, disabled=True)
|
18 |
+
|
19 |
+
def get_help_us_improve():
|
20 |
+
st.sidebar.header(_("Help Us To Improve"), divider="green")
|
21 |
+
st.sidebar.markdown("https://forms.gle/YpLUrhqs1ahyCAe99", unsafe_allow_html=True)
|
22 |
+
|
23 |
+
def get_language_select():
|
24 |
+
st.sidebar.header("语言 / Language", divider="blue")
|
25 |
+
language_option = st.sidebar.selectbox(
|
26 |
+
"选择语言 / Select Language",
|
27 |
+
options=["中文", "English"],
|
28 |
+
)
|
29 |
+
if language_option == "中文":
|
30 |
+
language = "zh"
|
31 |
+
elif language_option == "English":
|
32 |
+
language = "en"
|
33 |
+
if language != st.session_state["language"]:
|
34 |
+
st.session_state["language"] = language
|
35 |
+
st.rerun()
|
src/app_pages/step_by_step_generation.py
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ast
|
2 |
+
import streamlit as st
|
3 |
+
from .locale import _
|
4 |
+
from .sidebar_components import get_sidebar_header, get_sidebar_supported_fields, get_help_us_improve, get_language_select
|
5 |
+
|
6 |
+
def generate_sidebar():
|
7 |
+
get_sidebar_header()
|
8 |
+
st.sidebar.markdown(
|
9 |
+
_("SciPIP will generate ideas step by step. The generation pipeline is the same as "
|
10 |
+
"one-click generation, while you can improve each part manually after SciPIP providing the manuscript.")
|
11 |
+
)
|
12 |
+
|
13 |
+
DONE_COLOR = "black"
|
14 |
+
UNDONE_COLOR = "gray"
|
15 |
+
# INPROGRESS_COLOR = "#4d9ee6"
|
16 |
+
INPROGRESS_COLOR = "black"
|
17 |
+
color_list = []
|
18 |
+
pipeline_list = [_("1. Input Background"), _("2. Brainstorming"), _("3. Extracting Entities"), _("4. Retrieving Related Works"),
|
19 |
+
_("5. Generate Initial Ideas"), _("6. Generate Final Ideas")]
|
20 |
+
for i in range(1, 8):
|
21 |
+
if st.session_state["global_state_step"] < i:
|
22 |
+
color_list.append(UNDONE_COLOR)
|
23 |
+
elif st.session_state["global_state_step"] == i:
|
24 |
+
color_list.append(INPROGRESS_COLOR)
|
25 |
+
elif st.session_state["global_state_step"] > i:
|
26 |
+
color_list.append(DONE_COLOR)
|
27 |
+
st.sidebar.header(_("Pipeline"), divider="red")
|
28 |
+
for i in range(6):
|
29 |
+
st.sidebar.markdown(f"<font color='{color_list[i]}'>{pipeline_list[i]}</font>", unsafe_allow_html=True)
|
30 |
+
# if st.session_state["global_state_step"] == i + 1:
|
31 |
+
# st.sidebar.progress(50, text=None)
|
32 |
+
|
33 |
+
get_sidebar_supported_fields()
|
34 |
+
get_help_us_improve()
|
35 |
+
get_language_select()
|
36 |
+
|
37 |
+
def get_textarea_height(text_content):
|
38 |
+
if text_content is None:
|
39 |
+
return 100
|
40 |
+
lines = text_content.split("\n")
|
41 |
+
count = len(lines)
|
42 |
+
for line in lines:
|
43 |
+
count += len(line) // 96
|
44 |
+
return max(count * 23 + 20, 100) # 23 is a magic number
|
45 |
+
|
46 |
+
def generate_mainpage(backend):
|
47 |
+
# print("refresh mainpage")
|
48 |
+
st.title(_("💦 Step-by-step Generation"))
|
49 |
+
st.header(_("🐳 Background"))
|
50 |
+
with st.form('background_form') as bg_form:
|
51 |
+
background = st.session_state.get("background", "")
|
52 |
+
background = st.text_area("Input your field background", background, placeholder="Input your field background", height=200, label_visibility="collapsed")
|
53 |
+
|
54 |
+
cols = st.columns(4)
|
55 |
+
def click_demo_i(i):
|
56 |
+
st.session_state["background"] = backend.get_demo_i(i)
|
57 |
+
for i, col in enumerate(cols):
|
58 |
+
col.form_submit_button(f"Example {i + 1}", use_container_width=True, on_click=click_demo_i, args=(i,))
|
59 |
+
|
60 |
+
col1, col2 = st.columns([2, 20])
|
61 |
+
submitted = col1.form_submit_button(_("Submit"), type="primary")
|
62 |
+
if submitted:
|
63 |
+
st.session_state["global_state_step"] = 2.0
|
64 |
+
with st.spinner(text="Brainstorming..."):
|
65 |
+
st.session_state["brainstorms"] = backend.background2brainstorm_callback(background)
|
66 |
+
# st.session_state["brainstorms"] = "Test text"
|
67 |
+
st.session_state["brainstorms_expand"] = True
|
68 |
+
st.session_state["global_state_step"] = 2.5
|
69 |
+
|
70 |
+
## Brainstorms
|
71 |
+
st.header(_("👻 Brainstorms"))
|
72 |
+
with st.expander("", expanded=st.session_state.get("brainstorms_expand", False)):
|
73 |
+
# st.write("<div class='myclass'>")
|
74 |
+
col1, col2 = st.columns(2)
|
75 |
+
widget_height = get_textarea_height(st.session_state.get("brainstorms", ""))
|
76 |
+
brainstorms = col1.text_area(label="brainstorms", value=st.session_state.get("brainstorms", ""),
|
77 |
+
label_visibility="collapsed", height=widget_height)
|
78 |
+
st.session_state["brainstorms"] = brainstorms
|
79 |
+
if brainstorms:
|
80 |
+
col2.markdown(f"{brainstorms}")
|
81 |
+
else:
|
82 |
+
col2.markdown(_("Please input the brainstorms on the left."))
|
83 |
+
# st.write("</div>")
|
84 |
+
col1, col2 = st.columns([2, 20])
|
85 |
+
submitted = col1.button(_("Submit"), type="primary")
|
86 |
+
if submitted:
|
87 |
+
st.session_state["global_state_step"] = 3.0
|
88 |
+
with st.spinner(text="Extracting entities..."):
|
89 |
+
st.session_state["entities"] = backend.brainstorm2entities_callback(background, brainstorms)
|
90 |
+
# st.session_state["entities"] = "entities"
|
91 |
+
st.session_state["global_state_step"] = 3.5
|
92 |
+
st.session_state["entities_expand"] = True
|
93 |
+
|
94 |
+
## Entities
|
95 |
+
st.header(_("🐱 Extracted Entities"))
|
96 |
+
with st.expander("", expanded=st.session_state.get("entities_expand", False)):
|
97 |
+
## text area
|
98 |
+
# col1, col2 = st.columns(2, )
|
99 |
+
# entities_old = col1.text_area(label="entities", value=st.session_state.get("entities", "[]"), label_visibility="collapsed")
|
100 |
+
# entities_old = ast.literal_eval(entities_old)
|
101 |
+
# st.session_state["entities"] = entities_old
|
102 |
+
# if entities_old:
|
103 |
+
# col2.markdown(f"{entities_old}")
|
104 |
+
# else:
|
105 |
+
# col2.markdown(_("Please input the entities on the left."))
|
106 |
+
|
107 |
+
## pills
|
108 |
+
def update_entities():
|
109 |
+
return
|
110 |
+
ori_entities = st.session_state.get("entities", [])
|
111 |
+
entities_updated = st.session_state.get("entities_updated", ori_entities)
|
112 |
+
entities_updated = st.pills(label="entities", options=ori_entities, selection_mode="multi",
|
113 |
+
default=ori_entities, label_visibility="collapsed", on_change=update_entities)
|
114 |
+
st.session_state["entities_updated"] = entities_updated
|
115 |
+
print("=" * 10)
|
116 |
+
print(entities_updated)
|
117 |
+
print(st.session_state["entities_updated"])
|
118 |
+
print("=" * 10)
|
119 |
+
|
120 |
+
submitted = st.button(_("Submit"), key="entities_button", type="primary")
|
121 |
+
if submitted:
|
122 |
+
st.session_state["global_state_step"] = 4.0
|
123 |
+
with st.spinner(text="Retrieving related works..."):
|
124 |
+
st.session_state["related_works"], st.session_state["related_works_intact"] = backend.entities2literature_callback(background, entities_updated)
|
125 |
+
# st.session_state["related_works"] = "related works"
|
126 |
+
st.session_state["global_state_step"] = 4.5
|
127 |
+
st.session_state["related_works_expand"] = True
|
128 |
+
|
129 |
+
## Retrieved related works
|
130 |
+
st.header(_("📖 Retrieved Related Works"))
|
131 |
+
with st.expander("", expanded=st.session_state.get("related_works_expand", False)):
|
132 |
+
col1, col2 = st.columns(2, )
|
133 |
+
widget_height = get_textarea_height(st.session_state.get("related_works", ""))
|
134 |
+
related_works_title = col1.text_area(label="related_works", value=st.session_state.get("related_works", ""),
|
135 |
+
label_visibility="collapsed", height=widget_height)
|
136 |
+
if related_works_title:
|
137 |
+
col2.markdown(f"{related_works_title}")
|
138 |
+
else:
|
139 |
+
col2.markdown(_("Please input the related works on the left."))
|
140 |
+
submitted = col1.button(_("Submit"), key="related_works_button", type="primary")
|
141 |
+
if submitted:
|
142 |
+
st.session_state["global_state_step"] = 5.0
|
143 |
+
with st.spinner(text="Generating initial ideas..."):
|
144 |
+
res = backend.literature2initial_ideas_callback(background, brainstorms, st.session_state["related_works_intact"])
|
145 |
+
st.session_state["initial_ideas"] = res[0]
|
146 |
+
st.session_state["final_ideas"] = res[1]
|
147 |
+
# st.session_state["initial_ideas"] = "initial ideas"
|
148 |
+
st.session_state["global_state_step"] = 5.5
|
149 |
+
st.session_state["initial_ideas_expand"] = True
|
150 |
+
|
151 |
+
## Initial ideas
|
152 |
+
st.header(_("😼 Generated Initial Ideas"))
|
153 |
+
with st.expander("", expanded=st.session_state.get("initial_ideas_expand", False)):
|
154 |
+
col1, col2 = st.columns(2, )
|
155 |
+
widget_height = get_textarea_height(st.session_state.get("initial_ideas", ""))
|
156 |
+
initial_ideas = col1.text_area(label="initial_ideas", value=st.session_state.get("initial_ideas", ""),
|
157 |
+
label_visibility="collapsed", height=widget_height)
|
158 |
+
if initial_ideas:
|
159 |
+
col2.markdown(f"{initial_ideas}")
|
160 |
+
else:
|
161 |
+
col2.markdown(_("Please input the initial ideas on the left."))
|
162 |
+
submitted = col1.button(_("Submit"), key="initial_ideas_button", type="primary")
|
163 |
+
if submitted:
|
164 |
+
st.session_state["global_state_step"] = 6.0
|
165 |
+
with st.spinner(text="Generating final ideas..."):
|
166 |
+
st.session_state["final_ideas"] = backend.initial2final_callback(initial_ideas, st.session_state["final_ideas"])
|
167 |
+
# st.session_state["final_ideas"] = "final ideas"
|
168 |
+
st.session_state["global_state_step"] = 6.5
|
169 |
+
st.session_state["final_ideas_expand"] = True
|
170 |
+
|
171 |
+
## Final ideas
|
172 |
+
st.header(_("😸 Generated Final Ideas"))
|
173 |
+
with st.expander("", expanded=st.session_state.get("final_ideas_expand", False)):
|
174 |
+
col1, col2 = st.columns(2, )
|
175 |
+
widget_height = get_textarea_height(st.session_state.get("final_ideas", ""))
|
176 |
+
user_input = col1.text_area(label="final_ideas", value=st.session_state.get("final_ideas", ""),
|
177 |
+
label_visibility="collapsed", height=widget_height)
|
178 |
+
if user_input:
|
179 |
+
col2.markdown(f"{user_input}")
|
180 |
+
else:
|
181 |
+
col2.markdown(_("Please input the final ideas on the left."))
|
182 |
+
submitted = col1.button(_("Submit"), key="final_ideas_button", type="primary")
|
183 |
+
|
184 |
+
def step_by_step_generation(backend):
|
185 |
+
## Pipeline global state
|
186 |
+
# 1.0: Input background is in progress
|
187 |
+
# 2.0: Brainstorming is in progress
|
188 |
+
# 2.5 Brainstorming is finished
|
189 |
+
# 3.0: Extracting entities is in progress
|
190 |
+
# 3.5 Extracting entities is finished
|
191 |
+
# 4.0: Retrieving literature is in progress
|
192 |
+
# 4.5 Retrieving ideas is finished
|
193 |
+
# 5.0: Generating initial ideas is in progress
|
194 |
+
# 5.5 Generating initial ideas is finished
|
195 |
+
# 6.0: Generating final ideas is in progress
|
196 |
+
# 6.5 Generating final ideas is finished
|
197 |
+
if "global_state_step" not in st.session_state:
|
198 |
+
st.session_state["global_state_step"] = 1.0
|
199 |
+
# backend = button_interface.Backend()
|
200 |
+
generate_mainpage(backend)
|
201 |
+
generate_sidebar()
|
src/prompt/__init__.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
r"""_summary_
|
2 |
+
-*- coding: utf-8 -*-
|
3 |
+
|
4 |
+
Module : prompt
|
5 |
+
|
6 |
+
File Name : __init__.py
|
7 |
+
|
8 |
+
Description : About prompt.
|
9 |
+
for example:
|
10 |
+
```
|
11 |
+
from prompt import Prompt
|
12 |
+
|
13 |
+
prompt = Prompt(f)
|
14 |
+
```
|
15 |
+
|
16 |
+
Creation Date : 2024-11-8
|
17 |
+
|
18 |
+
Author : Frank Kang([email protected])
|
19 |
+
"""
|
20 |
+
from .data import Prompt
|
21 |
+
from .data import AssistantCreateQuery, MessageQuery
|
22 |
+
from .pool import PromptPool
|
23 |
+
|
24 |
+
__all__ = ['Prompt', 'AssistantCreateQuery', 'MessageQuery', 'PromptPool']
|
src/prompt/data.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
r"""_summary_
|
3 |
+
-*- coding: utf-8 -*-
|
4 |
+
|
5 |
+
Module : prompt.data
|
6 |
+
|
7 |
+
File Name : data.py
|
8 |
+
|
9 |
+
Description : Read prompt template
|
10 |
+
|
11 |
+
Creation Date : 2024-07-16
|
12 |
+
|
13 |
+
Author : Frank Kang([email protected])
|
14 |
+
"""
|
15 |
+
from typing_extensions import override
|
16 |
+
import xml.etree.ElementTree as ET
|
17 |
+
from xml.etree.ElementTree import Element
|
18 |
+
from omegaconf import DictConfig
|
19 |
+
import os
|
20 |
+
|
21 |
+
|
22 |
+
class Trunk(DictConfig):
|
23 |
+
def __init__(self, query_node: Element) -> None:
|
24 |
+
super(Trunk, self).__init__(content={})
|
25 |
+
for node in query_node:
|
26 |
+
self[node.tag] = node.text
|
27 |
+
|
28 |
+
|
29 |
+
class Query():
|
30 |
+
def __init__(self, query_node: Element) -> None:
|
31 |
+
super(Query, self).__init__()
|
32 |
+
self.rank = int(query_node.get('rank'))
|
33 |
+
self.title = query_node.find('title').text
|
34 |
+
self.text = query_node.find('text').text
|
35 |
+
data = query_node.find('data')
|
36 |
+
self.data = None
|
37 |
+
|
38 |
+
if data is not None:
|
39 |
+
self.data = [Trunk(trunk) for trunk in data.findall('trunk')]
|
40 |
+
if len(self.data) == 0:
|
41 |
+
self.data = None
|
42 |
+
|
43 |
+
@staticmethod
|
44 |
+
def Get_Title(query_node: Element) -> str:
|
45 |
+
return query_node.find('title').text
|
46 |
+
|
47 |
+
|
48 |
+
class AssistantCreateQuery(Query):
|
49 |
+
TITLE = 'System Message'
|
50 |
+
|
51 |
+
def __init__(self, query_node: Element) -> None:
|
52 |
+
super(AssistantCreateQuery, self).__init__(query_node)
|
53 |
+
|
54 |
+
def __call__(self, *args,
|
55 |
+
name=None,
|
56 |
+
tools=[{"type": "code_interpreter"}],
|
57 |
+
model="gpt-4-1106-preview",
|
58 |
+
**kwds) -> dict:
|
59 |
+
"""Get parameters used for client.beta.assistants.create
|
60 |
+
|
61 |
+
Returns:
|
62 |
+
dict: parameters used for client.beta.assistants.create
|
63 |
+
"""
|
64 |
+
return {'role': 'system', 'content': self.text.format(*args, **kwds)} if name is None else {'name': name, 'instructions': self.text.format(*args, **kwds), 'tools': tools, 'model': model}
|
65 |
+
|
66 |
+
|
67 |
+
class MessageQuery(Query):
|
68 |
+
TITLE = 'User Message'
|
69 |
+
|
70 |
+
def __init__(self, query_node: Element) -> None:
|
71 |
+
super(MessageQuery, self).__init__(query_node)
|
72 |
+
|
73 |
+
def __call__(self, *args, **kwds) -> dict:
|
74 |
+
"""Using like str.format
|
75 |
+
|
76 |
+
Returns:
|
77 |
+
dict: _description_
|
78 |
+
"""
|
79 |
+
return {'role': 'user', 'content': self.text.format(*args, **kwds)}
|
80 |
+
|
81 |
+
|
82 |
+
class Prompt(object):
|
83 |
+
def __init__(self, path) -> None:
|
84 |
+
"""Init Prompy by xml file
|
85 |
+
|
86 |
+
Args:
|
87 |
+
path (_type_): _description_
|
88 |
+
"""
|
89 |
+
super(Prompt, self).__init__()
|
90 |
+
self.path = path
|
91 |
+
tree = ET.parse(path)
|
92 |
+
body = tree.getroot()
|
93 |
+
self.queries = {}
|
94 |
+
self.name = '.'.join(os.path.basename(path).split('.')[:-1])
|
95 |
+
for query in body.findall('query'):
|
96 |
+
self.__read_query__(query)
|
97 |
+
|
98 |
+
def __read_query__(self, query_node: Element):
|
99 |
+
title = Query.Get_Title(query_node)
|
100 |
+
query: Query
|
101 |
+
if title == AssistantCreateQuery.TITLE:
|
102 |
+
query = AssistantCreateQuery(query_node)
|
103 |
+
elif title == MessageQuery.TITLE:
|
104 |
+
query = MessageQuery(query_node)
|
105 |
+
else:
|
106 |
+
raise TypeError('Title not supported!')
|
107 |
+
|
108 |
+
if query.rank not in self.queries:
|
109 |
+
self.queries[query.rank] = [query]
|
110 |
+
else:
|
111 |
+
self.queries[query.rank].append(query)
|
112 |
+
|
113 |
+
def __getitem__(self, rank):
|
114 |
+
return self.queries[rank]
|
115 |
+
|
116 |
+
@override
|
117 |
+
def __repr__(self) -> str:
|
118 |
+
return self.name
|
119 |
+
# def __call__(self, *args: ET.Any, **kwds: ET.Any) -> list:
|
src/prompt/pool.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
r"""_summary_
|
2 |
+
-*- coding: utf-8 -*-
|
3 |
+
|
4 |
+
Module : prompt.pool
|
5 |
+
|
6 |
+
File Name : pool.py
|
7 |
+
|
8 |
+
Description : make prompt pool
|
9 |
+
|
10 |
+
Creation Date : 2024-11-08
|
11 |
+
|
12 |
+
Author : Frank Kang([email protected])
|
13 |
+
"""
|
14 |
+
import pathlib
|
15 |
+
import os
|
16 |
+
from utils.base_company import BaseCompany
|
17 |
+
from typing_extensions import Literal, override
|
18 |
+
from typing import Union, Any, IO
|
19 |
+
from .data import Prompt
|
20 |
+
from utils.path_pool import PROMPT_DIR
|
21 |
+
from glob import glob
|
22 |
+
|
23 |
+
|
24 |
+
class PromptPool(BaseCompany):
|
25 |
+
"""_summary_
|
26 |
+
|
27 |
+
Args:
|
28 |
+
BaseCompany (_type_): _description_
|
29 |
+
"""
|
30 |
+
|
31 |
+
def __init__(self):
|
32 |
+
super(PromptPool, self).__init__()
|
33 |
+
for p in glob(os.path.join(PROMPT_DIR, '*.xml')):
|
34 |
+
key = os.path.basename(p)[:-len('.xml')]
|
35 |
+
prompt = Prompt(p)
|
36 |
+
self.register(key, prompt)
|
37 |
+
|
38 |
+
@override
|
39 |
+
def __repr__(self) -> str:
|
40 |
+
return "PromptPool"
|
41 |
+
|
42 |
+
@staticmethod
|
43 |
+
def add_prompt(file_: Union[str, pathlib.Path, IO[Any]], key: str | None = None):
|
44 |
+
fname = ''
|
45 |
+
if isinstance(file_, str):
|
46 |
+
fname = file_
|
47 |
+
if not os.path.exists(fname):
|
48 |
+
raise FileNotFoundError(
|
49 |
+
'cannot find file {}'.format(fname))
|
50 |
+
else:
|
51 |
+
fname = file_.name
|
52 |
+
|
53 |
+
key = os.path.basename(fname)[:-len('.xml')]
|
54 |
+
prompt = Prompt(fname)
|
55 |
+
PromptPool.get().register(key, prompt)
|
src/prompt/utils.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
r"""_summary_
|
2 |
+
-*- coding: utf-8 -*-
|
3 |
+
|
4 |
+
Module : prompt.utils
|
5 |
+
|
6 |
+
File Name : utils.py
|
7 |
+
|
8 |
+
Description : prompt utils
|
9 |
+
|
10 |
+
Creation Date : 2024-11-09
|
11 |
+
|
12 |
+
Author : Frank Kang([email protected])
|
13 |
+
"""
|
14 |
+
import sys
|
15 |
+
from .pool import PromptPool, Prompt
|
16 |
+
|
17 |
+
|
18 |
+
def get_prompt() -> Prompt:
|
19 |
+
key = sys._getframe(1).f_code.co_name
|
20 |
+
pool = PromptPool.get()
|
21 |
+
if key not in pool.entities:
|
22 |
+
raise FileNotFoundError('could not find prompt file by function name {}'.format(key))
|
23 |
+
else:
|
24 |
+
return pool[key]
|
src/utils/api/base_helper.py
CHANGED
@@ -17,7 +17,6 @@ from abc import ABCMeta
|
|
17 |
from typing_extensions import Literal, override
|
18 |
from ..base_company import BaseCompany
|
19 |
from typing import Union
|
20 |
-
from typing_extensions import Literal, override
|
21 |
|
22 |
|
23 |
class NotGiven:
|
|
|
17 |
from typing_extensions import Literal, override
|
18 |
from ..base_company import BaseCompany
|
19 |
from typing import Union
|
|
|
20 |
|
21 |
|
22 |
class NotGiven:
|
src/utils/base_company.py
CHANGED
@@ -39,7 +39,7 @@ class BaseCompany(object):
|
|
39 |
if cls._instance is None:
|
40 |
cls._instance = super(BaseCompany, cls).__new__(
|
41 |
cls, *args, **kwargs)
|
42 |
-
cls._instance.
|
43 |
return cls._instance
|
44 |
|
45 |
def __init__(self):
|
@@ -52,8 +52,8 @@ class BaseCompany(object):
|
|
52 |
"""
|
53 |
self.entities = {}
|
54 |
|
55 |
-
@
|
56 |
-
def get():
|
57 |
"""_summary_
|
58 |
|
59 |
Method for obtaining singleton classes
|
@@ -66,10 +66,10 @@ class BaseCompany(object):
|
|
66 |
|
67 |
Returns:
|
68 |
BaseCompany: singleton
|
69 |
-
"""
|
70 |
-
if
|
71 |
-
|
72 |
-
return
|
73 |
|
74 |
def register(self, entity_name: str, entity: Any) -> bool:
|
75 |
"""_summary_
|
|
|
39 |
if cls._instance is None:
|
40 |
cls._instance = super(BaseCompany, cls).__new__(
|
41 |
cls, *args, **kwargs)
|
42 |
+
cls._instance.__init__()
|
43 |
return cls._instance
|
44 |
|
45 |
def __init__(self):
|
|
|
52 |
"""
|
53 |
self.entities = {}
|
54 |
|
55 |
+
@classmethod
|
56 |
+
def get(cls, *args, **kwargs):
|
57 |
"""_summary_
|
58 |
|
59 |
Method for obtaining singleton classes
|
|
|
66 |
|
67 |
Returns:
|
68 |
BaseCompany: singleton
|
69 |
+
"""
|
70 |
+
if cls._instance is None:
|
71 |
+
cls.__new__(cls, *args, **kwargs)
|
72 |
+
return cls._instance
|
73 |
|
74 |
def register(self, entity_name: str, entity: Any) -> bool:
|
75 |
"""_summary_
|
src/utils/header.py
CHANGED
@@ -13,8 +13,14 @@ Author : Frank Kang([email protected])
|
|
13 |
"""
|
14 |
from config.utils import get_dir
|
15 |
from config import ConfigReader
|
16 |
-
from prompt
|
|
|
17 |
|
18 |
__all__ = [
|
19 |
-
"get_dir",
|
|
|
|
|
|
|
|
|
|
|
20 |
]
|
|
|
13 |
"""
|
14 |
from config.utils import get_dir
|
15 |
from config import ConfigReader
|
16 |
+
from prompt import Prompt, AssistantCreateQuery, MessageQuery
|
17 |
+
from prompt.utils import get_prompt
|
18 |
|
19 |
__all__ = [
|
20 |
+
"get_dir",
|
21 |
+
"ConfigReader",
|
22 |
+
"Prompt",
|
23 |
+
"AssistantCreateQuery",
|
24 |
+
"MessageQuery",
|
25 |
+
"get_prompt"
|
26 |
]
|
src/utils/llms_api.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from .api import HelperCompany
|
2 |
import re
|
3 |
import os
|
4 |
-
from .header import get_dir, Prompt, ConfigReader
|
5 |
import traceback
|
6 |
import openai
|
7 |
|
@@ -27,6 +27,16 @@ def clean_entities(input_string):
|
|
27 |
return cleaned
|
28 |
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
class APIHelper(object):
|
31 |
|
32 |
def __init__(self, config) -> None:
|
@@ -88,72 +98,21 @@ class APIHelper(object):
|
|
88 |
return result
|
89 |
|
90 |
def generate_entity_list(self, abstract: str, max_num: int = 5) -> list:
|
91 |
-
|
92 |
-
{
|
93 |
-
"content": "This paper presents a novel approach to automatic captioning of geo-tagged images by summarizing multiple webdocuments that contain information related to an image's location. The summarizer is biased by dependency pattern models towards sentences which contain features typically provided for different scene types such as those of churches, bridges, etc. Our results show that summaries biased by dependency pattern models lead to significantly higher ROUGE scores than both n-gram language models reported in previous work and also Wikipedia baseline summaries. Summaries generated using dependency patterns also lead to more readable summaries than those generated without dependency patterns.",
|
94 |
-
"entities": "dependency pattern models, automatic captioning",
|
95 |
-
},
|
96 |
-
{
|
97 |
-
"content": "In this paper, we describe the 2015 iteration of the SemEval shared task on Sentiment Analysis in Twitter. This was the most popular sentiment analysis shared task to date with more than 40 teams participating in each of the last three years. This year's shared task competition consisted of five sentiment prediction subtasks. Two were reruns from previous years: (A) sentiment expressed by a phrase in the context of a tweet, and (B) overall sentiment of a tweet. We further included three new subtasks asking to predict (C) the sentiment towards a topic in a single tweet, (D) the overall sentiment towards a topic in a set of tweets, and (E) the degree of prior polarity of a phrase.",
|
98 |
-
"entities": "sentiment analysis, shared task",
|
99 |
-
},
|
100 |
-
{
|
101 |
-
"content": 'This paper presents two different tools which may be used as a support of speech recognition. The tool "transc" is the first one and it generates the phonetic transcription (pronunciation) of given utterance. It is based mainly on fixed rules which can be defined for Czech pronunciation but it can work also with specified list of exceptions which is defined on lexicon basis. It allows the usage of "transc" for unknown text with high probability of correct phonetic transcription generation. The second part is devoted to lexicon management tool "lexedit" which may be useful in the phase of generation of pronunciation lexicon for collected corpora. The presented tool allows editing of pronunciation, playing examples of pronunciation, comparison with reference lexicon, updating of reference lexicon, etc.',
|
102 |
-
"entities": "speech recognition, phonetic transcription, lexicon management",
|
103 |
-
},
|
104 |
-
{
|
105 |
-
"content": "Previous research applying kernel methods to natural language parsing have focussed on proposing kernels over parse trees, which are hand-crafted based on domain knowledge and computational considerations. In this paper we propose a method for defining kernels in terms of a probabilistic model of parsing. This model is then trained, so that the parameters of the probabilistic model reflect the generalizations in the training data. The method we propose then uses these trained parameters to define a kernel for reranking parse trees. In experiments, we use a neural network based statistical parser as the probabilistic model, and use the resulting kernel with the Voted Perceptron algorithm to rerank the top 20 parses from the probabilistic model. This method achieves a significant improvement over the accuracy of the probabilistic model.",
|
106 |
-
"entities": "parse trees, probabilistic model, natural language parsing",
|
107 |
-
},
|
108 |
-
]
|
109 |
-
|
110 |
-
few_shot_examples = []
|
111 |
-
for example in common_examples:
|
112 |
-
few_shot_examples.append(example)
|
113 |
-
|
114 |
-
prompt_template_entity = """
|
115 |
-
### Task Description:
|
116 |
-
You are an AI researcher tasked with extracting the key entities from a given research paper content. These entities should represent the most important keywords or phrases that summarize the main topics or concepts discussed in the content.
|
117 |
-
|
118 |
-
### Information Provided:
|
119 |
-
**Content**: Focus on this content, and extract entities that serve as concrete manifestations of the main themes and topics within it.
|
120 |
-
|
121 |
-
### Approach:
|
122 |
-
Your entity extraction should be systematic:
|
123 |
-
- **Step 1**: Carefully read through the content to fully understand its main themes and topics.
|
124 |
-
- **Step 2**: Identify and list key entities central to the content, ensuring each entity is relevant, meaningful, and accurately represents the content.
|
125 |
-
|
126 |
-
### Entity Guidelines:
|
127 |
-
- Each entity should be no longer than 5 words and contain at least 2 words.
|
128 |
-
- The entities should be nouns or noun phrases.
|
129 |
-
- The total number of entities should be less than or equal to {max_num}.
|
130 |
-
|
131 |
-
### Examples:
|
132 |
-
{examples}
|
133 |
-
|
134 |
-
### Specific information:
|
135 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
136 |
-
**Content**: {content}
|
137 |
-
|
138 |
-
### Format for Your Response:
|
139 |
-
Please just give me the entities and spilt them by ",":
|
140 |
-
<entity 1>,<entity2>,...
|
141 |
-
"""
|
142 |
|
143 |
if abstract is None:
|
144 |
return None
|
145 |
try:
|
146 |
examples_str = "\n".join(
|
147 |
f"[content]: {example['content']}\n[entity]: {example['entities']}\n###\n"
|
148 |
-
for example in
|
149 |
-
)
|
150 |
-
system_input = "Now you are an expert in extracting key entities from research contents. You are good at identifying the most important keywords or phrases that summarize the main topics or concepts discussed in the content."
|
151 |
-
message = []
|
152 |
-
message.append({"role": "system", "content": system_input})
|
153 |
-
message_input = prompt_template_entity.format(
|
154 |
-
examples=examples_str, content=abstract, max_num=str(max_num)
|
155 |
)
|
156 |
-
message
|
|
|
|
|
|
|
|
|
|
|
157 |
response = self.generator.create(
|
158 |
messages=message,
|
159 |
)
|
@@ -180,37 +139,14 @@ class APIHelper(object):
|
|
180 |
return clean_entity_list
|
181 |
|
182 |
def generate_brainstorm(self, background: str) -> str:
|
183 |
-
|
184 |
-
### Task Description:
|
185 |
-
You are an AI researcher tasked with brainstorming initial, innovative ideas to address a given research problem in AI. Focus on generating diverse and creative approaches rather than finalized methods. The ideas can be rough and in their infancy but should cover a range of possible directions that could be explored further.
|
186 |
-
|
187 |
-
### Information Provided:
|
188 |
-
- **Research Background**: {background}
|
189 |
-
|
190 |
-
### Approach:
|
191 |
-
Your brainstorming should be systematic:
|
192 |
-
- **Step 1**: Thoroughly understand the research background.
|
193 |
-
- **Step 2**: Generate a list of 4 to 6 high-level ideas or directions that could potentially solve problems in the given background. Be creative, think outside the box, and avoid merely rephrasing existing methods.
|
194 |
-
|
195 |
-
### Format for Your Response:
|
196 |
-
Please present 4 to 6 ideas in the following format:
|
197 |
-
**Idea 1**: [Brief description of the first idea]
|
198 |
-
**Idea 2**: [Brief description of the second idea]
|
199 |
-
...
|
200 |
-
"""
|
201 |
|
202 |
if background is None:
|
203 |
print("Input background is empty ...")
|
204 |
return None
|
205 |
try:
|
206 |
# Initial brainstorming to generate raw ideas
|
207 |
-
|
208 |
-
background=background
|
209 |
-
)
|
210 |
-
message = []
|
211 |
-
prompt_first = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at generating creative and original ideas."
|
212 |
-
message.append({"role": "system", "content": prompt_first})
|
213 |
-
message.append({"role": "user", "content": brainstorming_prompt})
|
214 |
# Call the API to generate brainstorming ideas
|
215 |
response_brainstorming = self.generator.create(
|
216 |
messages=message,
|
@@ -224,50 +160,21 @@ class APIHelper(object):
|
|
224 |
return brainstorming_ideas
|
225 |
|
226 |
def generate_problem(self, background: str, related_papers: list[dict]):
|
227 |
-
|
228 |
-
### Task Description:
|
229 |
-
You will receive a research background along with summaries, backgrounds, and contributions (methods) of several related papers. Your task is to carefully analyze this information and propose a research problem that is original, clear, feasible, relevant, and significant to its field. Additionally, provide the rationales behind the proposed problem.
|
230 |
-
|
231 |
-
### Information Provided:
|
232 |
-
1. **Research Background**: This is your primary focus. The research problem you propose should be a direct reflection of this background.
|
233 |
-
2. **Related Papers**: These papers offer studies directly related to the primary research topic, providing additional insights and knowledge that will inform your proposed problem.
|
234 |
-
|
235 |
-
### Approach:
|
236 |
-
Your approach should be systematic:
|
237 |
-
- **Step 1**: Begin by thoroughly understanding the core focus of the research background.
|
238 |
-
- **Step 2**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain broader insights into the primary research topic.
|
239 |
-
- **Step 3**: Based on the provided information, propose a research problem that meets the criteria of being original, clear, feasible, relevant, and significant. Support your problem statement with clear rationales.
|
240 |
-
|
241 |
-
### Specific information:
|
242 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
243 |
-
1. **Research Background**: {background}
|
244 |
-
2. **Related Papers**: {related_papers_information}
|
245 |
-
|
246 |
-
### Format for Your Response:
|
247 |
-
**Research Problem**: [your problem]
|
248 |
-
- **Rationales**: [the rationale behind your problem]
|
249 |
-
"""
|
250 |
if background is None or related_papers is None:
|
251 |
return None
|
252 |
try:
|
253 |
-
related_papers_information = ""
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
related_papers_information += (
|
261 |
-
"\nContributions: " + paper["contribution"] + "\n \n"
|
262 |
-
)
|
263 |
-
message = []
|
264 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at proposing novel and valuable questions based on research background."
|
265 |
-
message.append({"role": "system", "content": system_input})
|
266 |
-
message_input = prompt_template_problem.format(
|
267 |
background=background,
|
268 |
related_papers_information=related_papers_information,
|
269 |
)
|
270 |
-
message
|
271 |
response = self.generator.create(
|
272 |
messages=message,
|
273 |
)
|
@@ -280,54 +187,23 @@ class APIHelper(object):
|
|
280 |
def generate_problem_with_cue_words(
|
281 |
self, background: str, related_papers: list[dict], cue_words: list
|
282 |
):
|
283 |
-
|
284 |
-
|
285 |
-
You will receive a research background and some cue words along with summaries, backgrounds, and contributions (methods) of several related papers. Your task is to carefully analyze this information and propose a research problem that is original, clear, feasible, relevant, and significant to its field. Additionally, provide the rationales behind the proposed problem.
|
286 |
-
|
287 |
-
### Information Provided:
|
288 |
-
1. **Research Background**: This is your primary focus. The research problem you propose should be a direct reflection of this background.
|
289 |
-
2. **Cue Words**: Some of these words can provide direction and ideas for you to ask questions. They should be the focus of your attention.
|
290 |
-
3. **Related Papers**: These papers offer studies directly related to the primary research topic, providing additional insights and knowledge that will inform your proposed problem.
|
291 |
-
|
292 |
-
### Approach:
|
293 |
-
Your approach should be systematic:
|
294 |
-
- **Step 1**: Begin by thoroughly understanding the core focus of the research background.
|
295 |
-
- **Step 2**: Read the cue words and then determine the approximate direction of your problem.
|
296 |
-
- **Step 3**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain broader insights into the primary research topic.
|
297 |
-
- **Step 4**: Based on the provided information, propose a research problem that meets the criteria of being original, clear, feasible, relevant, and significant. Support your problem statement with clear rationales.
|
298 |
-
|
299 |
-
### Specific information:
|
300 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
301 |
-
1. **Research Background**: {background}
|
302 |
-
2. **Cue Words**: {cue_words}
|
303 |
-
3. **Related Papers**: {related_papers_information}
|
304 |
-
|
305 |
-
### Format for Your Response:
|
306 |
-
**Research Problem**: [your problem]
|
307 |
-
- **Rationales**: [the rationale behind your problem]
|
308 |
-
"""
|
309 |
if background is None or related_papers is None or cue_words is None:
|
310 |
return None
|
311 |
try:
|
312 |
-
related_papers_information = ""
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
related_papers_information += (
|
320 |
-
"\nContributions: " + paper["contribution"] + "\n \n"
|
321 |
-
)
|
322 |
-
message = []
|
323 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at proposing novel and valuable questions based on research background."
|
324 |
-
message.append({"role": "system", "content": system_input})
|
325 |
-
message_input = prompt_template_problem.format(
|
326 |
background=background,
|
327 |
related_papers_information=related_papers_information,
|
328 |
cue_words=cue_words,
|
329 |
)
|
330 |
-
message
|
331 |
response = self.generator.create(
|
332 |
messages=message,
|
333 |
)
|
@@ -338,47 +214,17 @@ class APIHelper(object):
|
|
338 |
return problem, message_input
|
339 |
|
340 |
def generate_inspiration(self, problem: str, related_paper: dict):
|
341 |
-
|
342 |
-
### Task Description:
|
343 |
-
You will be provided with a research problem, as well as the summary, backgrounds and contributions (methods) of a related paper. Your task is to extract a novel, effective, and specific inspiration from the related paper that can help addressing the research problem, and provide a brief rationale for this inspiration.
|
344 |
-
|
345 |
-
### Information Provided:
|
346 |
-
1. **Research problem**: The key issues or aspects of the problem that need to be addressed. These will serve as the foundation for generating your inspiration.
|
347 |
-
2. **Related paper**: Draw insights from the abstract, background, and methods of the related paper. Delve deeply into these methods, understand the motivations behind them, and critically assess how they might contribute to solving the research problem. Avoid merely replicating the methods; instead, synthesize relevant aspects with your own insights to derive a novel inspiration.
|
348 |
-
|
349 |
-
### Approach:
|
350 |
-
Your approach should be systematic:
|
351 |
-
- **Step 1**: Thoroughly read the research problem to clearly understand the primary focus.
|
352 |
-
- **Step 2**: Review the summary, background, and contributions (methods) of the related paper. Evaluate whether the methods proposed in the paper can provide solutions or insights relevant to the research problem.
|
353 |
-
- **Step 3**: Based on the information provided in the paper and your own analysis, propose a novel, effective, and specific inspiration. Include a rationale explaining how this inspiration helps addressing the research problem.
|
354 |
-
|
355 |
-
### Specific Information:
|
356 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
357 |
-
1. **Research problem**: {problem}
|
358 |
-
2. **Related paper**: {related_paper_information}
|
359 |
-
|
360 |
-
### Format for Your Response:
|
361 |
-
Your output should be around 200 words and follow the format:
|
362 |
-
**Inspiration**: [Your novel, effective, and specific idea derived from the related paper]
|
363 |
-
- **Rationale**: [The brief reasoning behind how this inspiration help addressing the research problem]
|
364 |
-
"""
|
365 |
if problem is None or related_paper is None:
|
366 |
return None
|
367 |
try:
|
368 |
-
related_paper_information =
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
message = []
|
376 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at extracting novel and valuable inspirations from papers."
|
377 |
-
message.append({"role": "system", "content": system_input})
|
378 |
-
message_input = prompt_inspiration.format(
|
379 |
-
problem=problem, related_paper_information=related_paper_information
|
380 |
-
)
|
381 |
-
message.append({"role": "user", "content": message_input})
|
382 |
response = self.generator.create(
|
383 |
messages=message,
|
384 |
)
|
@@ -391,52 +237,20 @@ class APIHelper(object):
|
|
391 |
def generate_inspiration_with_cue_words(
|
392 |
self, problem: str, related_paper: dict, cue_words: list
|
393 |
):
|
394 |
-
|
395 |
-
|
396 |
-
You will be provided with a research problem, some cue words as well as the summary, backgrounds and contributions (methods) of a related paper. Your task is to extract a novel, effective, and specific inspiration from the related paper that can help addressing the research problem, and provide a brief rationale for this inspiration.
|
397 |
-
|
398 |
-
### Information Provided:
|
399 |
-
1. **Research problem**: The key issues or aspects of the problem that need to be addressed. These will serve as the foundation for generating your inspiration.
|
400 |
-
2. **Cue Words**: Some of these words can provide direction for you to extract inspiration. They should be the focus of your attention.
|
401 |
-
3. **Related paper**: Draw insights from the abstract, background, and methods of the related paper. Delve deeply into these methods, understand the motivations behind them, and critically assess how they might contribute to solving the research problem. Avoid merely replicating the methods; instead, synthesize relevant aspects with your own insights to derive a novel inspiration.
|
402 |
-
|
403 |
-
### Approach:
|
404 |
-
Your approach should be systematic:
|
405 |
-
- **Step 1**: Thoroughly read the research problem to clearly understand the primary focus.
|
406 |
-
- **Step 2**: Review the summary, background, and contributions (methods) of the related paper. Evaluate whether the methods proposed in the paper can provide solutions or insights relevant to the research problem.
|
407 |
-
- **Step 3**: Read the cue words and consider whether these words can be combined with information of the related paper to help providing inspiration.
|
408 |
-
- **Step 4**: Based on the information provided in the paper and your own analysis, propose a novel, effective, and specific inspiration. Include a rationale explaining how this inspiration helps addressing the research problem.
|
409 |
-
|
410 |
-
### Specific Information:
|
411 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
412 |
-
1. **Research problem**: {problem}
|
413 |
-
2. **Cue Words**: {cue_words}
|
414 |
-
3. **Related paper**: {related_paper_information}
|
415 |
-
|
416 |
-
### Format for Your Response:
|
417 |
-
Your output should be around 200 words and follow the format:
|
418 |
-
**Inspiration**: [Your novel, effective, and specific idea derived from the related paper]
|
419 |
-
- **Rationale**: [The brief reasoning behind how this inspiration help addressing the research problem]
|
420 |
-
"""
|
421 |
if problem is None or related_paper is None or cue_words is None:
|
422 |
return None
|
423 |
try:
|
424 |
-
related_paper_information =
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
message.append({"role": "system", "content": system_input})
|
434 |
-
message_input = prompt_inspiration.format(
|
435 |
-
problem=problem,
|
436 |
-
related_paper_information=related_paper_information,
|
437 |
-
cue_words=cue_words,
|
438 |
-
)
|
439 |
-
message.append({"role": "user", "content": message_input})
|
440 |
response = self.generator.create(
|
441 |
messages=message,
|
442 |
)
|
@@ -447,52 +261,24 @@ class APIHelper(object):
|
|
447 |
return inspiration
|
448 |
|
449 |
def generate_idea(self, problem: str, related_papers: list[dict]) -> str:
|
450 |
-
|
451 |
-
|
452 |
-
You will be provided with a research problem along with its rationales. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem. Additionally, some cue words along with summaries, backgrounds, and contributions (methods) of related papers will be provided as sources of inspiration for generating novel ideas.
|
453 |
-
|
454 |
-
### Information Provided:
|
455 |
-
1. **Research Problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
456 |
-
2. **Related Papers**: Draw inspiration from the abstracts, backgrounds, and methods of these papers. Delve deeply into these methods, understand the motivations behind them, and think critically about how they might inform your approach. Avoid merely stacking existing methods; instead, integrate relevant aspects with your own insights to create original solutions.
|
457 |
-
|
458 |
-
### Approach:
|
459 |
-
Your approach should be systematic:
|
460 |
-
- **Step 1**: Thoroughly read the research problem to understand your primary focus.
|
461 |
-
- **Step 2**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain a broader perspective and insights relevant to the problem.
|
462 |
-
- **Step 3**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
463 |
-
|
464 |
-
### Specific Information:
|
465 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
466 |
-
1. **Research Problem & Rationales**: {problem}
|
467 |
-
2. **Related Papers**: {related_papers_information}
|
468 |
-
|
469 |
-
### Format for Your Response:
|
470 |
-
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
471 |
-
**Idea 1**: [The first method idea]
|
472 |
-
**Idea 2**: [The second method idea]
|
473 |
-
**Idea 3**: [The third method idea]
|
474 |
-
...
|
475 |
-
"""
|
476 |
if problem is None or related_papers is None:
|
477 |
return None
|
478 |
try:
|
479 |
-
related_papers_information = ""
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
related_papers_information += "\nSummary: " + dict["summary"]
|
485 |
-
related_papers_information += "\nBackgrounds: " + dict["motivation"]
|
486 |
-
related_papers_information += (
|
487 |
-
"\nContributions: " + dict["contribution"] + "\n \n"
|
488 |
-
)
|
489 |
-
message = []
|
490 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI."
|
491 |
-
message.append({"role": "system", "content": system_input})
|
492 |
-
message_input = prompt_template_idea.format(
|
493 |
-
problem=problem, related_papers_information=related_papers_information
|
494 |
)
|
495 |
-
message
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
response = self.generator.create(
|
497 |
messages=message,
|
498 |
)
|
@@ -505,57 +291,26 @@ class APIHelper(object):
|
|
505 |
def generate_idea_with_cue_words(
|
506 |
self, problem: str, related_papers: list[dict], cue_words: list
|
507 |
) -> str:
|
508 |
-
|
509 |
-
|
510 |
-
You will be provided with a research problem along with its rationales. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem. Additionally, some cue words along with summaries, backgrounds, and contributions (methods) of related papers will be provided as sources of inspiration for generating novel ideas.
|
511 |
-
|
512 |
-
### Information Provided:
|
513 |
-
1. **Research Problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
514 |
-
2. **Cue Words**: Some of these words can inspire or provide direction for you to generate ideas. You can try to think deeply in these directions and perspectives.
|
515 |
-
3. **Related Papers**: Draw inspiration from the abstracts, backgrounds, and methods of these papers. Delve deeply into these methods, understand the motivations behind them, and think critically about how they might inform your approach. Avoid merely stacking existing methods; instead, integrate relevant aspects with your own insights to create original solutions.
|
516 |
-
|
517 |
-
### Approach:
|
518 |
-
Your approach should be systematic:
|
519 |
-
- **Step 1**: Thoroughly read the research problem to understand your primary focus.
|
520 |
-
- **Step 2**: Read the cue words and think about whether these words can inspire or provide direction for you to come up with ideas.
|
521 |
-
- **Step 3**: Review the summaries, backgrounds, and contributions (methods) of the related papers to gain a broader perspective and insights relevant to the problem.
|
522 |
-
- **Step 4**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
523 |
-
|
524 |
-
### Specific Information:
|
525 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
526 |
-
1. **Research Problem & Rationales**: {problem}
|
527 |
-
2. **Cue Words**: {cue_words}
|
528 |
-
3. **Related Papers**: {related_papers_information}
|
529 |
-
|
530 |
-
### Format for Your Response:
|
531 |
-
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
532 |
-
**Idea 1**: [The first method idea]
|
533 |
-
**Idea 2**: [The second method idea]
|
534 |
-
**Idea 3**: [The third method idea]
|
535 |
-
...
|
536 |
-
"""
|
537 |
if problem is None or related_papers is None or cue_words is None:
|
538 |
return None
|
539 |
try:
|
540 |
-
related_papers_information = ""
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
related_papers_information += "\nSummary: " + dict["summary"]
|
546 |
-
related_papers_information += "\nBackgrounds: " + dict["motivation"]
|
547 |
-
related_papers_information += (
|
548 |
-
"\nContributions: " + dict["contribution"] + "\n \n"
|
549 |
-
)
|
550 |
-
message = []
|
551 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI."
|
552 |
-
message.append({"role": "system", "content": system_input})
|
553 |
-
message_input = prompt_template_idea.format(
|
554 |
-
problem=problem,
|
555 |
-
related_papers_information=related_papers_information,
|
556 |
-
cue_words=cue_words,
|
557 |
)
|
558 |
-
message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
response = self.generator.create(
|
560 |
messages=message,
|
561 |
)
|
@@ -566,47 +321,22 @@ class APIHelper(object):
|
|
566 |
return idea
|
567 |
|
568 |
def generate_idea_by_inspiration(self, problem: str, inspirations: list[str]):
|
569 |
-
|
570 |
-
|
571 |
-
You will be provided with a research problem and its rationales, along with inspirations and their rationales extracted from related papers. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem.
|
572 |
-
|
573 |
-
### Information Provided:
|
574 |
-
1. **Research problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
575 |
-
2. **Inspirations**: Insights and ideas extracted from related papers that may provide valuable perspectives or techniques applicable to the research problem.
|
576 |
-
|
577 |
-
### Approach:
|
578 |
-
Your approach should be systematic:
|
579 |
-
- **Step 1**: Thoroughly read and understand the research problem to identify your primary focus.
|
580 |
-
- **Step 2**: Review the inspirations extracted from the related papers to gain a broader perspective and insights relevant to the research topic.
|
581 |
-
- **Step 3**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
582 |
-
|
583 |
-
### Specific Information:
|
584 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
585 |
-
1. **Research problem & Rationales**: {problem}
|
586 |
-
2. **Inspirations**: {inspirations_text}
|
587 |
-
|
588 |
-
### Format for Your Response:
|
589 |
-
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
590 |
-
**Idea 1**: [The first method idea]
|
591 |
-
**Idea 2**: [The second method idea]
|
592 |
-
**Idea 3**: [The third method idea]
|
593 |
-
...
|
594 |
-
"""
|
595 |
if problem is None or inspirations is None:
|
596 |
return None
|
597 |
try:
|
598 |
-
inspirations_text = ""
|
599 |
-
|
600 |
-
inspirations_text += (
|
601 |
"Inspiration {i}: ".format(i=i + 1) + "\n" + inspiration + "\n \n"
|
602 |
-
|
603 |
-
|
604 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI."
|
605 |
-
message.append({"role": "system", "content": system_input})
|
606 |
-
message_input = prompt_template_idea.format(
|
607 |
-
problem=problem, inspirations_text=inspirations_text
|
608 |
)
|
609 |
-
|
|
|
|
|
|
|
|
|
610 |
response = self.generator.create(
|
611 |
messages=message,
|
612 |
)
|
@@ -619,52 +349,26 @@ class APIHelper(object):
|
|
619 |
def generate_idea_by_inspiration_with_cue_words(
|
620 |
self, problem: str, inspirations: list[str], cue_words: list
|
621 |
):
|
622 |
-
|
623 |
-
|
624 |
-
You will be provided with a research problem, its rationales and some cue words, along with inspirations and their rationales extracted from related papers. Your task is to brainstorm some ideas that are clear, innovative, valid, and comprehensive to address the problem.
|
625 |
-
|
626 |
-
### Information Provided:
|
627 |
-
1. **Research problem & Rationales**: The key issues or aspects of the problem that need to be addressed. These will form the foundation for generating your ideas.
|
628 |
-
2. **Cue Words**: Some of these words can inspire or provide direction for you to generate ideas. You can try to think deeply in these directions and perspectives.
|
629 |
-
3. **Inspirations**: Insights and ideas extracted from related papers that may provide valuable perspectives or techniques applicable to the research problem.
|
630 |
-
|
631 |
-
### Approach:
|
632 |
-
Your approach should be systematic:
|
633 |
-
- **Step 1**: Thoroughly read and understand the research problem to identify your primary focus.
|
634 |
-
- **Step 2**: Read the cue words and think about whether these words can inspire or provide direction for you to come up with ideas.
|
635 |
-
- **Step 3**: Review the inspirations extracted from the related papers to gain a broader perspective and insights relevant to the research topic.
|
636 |
-
- **Step 4**: Based on the provided information, propose some ideas that are clear, innovative, valid, and comprehensive.
|
637 |
-
|
638 |
-
### Specific Information:
|
639 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
640 |
-
1. **Research problem & Rationales**: {problem}
|
641 |
-
2. **Cue Words**: {cue_words}
|
642 |
-
3. **Inspirations**: {inspirations_text}
|
643 |
-
|
644 |
-
### Format for Your Response:
|
645 |
-
Please ensure that your final ideas include about 10 entries, presented in the following format:
|
646 |
-
**Idea 1**: [The first method idea]
|
647 |
-
**Idea 2**: [The second method idea]
|
648 |
-
**Idea 3**: [The third method idea]
|
649 |
-
...
|
650 |
-
"""
|
651 |
if problem is None or inspirations is None or cue_words is None:
|
652 |
return None
|
653 |
try:
|
654 |
-
inspirations_text = ""
|
655 |
-
|
656 |
-
inspirations_text += (
|
657 |
"Inspiration {i}: ".format(i=i + 1) + "\n" + inspiration + "\n \n"
|
658 |
-
|
659 |
-
|
660 |
-
system_input = "Now you are a researcher in the field of AI with innovative and pioneering abilities. You are good at using innovative and original methods to solve cutting-edge problems in the field of AI."
|
661 |
-
message.append({"role": "system", "content": system_input})
|
662 |
-
message_input = prompt_template_idea.format(
|
663 |
-
problem=problem,
|
664 |
-
inspirations_text=inspirations_text,
|
665 |
-
cue_words=cue_words,
|
666 |
)
|
667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
response = self.generator.create(
|
669 |
messages=message,
|
670 |
)
|
@@ -675,42 +379,15 @@ class APIHelper(object):
|
|
675 |
return idea
|
676 |
|
677 |
def integrate_idea(self, background: str, brainstorm: str, idea: str) -> str:
|
678 |
-
|
679 |
-
|
680 |
-
You will be provided with research background information along with a set of ideas you generated previously from with the related paper information, and a set of brainstorming ideas concerning the same research topic. Your task is to combine these ideas and generate new ones, the new ideas you generate should base on the ideas you generated previously, and integrate creative parts of the brainstorming ideas. Consider the background thoroughly, taking into account the novelty and practicability of each idea. If you think an idea you generate is reasonable and valuable, feel free to retain it.
|
681 |
-
|
682 |
-
### Information Provided:
|
683 |
-
1. **Research Background**: The starting point for idea generation based on the research context.
|
684 |
-
2. **Brainstorming Ideas**: These ideas were generated purely from the research background, focusing on innovation and may not be directly related to the problem.
|
685 |
-
3. **Generated Ideas**: These are the ideas you previously generated by considering both the research background and related papers.
|
686 |
-
|
687 |
-
### Approach:
|
688 |
-
- **Step 1**: Review the research background and original ideas to understand the foundation of the problem.
|
689 |
-
- **Step 2**: Consider the brainstorming ideas and original ideas together. Combine, improve, or expand upon them, integrating insights from the related papers.
|
690 |
-
- **Step 3**: Propose new ideas that are innovative and practical, ensuring they align with the research background.
|
691 |
-
|
692 |
-
### Specific Information:
|
693 |
-
1. **Research Background**: {background}
|
694 |
-
2. **Brainstorming Ideas**: {brainstorm}
|
695 |
-
3. **Generated Ideas**: {idea}
|
696 |
-
|
697 |
-
### Format for Your Response:
|
698 |
-
Please ensure that your final ideas include 5-6 entries and present the integrated ideas in the following format:
|
699 |
-
**Idea 1**: [The first method idea]
|
700 |
-
**Idea 2**: [The second method idea]
|
701 |
-
**Idea 3**: [The third method idea]
|
702 |
-
...
|
703 |
-
"""
|
704 |
if background is None or brainstorm is None or idea is None:
|
705 |
return None
|
706 |
try:
|
707 |
-
message = [
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
background=background, brainstorm=brainstorm, idea=idea
|
712 |
-
)
|
713 |
-
message.append({"role": "user", "content": message_input})
|
714 |
response = self.generator.create(
|
715 |
messages=message,
|
716 |
)
|
@@ -721,41 +398,18 @@ class APIHelper(object):
|
|
721 |
return idea
|
722 |
|
723 |
def filter_idea(self, idea: str, background: str) -> str:
|
724 |
-
|
725 |
-
|
726 |
-
You will be provided with some ideas you previously generated, and a research background. Your task is to select 5-6 ideas that best address the problems described in the research background (priority) and ideas that are relatively novel and feasible (secondary), and then record the ideas and their content in given format. Remember that the content of idea includes everything about the idea.
|
727 |
-
|
728 |
-
### Information Provided:
|
729 |
-
1. **Ideas**: These are the ideas you previously generated based on the research background and several related papers.
|
730 |
-
2. **Research Background**: This document describes specific problems and challenges that need to be addressed.
|
731 |
-
|
732 |
-
### Approach:
|
733 |
-
Your approach should be systematic:
|
734 |
-
- **Step 1**: Analyze the research background to understand the specific problems that need solutions.
|
735 |
-
- **Step 2**: Critically review the ideas, selecting 5-6 ideas that are most effective in solving the problems in the research background (priority) and that are also relatively novel and feasible (secondary).
|
736 |
-
|
737 |
-
### Specific Information:
|
738 |
-
I will provide you with specific information now; please use them according to the instructions above:
|
739 |
-
1. **Ideas**: {idea}
|
740 |
-
2. **Research Background**: {background}
|
741 |
-
|
742 |
-
### Format for Your Response:
|
743 |
-
Please ensure that your final ideas include 5-6 entries, whose content has not been modified. Don't generate any explanation and just present the filtered ideas as well as their content in the following format:
|
744 |
-
**Idea 1**: [The first method idea]
|
745 |
-
**Idea 2**: [The second method idea]
|
746 |
-
**Idea 3**: [The third method idea]
|
747 |
-
...
|
748 |
-
"""
|
749 |
if background is None or idea is None:
|
750 |
return None
|
751 |
try:
|
752 |
-
message = [
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
response = self.generator.create(
|
760 |
messages=message,
|
761 |
)
|
@@ -766,45 +420,18 @@ class APIHelper(object):
|
|
766 |
return idea_filtered
|
767 |
|
768 |
def modify_idea(self, background: str, idea: str) -> str:
|
769 |
-
|
770 |
-
|
771 |
-
You will be provided with the research background and the original ideas you previously generated. Your task is to refine these original ideas by filtering out those with low feasibility and insufficient novelty while enhancing the most critical and relevant ideas to make them more novel, feasible, targeted, and specific. If applicable, you may include formulas or algorithms to support the ideas. Additionally, please adhere to the following requirements:
|
772 |
-
1. Do not generate ideas that are repetitive or contradictory.
|
773 |
-
2. Ensure that the generated ideas are coherent and form a cohesive whole.
|
774 |
-
|
775 |
-
### Information Provided:
|
776 |
-
1. **Research background**: This is the starting point of the original idea and the basis for analyzing whether the idea should be filtered.
|
777 |
-
2. **Original ideas**: These are the ideas you previously generated based on research background and several related papers.
|
778 |
-
|
779 |
-
### Approach:
|
780 |
-
Your approach should be systematic:
|
781 |
-
- **Step 1**: Thoroughly review the research background to understand the context and objectives.
|
782 |
-
- **Step 2**: Analyze the original ideas critically, identifying aspects with low feasibility or insufficient novelty, and then filter out them.
|
783 |
-
- **Step 3**: Enhance the most critical and relevant ideas by making them more novel, feasible, targeted, and specific. Incorporate formulas or algorithms if they strengthen the ideas.
|
784 |
-
|
785 |
-
### Specific Information:
|
786 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
787 |
-
1. **Research background**: {background}
|
788 |
-
2. **Original idea**: {idea}
|
789 |
-
|
790 |
-
### Format for Your Response:
|
791 |
-
Please ensure that your response only includes the final ideas, which include 2 to 4 entries, presented in the following format:
|
792 |
-
**Idea 1**: [The first method idea]
|
793 |
-
- **Details**: [Details of the first idea]
|
794 |
-
**Idea 2**: [The second method idea]
|
795 |
-
- **Details**: [Details of the second idea]
|
796 |
-
...
|
797 |
-
"""
|
798 |
if background is None or idea is None:
|
799 |
return None
|
800 |
try:
|
801 |
-
message = [
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
response = self.generator.create(
|
809 |
messages=message,
|
810 |
)
|
@@ -815,44 +442,15 @@ class APIHelper(object):
|
|
815 |
return idea_modified
|
816 |
|
817 |
def generate_ground_truth(self, abstract: str, contribution: str, text: str) -> str:
|
818 |
-
|
819 |
-
|
820 |
-
You will be provided with the abstract and a text extracted from a paper and three contributions of the paper. Your task is to filter, refine, and revise the content of the contributions through the text provided to you.
|
821 |
-
|
822 |
-
### Information Provided:
|
823 |
-
1. **Abstract**: It's the abstract directly extracted from the paper.
|
824 |
-
2. **Contributions**: These are the contributions (methods) we have summarized based on the abstract and introduction of the paper.
|
825 |
-
3. **Text**: It's the text directly extracted from the paper, containing the methodology of the paper.
|
826 |
-
|
827 |
-
### Approach:
|
828 |
-
Your approach should be systematic:
|
829 |
-
- **Step 1**: Start by reading the abstract and contributions, to understand the main work of this paper.
|
830 |
-
- **Step 2**: Then, read the text, to find information related to the contributions and ignore other information. If you think there is missing content in the contributions section, you can add one. On the contrary, if you think there is content duplication, merge or delete one. Please ensure that the final contributions have 2 to 4 entries.
|
831 |
-
- **Step 3**: Finally, provide specific details for each contribution as detailed and comprehensive as possible based on the content in the text. If applicable, you may include formulas or algorithms to support the ideas.
|
832 |
-
|
833 |
-
### Specific Information:
|
834 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
835 |
-
1. **Abstract**: {abstract}
|
836 |
-
2. **Contribution**: {contribution}
|
837 |
-
3. **Text**: {text}
|
838 |
-
|
839 |
-
### Format for Your Response:
|
840 |
-
Your output should follow the format, and please note that your subject should not be 'the paper' but 'this method' or the specific method name:
|
841 |
-
**Idea 1**: [The first method idea]
|
842 |
-
- **Details**: [Details of the first idea]
|
843 |
-
**Idea 2**: [The second method idea]
|
844 |
-
- **Details**: [Details of the second idea]
|
845 |
-
...
|
846 |
-
"""
|
847 |
ground_truth = None
|
848 |
if abstract is None or contribution is None or text is None:
|
849 |
return None
|
850 |
try:
|
851 |
-
message = [
|
852 |
-
|
853 |
-
|
854 |
-
)
|
855 |
-
message.append({"role": "user", "content": prompt})
|
856 |
response = self.generator.create(
|
857 |
messages=message,
|
858 |
)
|
@@ -862,28 +460,12 @@ class APIHelper(object):
|
|
862 |
return ground_truth
|
863 |
|
864 |
def transfer_form(self, idea: str):
|
865 |
-
|
866 |
-
|
867 |
-
I will give you some ideas, please standardize the output format of the ideas without changing any characters in their content. Note that the content of each idea includes everything about the idea。
|
868 |
-
|
869 |
-
### Specific Information:
|
870 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
871 |
-
**Ideas**:
|
872 |
-
'''
|
873 |
-
{idea}
|
874 |
-
'''
|
875 |
-
### Format for Your Response:
|
876 |
-
Please ensure that your final answer is strictly presented in the following format:
|
877 |
-
**1.**<The content of the first idea>.
|
878 |
-
**2.**<The content of the second idea>.
|
879 |
-
...
|
880 |
-
"""
|
881 |
if idea is None:
|
882 |
return None
|
883 |
try:
|
884 |
-
message = []
|
885 |
-
message_input = prompt_template_transfer.format(idea=idea)
|
886 |
-
message.append({"role": "user", "content": message_input})
|
887 |
response = self.generator.create(
|
888 |
messages=message,
|
889 |
)
|
@@ -894,38 +476,18 @@ class APIHelper(object):
|
|
894 |
return idea_norm
|
895 |
|
896 |
def select_contribution(self, idea: str, contribution: list[str]) -> str:
|
897 |
-
|
898 |
-
|
899 |
-
You will be provided with an idea you previously generated, and some reference ideas. Your task is to select the idea that is most similar to the one you generated from the reference ideas.
|
900 |
-
|
901 |
-
### Information Provided:
|
902 |
-
1. **Generated Idea**: This is the idea you previously generated based on research background and several related papers.
|
903 |
-
2. **Reference Ideas**: These are the ideas that you should select from.
|
904 |
-
|
905 |
-
### Approach:
|
906 |
-
Your approach should be systematic:
|
907 |
-
- **Step 1**: Analyze the generated idea to understand the methods it describes.
|
908 |
-
- **Step 2**: Critically review the reference ideas, selecting the idea that is most similar to the methods in the generated idea.
|
909 |
-
|
910 |
-
### Specific Information:
|
911 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
912 |
-
1. **Idea**: {idea}
|
913 |
-
2. **Reference Ideas**: {reference_ideas}
|
914 |
-
|
915 |
-
### Format for Your Response:
|
916 |
-
Your answer can only have one number (strating from 1), indicating the number of the most similar idea, and cannot contain any other content.
|
917 |
-
"""
|
918 |
if idea is None or contribution is None:
|
919 |
return None
|
920 |
try:
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
idea=idea, reference_ideas=reference_ideas
|
927 |
)
|
928 |
-
message
|
929 |
response = self.generator.create(
|
930 |
messages=message,
|
931 |
max_tokens=10,
|
@@ -937,40 +499,12 @@ class APIHelper(object):
|
|
937 |
return index
|
938 |
|
939 |
def get_similarity_score(self, idea: str, contribution: str) -> str:
|
940 |
-
|
941 |
-
|
942 |
-
You will be provided with an idea you previously generated, and a reference idea. Your task is to determine the similarity between the generated idea and the reference idea and give a score from 0 to 5.
|
943 |
-
|
944 |
-
### Information Provided:
|
945 |
-
1. **Generated Idea**: This is the idea you previously generated based on research background and several related papers.
|
946 |
-
2. **Reference Idea**: This is the idea we provide you with that you need to compare with the generated idea.
|
947 |
-
|
948 |
-
### Approach:
|
949 |
-
You should follow the following scoring criteria:
|
950 |
-
- **0**: The generated idea and reference idea are completely unrelated with no discernible similarities.
|
951 |
-
- **1**: The generated idea and reference idea have a vague connection, but differ significantly in their main concepts or approach.
|
952 |
-
- **2**: The generated idea and reference idea share a general concept but differ in most key aspects such as methodology or application.
|
953 |
-
- **3**: The generated idea and reference idea are similar in several areas, including general concept and some aspects of methodology, but differ in details or specific approaches.
|
954 |
-
- **4**: The generated idea and reference idea are largely similar in concept, methodology, and approach, with only minor differences in specifics.
|
955 |
-
- **5**: The generated idea and reference idea are nearly identical in all key aspects, including concept, methodology, and approach.
|
956 |
-
|
957 |
-
### Specific Information:
|
958 |
-
I will provide you with specific information now, please use them according to the instructions above:
|
959 |
-
1. **Generated Idea**: {idea}
|
960 |
-
2. **Reference Idea**: {reference_idea}
|
961 |
-
|
962 |
-
### Format for Your Response:
|
963 |
-
Your answer can only have one number (from 0 to 5), indicating the similarity score, and cannot contain any other content.
|
964 |
-
"""
|
965 |
if idea is None or contribution is None:
|
966 |
return None
|
967 |
try:
|
968 |
-
message = []
|
969 |
-
reference_ideas = ""
|
970 |
-
message_input = prompt_template_select.format(
|
971 |
-
idea=idea, reference_idea=contribution
|
972 |
-
)
|
973 |
-
message.append({"role": "user", "content": message_input})
|
974 |
response = self.generator.create(
|
975 |
messages=message,
|
976 |
max_tokens=10,
|
@@ -984,71 +518,28 @@ class APIHelper(object):
|
|
984 |
def novelty_eval(
|
985 |
self,
|
986 |
current_round: int,
|
987 |
-
num_rounds: int,
|
988 |
max_num_iterations: int,
|
989 |
idea: str,
|
990 |
last_query_results: str,
|
991 |
msg_history: list,
|
992 |
):
|
993 |
-
|
994 |
-
|
995 |
-
Be a harsh critic for novelty, ensure there is a sufficient contribution in the idea for a new conference or workshop paper.
|
996 |
-
You will be given access to the Semantic Scholar API, which you may use to survey the literature and find relevant papers to help you make your decision.
|
997 |
-
The top 10 results for any search query will be presented to you with the abstracts.
|
998 |
-
|
999 |
-
You will be given {num_rounds} rounds to decide on the paper.
|
1000 |
-
At any round, compare the provided idea with the information found in the article and provide a novelty score from 0 to 10.
|
1001 |
-
In each search round, you should give a query and a novelty score based on the information in the relevant papers.
|
1002 |
-
If there are no relevant papers, give a novelty score based on your own feelings.
|
1003 |
-
"""
|
1004 |
-
|
1005 |
-
novelty_prompt = '''Round {current_round}/{num_rounds}.
|
1006 |
-
You have this idea:
|
1007 |
-
|
1008 |
-
"""
|
1009 |
-
{idea}
|
1010 |
-
"""
|
1011 |
-
|
1012 |
-
The results of the last query are (empty on first round):
|
1013 |
-
"""
|
1014 |
-
{last_query_results}
|
1015 |
-
"""
|
1016 |
-
|
1017 |
-
Respond in the following format:
|
1018 |
-
|
1019 |
-
THOUGHT:
|
1020 |
-
<THOUGHT>
|
1021 |
-
|
1022 |
-
RESPONSE:
|
1023 |
-
```json
|
1024 |
-
<JSON>
|
1025 |
-
```
|
1026 |
-
|
1027 |
-
In <THOUGHT>, first briefly reason over the idea and identify any query that could help you suggest a score based on its novelty. Then give your perceived novelty score.
|
1028 |
-
|
1029 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1030 |
-
- "Query": An optional search query to search the literature (e.g. attention is all you need). You must make a query if you have not decided this round.
|
1031 |
-
- "Novelty Score": A novelty score from 0 to 10.
|
1032 |
-
|
1033 |
-
A query will work best if you are able to recall the exact name of the paper you are looking for, or the authors.
|
1034 |
-
This JSON will be automatically parsed, so ensure the format is precise. (the JSON MUST contain the "Query" and the "Novelty Score")
|
1035 |
-
In the last round, you should assign a "" value to the "Query" even if you don't need to generate it.'''
|
1036 |
-
msg = novelty_prompt.format(
|
1037 |
-
current_round=current_round,
|
1038 |
-
num_rounds=max_num_iterations,
|
1039 |
-
idea=idea,
|
1040 |
-
last_query_results=last_query_results,
|
1041 |
-
)
|
1042 |
-
system_message = novelty_system_msg.format(
|
1043 |
-
num_rounds=max_num_iterations,
|
1044 |
-
)
|
1045 |
if msg_history is None:
|
1046 |
msg_history = []
|
1047 |
try:
|
1048 |
-
new_msg_history = msg_history + [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
response = self.generator.create(
|
1050 |
messages=[
|
1051 |
-
|
1052 |
*new_msg_history,
|
1053 |
],
|
1054 |
temperature=0.75,
|
@@ -1070,74 +561,19 @@ class APIHelper(object):
|
|
1070 |
def compare_same(
|
1071 |
self, idea1: str, idea2: str, idea3: str, idea4: str, idea5: str
|
1072 |
) -> str:
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
"""
|
1077 |
-
input_message = '''
|
1078 |
-
### Comparison Standard:
|
1079 |
-
"""
|
1080 |
-
**Clarity**: It evaluates whether the method is articulated in a straightforward and coherent manner, facilitating a comprehensive understanding for both practitioners and researchers, thus enabling effective application and potential adaptation in similar studies.
|
1081 |
-
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
1082 |
-
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
1083 |
-
**Generalizability**: It determines how broadly the method can be extended or adapted to various contexts, populations, or situations, evaluating its applicability beyond the specific conditions of the study while maintaining relevance and effectiveness.
|
1084 |
-
"""
|
1085 |
-
|
1086 |
-
### You should compare these five ideas:
|
1087 |
-
"""IDEA1
|
1088 |
-
{idea1}
|
1089 |
-
"""
|
1090 |
-
"""IDEA2
|
1091 |
-
{idea2}
|
1092 |
-
"""
|
1093 |
-
"""IDEA3
|
1094 |
-
{idea3}
|
1095 |
-
"""
|
1096 |
-
"""IDEA4
|
1097 |
-
{idea4}
|
1098 |
-
"""
|
1099 |
-
"""IDEA5
|
1100 |
-
{idea5}
|
1101 |
-
"""
|
1102 |
-
|
1103 |
-
### Respond in the following format:
|
1104 |
-
|
1105 |
-
THOUGHT:
|
1106 |
-
```thought
|
1107 |
-
<THOUGHT>
|
1108 |
-
```
|
1109 |
-
|
1110 |
-
RESPONSE:
|
1111 |
-
```json
|
1112 |
-
<JSON>
|
1113 |
-
```
|
1114 |
-
|
1115 |
-
In <THOUGHT>, You can record your reasoning process to make your comparison more organized..
|
1116 |
-
|
1117 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1118 |
-
- "Clarity": Provide an array consisting of 1-5, representing each idea separately, with the better idea placed at the beginning (e.g. [4, 5, 3, 2, 1])
|
1119 |
-
- "Novelty": Same as above.
|
1120 |
-
- "Feasibility": Same as above.
|
1121 |
-
- "Generalizability": Same as above.
|
1122 |
-
- "Overall Ranking": Same as above.
|
1123 |
-
|
1124 |
-
This JSON will be automatically parsed, so ensure the format is precise.
|
1125 |
-
'''
|
1126 |
-
if (
|
1127 |
-
idea1 is None
|
1128 |
-
or idea2 is None
|
1129 |
-
or idea3 is None
|
1130 |
-
or idea4 is None
|
1131 |
-
or idea5 is None
|
1132 |
-
):
|
1133 |
return None
|
1134 |
try:
|
1135 |
-
message =
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
|
|
|
|
|
|
1139 |
)
|
1140 |
-
message.append({"role": "user", "content": message_input})
|
1141 |
response = self.generator.create(
|
1142 |
messages=message,
|
1143 |
)
|
@@ -1148,58 +584,20 @@ class APIHelper(object):
|
|
1148 |
return result
|
1149 |
|
1150 |
def compare_all(self, idea1: str, idea2: str) -> str:
|
1151 |
-
|
1152 |
-
|
1153 |
-
You will obtain a comparison standard, compare every point on the standard, and make a overall ranking at the end.
|
1154 |
-
"""
|
1155 |
-
input_message = '''
|
1156 |
-
### Comparison Standard:
|
1157 |
-
"""
|
1158 |
-
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
1159 |
-
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
1160 |
-
**Clarity**: It evaluates whether the method is articulated in a straightforward and coherent manner, facilitating a comprehensive understanding for both practitioners and researchers, thus enabling effective application and potential adaptation in similar studies.
|
1161 |
-
**Generalizability**: It determines how broadly the method can be extended or adapted to various contexts, populations, or situations, evaluating its applicability beyond the specific conditions of the study while maintaining relevance and effectiveness.
|
1162 |
-
"""
|
1163 |
-
|
1164 |
-
### You should compare these five ideas:
|
1165 |
-
"""IDEA1
|
1166 |
-
{idea1}
|
1167 |
-
"""
|
1168 |
-
"""IDEA2
|
1169 |
-
{idea2}
|
1170 |
-
"""
|
1171 |
-
|
1172 |
-
### Respond in the following format:
|
1173 |
-
|
1174 |
-
THOUGHT:
|
1175 |
-
```thought
|
1176 |
-
<THOUGHT>
|
1177 |
-
```
|
1178 |
-
|
1179 |
-
RESPONSE:
|
1180 |
-
```json
|
1181 |
-
<JSON>
|
1182 |
-
```
|
1183 |
-
|
1184 |
-
In <THOUGHT>, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
1185 |
-
|
1186 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1187 |
-
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
1188 |
-
- "Feasibility": Same as above.
|
1189 |
-
- "clarity": Same as above.
|
1190 |
-
- "Generalizability": Same as above.
|
1191 |
-
- "Overall Ranking": Same as above.
|
1192 |
-
|
1193 |
-
|
1194 |
-
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise.
|
1195 |
-
'''
|
1196 |
if idea1 is None or idea2 is None:
|
1197 |
return None
|
1198 |
try:
|
1199 |
-
message =
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
|
|
|
|
|
|
|
|
|
|
1203 |
response = self.generator.create(
|
1204 |
messages=message,
|
1205 |
)
|
@@ -1210,52 +608,20 @@ class APIHelper(object):
|
|
1210 |
return result
|
1211 |
|
1212 |
def compare_novelty_and_feasibility(self, idea1: str, idea2: str) -> str:
|
1213 |
-
|
1214 |
-
|
1215 |
-
You will obtain a comparison standard, compare every point on the standard, and make a ranking at the end.
|
1216 |
-
"""
|
1217 |
-
input_message = '''
|
1218 |
-
### Comparison Standard:
|
1219 |
-
"""
|
1220 |
-
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
1221 |
-
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
1222 |
-
"""
|
1223 |
-
|
1224 |
-
### You should compare these five ideas:
|
1225 |
-
"""IDEA1
|
1226 |
-
{idea1}
|
1227 |
-
"""
|
1228 |
-
"""IDEA2
|
1229 |
-
{idea2}
|
1230 |
-
"""
|
1231 |
-
|
1232 |
-
### Respond in the following format:
|
1233 |
-
|
1234 |
-
THOUGHT:
|
1235 |
-
```thought
|
1236 |
-
<THOUGHT>
|
1237 |
-
```
|
1238 |
-
|
1239 |
-
RESPONSE:
|
1240 |
-
```json
|
1241 |
-
<JSON>
|
1242 |
-
```
|
1243 |
-
|
1244 |
-
In <THOUGHT>, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
1245 |
-
|
1246 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1247 |
-
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
1248 |
-
- "Feasibility": Same as above.
|
1249 |
-
|
1250 |
-
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise.
|
1251 |
-
'''
|
1252 |
if idea1 is None or idea2 is None:
|
1253 |
return None
|
1254 |
try:
|
1255 |
-
message =
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
|
|
|
|
|
|
|
|
|
|
1259 |
response = self.generator.create(
|
1260 |
messages=message,
|
1261 |
)
|
@@ -1266,50 +632,20 @@ class APIHelper(object):
|
|
1266 |
return result
|
1267 |
|
1268 |
def compare_novelty(self, idea1: str, idea2: str) -> str:
|
1269 |
-
|
1270 |
-
|
1271 |
-
You will obtain a comparison standard, compare the novelty between the ideas, and make a ranking at the end.
|
1272 |
-
"""
|
1273 |
-
input_message = '''
|
1274 |
-
### Comparison Standard:
|
1275 |
-
"""
|
1276 |
-
**Novelty**: It assesses the degree to which the method presents novel ideas or transformative strategies that challenge conventional practices, fostering advancements in the field and inspiring future research directions.
|
1277 |
-
"""
|
1278 |
-
|
1279 |
-
### You should compare these five ideas:
|
1280 |
-
"""IDEA1
|
1281 |
-
{idea1}
|
1282 |
-
"""
|
1283 |
-
"""IDEA2
|
1284 |
-
{idea2}
|
1285 |
-
"""
|
1286 |
-
|
1287 |
-
### Respond in the following format:
|
1288 |
-
|
1289 |
-
THOUGHT:
|
1290 |
-
```thought
|
1291 |
-
<THOUGHT>
|
1292 |
-
```
|
1293 |
-
|
1294 |
-
RESPONSE:
|
1295 |
-
```json
|
1296 |
-
<JSON>
|
1297 |
-
```
|
1298 |
-
|
1299 |
-
In <THOUGHT>, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
1300 |
-
|
1301 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1302 |
-
- "Novelty": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
1303 |
-
|
1304 |
-
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise and don't forget the label "Novelty".
|
1305 |
-
'''
|
1306 |
if idea1 is None or idea2 is None:
|
1307 |
return None
|
1308 |
try:
|
1309 |
-
message =
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
|
|
|
|
|
|
|
|
|
|
1313 |
response = self.generator.create(
|
1314 |
messages=message,
|
1315 |
)
|
@@ -1320,50 +656,20 @@ class APIHelper(object):
|
|
1320 |
return result
|
1321 |
|
1322 |
def compare_feasibility(self, idea1: str, idea2: str) -> str:
|
1323 |
-
|
1324 |
-
|
1325 |
-
You will obtain a comparison standard, compare the feasibility between the ideas, and make a ranking at the end.
|
1326 |
-
"""
|
1327 |
-
input_message = '''
|
1328 |
-
### Comparison Standard:
|
1329 |
-
"""
|
1330 |
-
**Feasibility**: It examines the practicality and implementability of the method, ensuring that the required resources, time, and expertise are realistically available for its execution within the constraints of the study environment.
|
1331 |
-
"""
|
1332 |
-
|
1333 |
-
### You should compare these five ideas:
|
1334 |
-
"""IDEA1
|
1335 |
-
{idea1}
|
1336 |
-
"""
|
1337 |
-
"""IDEA2
|
1338 |
-
{idea2}
|
1339 |
-
"""
|
1340 |
-
|
1341 |
-
### Respond in the following format:
|
1342 |
-
|
1343 |
-
THOUGHT:
|
1344 |
-
```thought
|
1345 |
-
<THOUGHT>
|
1346 |
-
```
|
1347 |
-
|
1348 |
-
RESPONSE:
|
1349 |
-
```json
|
1350 |
-
<JSON>
|
1351 |
-
```
|
1352 |
-
|
1353 |
-
In <THOUGHT>, You can record your reasoning process and explain why you think the idea is better in each aspect in detail to make your comparison more organized.
|
1354 |
-
|
1355 |
-
In <JSON>, respond in JSON format with ONLY the following field:
|
1356 |
-
- "Feasibility": Provide an array consisting of 1 and 2, representing each idea separately, with the better idea placed at the beginning (e.g. [1, 2]).
|
1357 |
-
|
1358 |
-
This THOUGHT and JSON will be automatically parsed, so ensure the format is precise and don't forget the label "Feasibility".
|
1359 |
-
'''
|
1360 |
if idea1 is None or idea2 is None:
|
1361 |
return None
|
1362 |
try:
|
1363 |
-
message =
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
|
|
|
|
|
|
|
|
|
|
1367 |
response = self.generator.create(
|
1368 |
messages=message,
|
1369 |
)
|
|
|
1 |
from .api import HelperCompany
|
2 |
import re
|
3 |
import os
|
4 |
+
from .header import get_dir, Prompt, ConfigReader, get_prompt
|
5 |
import traceback
|
6 |
import openai
|
7 |
|
|
|
27 |
return cleaned
|
28 |
|
29 |
|
30 |
+
def get_related_papers_information(paper, index=""):
|
31 |
+
return "Related paper {index}: {title}\nSummary: {summary}\nBackgrounds: {motivation}\nContributions: {contribution}\n \n".format(
|
32 |
+
index=index,
|
33 |
+
title=paper["title"],
|
34 |
+
summary=paper["summary"],
|
35 |
+
motivation=paper["motivation"],
|
36 |
+
contribution=paper["contribution"],
|
37 |
+
)
|
38 |
+
|
39 |
+
|
40 |
class APIHelper(object):
|
41 |
|
42 |
def __init__(self, config) -> None:
|
|
|
98 |
return result
|
99 |
|
100 |
def generate_entity_list(self, abstract: str, max_num: int = 5) -> list:
|
101 |
+
prompt = get_prompt()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
if abstract is None:
|
104 |
return None
|
105 |
try:
|
106 |
examples_str = "\n".join(
|
107 |
f"[content]: {example['content']}\n[entity]: {example['entities']}\n###\n"
|
108 |
+
for example in prompt[1][0].data
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
)
|
110 |
+
message = [
|
111 |
+
prompt[0][0](),
|
112 |
+
prompt[1][0](
|
113 |
+
examples=examples_str, content=abstract, max_num=str(max_num)
|
114 |
+
),
|
115 |
+
]
|
116 |
response = self.generator.create(
|
117 |
messages=message,
|
118 |
)
|
|
|
139 |
return clean_entity_list
|
140 |
|
141 |
def generate_brainstorm(self, background: str) -> str:
|
142 |
+
prompt = get_prompt()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
if background is None:
|
145 |
print("Input background is empty ...")
|
146 |
return None
|
147 |
try:
|
148 |
# Initial brainstorming to generate raw ideas
|
149 |
+
message = [prompt[0][0](), prompt[1][0](background=background)]
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
# Call the API to generate brainstorming ideas
|
151 |
response_brainstorming = self.generator.create(
|
152 |
messages=message,
|
|
|
160 |
return brainstorming_ideas
|
161 |
|
162 |
def generate_problem(self, background: str, related_papers: list[dict]):
|
163 |
+
prompt = get_prompt()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
if background is None or related_papers is None:
|
165 |
return None
|
166 |
try:
|
167 |
+
related_papers_information = "".join(
|
168 |
+
[
|
169 |
+
get_related_papers_information(paper, i + 1)
|
170 |
+
for i, paper in enumerate(related_papers)
|
171 |
+
]
|
172 |
+
)
|
173 |
+
message_input = prompt[1][0](
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
background=background,
|
175 |
related_papers_information=related_papers_information,
|
176 |
)
|
177 |
+
message = [prompt[0][0](), message_input]
|
178 |
response = self.generator.create(
|
179 |
messages=message,
|
180 |
)
|
|
|
187 |
def generate_problem_with_cue_words(
|
188 |
self, background: str, related_papers: list[dict], cue_words: list
|
189 |
):
|
190 |
+
prompt = get_prompt()
|
191 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
if background is None or related_papers is None or cue_words is None:
|
193 |
return None
|
194 |
try:
|
195 |
+
related_papers_information = "".join(
|
196 |
+
[
|
197 |
+
get_related_papers_information(paper, i + 1)
|
198 |
+
for i, paper in enumerate(related_papers)
|
199 |
+
]
|
200 |
+
)
|
201 |
+
message_input = prompt[1][0](
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
background=background,
|
203 |
related_papers_information=related_papers_information,
|
204 |
cue_words=cue_words,
|
205 |
)
|
206 |
+
message = [prompt[0][0](), message_input]
|
207 |
response = self.generator.create(
|
208 |
messages=message,
|
209 |
)
|
|
|
214 |
return problem, message_input
|
215 |
|
216 |
def generate_inspiration(self, problem: str, related_paper: dict):
|
217 |
+
prompt = get_prompt()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
if problem is None or related_paper is None:
|
219 |
return None
|
220 |
try:
|
221 |
+
related_paper_information = get_related_papers_information(related_paper)
|
222 |
+
message = [
|
223 |
+
prompt[0][0](),
|
224 |
+
prompt[1][0](
|
225 |
+
problem=problem, related_paper_information=related_paper_information
|
226 |
+
),
|
227 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
response = self.generator.create(
|
229 |
messages=message,
|
230 |
)
|
|
|
237 |
def generate_inspiration_with_cue_words(
|
238 |
self, problem: str, related_paper: dict, cue_words: list
|
239 |
):
|
240 |
+
prompt = get_prompt()
|
241 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
if problem is None or related_paper is None or cue_words is None:
|
243 |
return None
|
244 |
try:
|
245 |
+
related_paper_information = get_related_papers_information(related_paper)
|
246 |
+
message = [
|
247 |
+
prompt[0][0](),
|
248 |
+
prompt[1][0](
|
249 |
+
problem=problem,
|
250 |
+
related_paper_information=related_paper_information,
|
251 |
+
cue_words=cue_words,
|
252 |
+
),
|
253 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
response = self.generator.create(
|
255 |
messages=message,
|
256 |
)
|
|
|
261 |
return inspiration
|
262 |
|
263 |
def generate_idea(self, problem: str, related_papers: list[dict]) -> str:
|
264 |
+
prompt = get_prompt()
|
265 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
if problem is None or related_papers is None:
|
267 |
return None
|
268 |
try:
|
269 |
+
related_papers_information = "".join(
|
270 |
+
[
|
271 |
+
get_related_papers_information(paper, i + 1)
|
272 |
+
for i, paper in enumerate(related_papers)
|
273 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
)
|
275 |
+
message = [
|
276 |
+
prompt[0][0](),
|
277 |
+
prompt[1][0](
|
278 |
+
problem=problem,
|
279 |
+
related_papers_information=related_papers_information,
|
280 |
+
),
|
281 |
+
]
|
282 |
response = self.generator.create(
|
283 |
messages=message,
|
284 |
)
|
|
|
291 |
def generate_idea_with_cue_words(
|
292 |
self, problem: str, related_papers: list[dict], cue_words: list
|
293 |
) -> str:
|
294 |
+
prompt = get_prompt()
|
295 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
if problem is None or related_papers is None or cue_words is None:
|
297 |
return None
|
298 |
try:
|
299 |
+
related_papers_information = "".join(
|
300 |
+
[
|
301 |
+
get_related_papers_information(paper, i + 1)
|
302 |
+
for i, paper in enumerate(related_papers)
|
303 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
)
|
305 |
+
message = [
|
306 |
+
prompt[0][0](),
|
307 |
+
prompt[1][0](
|
308 |
+
problem=problem,
|
309 |
+
related_papers_information=related_papers_information,
|
310 |
+
cue_words=cue_words,
|
311 |
+
),
|
312 |
+
]
|
313 |
+
|
314 |
response = self.generator.create(
|
315 |
messages=message,
|
316 |
)
|
|
|
321 |
return idea
|
322 |
|
323 |
def generate_idea_by_inspiration(self, problem: str, inspirations: list[str]):
|
324 |
+
prompt = get_prompt()
|
325 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
if problem is None or inspirations is None:
|
327 |
return None
|
328 |
try:
|
329 |
+
inspirations_text = "".join(
|
330 |
+
[
|
|
|
331 |
"Inspiration {i}: ".format(i=i + 1) + "\n" + inspiration + "\n \n"
|
332 |
+
for i, inspiration in enumerate(inspirations)
|
333 |
+
]
|
|
|
|
|
|
|
|
|
334 |
)
|
335 |
+
|
336 |
+
message = [
|
337 |
+
prompt[0][0](),
|
338 |
+
prompt[1][0](problem=problem, inspirations_text=inspirations_text),
|
339 |
+
]
|
340 |
response = self.generator.create(
|
341 |
messages=message,
|
342 |
)
|
|
|
349 |
def generate_idea_by_inspiration_with_cue_words(
|
350 |
self, problem: str, inspirations: list[str], cue_words: list
|
351 |
):
|
352 |
+
prompt = get_prompt()
|
353 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
if problem is None or inspirations is None or cue_words is None:
|
355 |
return None
|
356 |
try:
|
357 |
+
inspirations_text = "".join(
|
358 |
+
[
|
|
|
359 |
"Inspiration {i}: ".format(i=i + 1) + "\n" + inspiration + "\n \n"
|
360 |
+
for i, inspiration in enumerate(inspirations)
|
361 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
)
|
363 |
+
|
364 |
+
message = [
|
365 |
+
prompt[0][0](),
|
366 |
+
prompt[1][0](
|
367 |
+
problem=problem,
|
368 |
+
inspirations_text=inspirations_text,
|
369 |
+
cue_words=cue_words,
|
370 |
+
),
|
371 |
+
]
|
372 |
response = self.generator.create(
|
373 |
messages=message,
|
374 |
)
|
|
|
379 |
return idea
|
380 |
|
381 |
def integrate_idea(self, background: str, brainstorm: str, idea: str) -> str:
|
382 |
+
prompt = get_prompt()
|
383 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
if background is None or brainstorm is None or idea is None:
|
385 |
return None
|
386 |
try:
|
387 |
+
message = [
|
388 |
+
prompt[0][0](),
|
389 |
+
prompt[1][0](background=background, brainstorm=brainstorm, idea=idea),
|
390 |
+
]
|
|
|
|
|
|
|
391 |
response = self.generator.create(
|
392 |
messages=message,
|
393 |
)
|
|
|
398 |
return idea
|
399 |
|
400 |
def filter_idea(self, idea: str, background: str) -> str:
|
401 |
+
prompt = get_prompt()
|
402 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
if background is None or idea is None:
|
404 |
return None
|
405 |
try:
|
406 |
+
message = [
|
407 |
+
prompt[0][0](),
|
408 |
+
prompt[1][0](
|
409 |
+
idea=idea,
|
410 |
+
background=background,
|
411 |
+
),
|
412 |
+
]
|
413 |
response = self.generator.create(
|
414 |
messages=message,
|
415 |
)
|
|
|
420 |
return idea_filtered
|
421 |
|
422 |
def modify_idea(self, background: str, idea: str) -> str:
|
423 |
+
prompt = get_prompt()
|
424 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
if background is None or idea is None:
|
426 |
return None
|
427 |
try:
|
428 |
+
message = [
|
429 |
+
prompt[0][0](),
|
430 |
+
prompt[1][0](
|
431 |
+
background=background,
|
432 |
+
idea=idea,
|
433 |
+
),
|
434 |
+
]
|
435 |
response = self.generator.create(
|
436 |
messages=message,
|
437 |
)
|
|
|
442 |
return idea_modified
|
443 |
|
444 |
def generate_ground_truth(self, abstract: str, contribution: str, text: str) -> str:
|
445 |
+
prompt = get_prompt()
|
446 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
ground_truth = None
|
448 |
if abstract is None or contribution is None or text is None:
|
449 |
return None
|
450 |
try:
|
451 |
+
message = [
|
452 |
+
prompt[0][0](abstract=abstract, contribution=contribution, text=text)
|
453 |
+
]
|
|
|
|
|
454 |
response = self.generator.create(
|
455 |
messages=message,
|
456 |
)
|
|
|
460 |
return ground_truth
|
461 |
|
462 |
def transfer_form(self, idea: str):
|
463 |
+
prompt = get_prompt()
|
464 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
if idea is None:
|
466 |
return None
|
467 |
try:
|
468 |
+
message = [prompt[0][0](idea=idea)]
|
|
|
|
|
469 |
response = self.generator.create(
|
470 |
messages=message,
|
471 |
)
|
|
|
476 |
return idea_norm
|
477 |
|
478 |
def select_contribution(self, idea: str, contribution: list[str]) -> str:
|
479 |
+
prompt = get_prompt()
|
480 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
if idea is None or contribution is None:
|
482 |
return None
|
483 |
try:
|
484 |
+
reference_ideas = "".join(
|
485 |
+
[
|
486 |
+
"Idea {i}: ".format(i=i + 1) + "\n" + idea + "\n \n"
|
487 |
+
for i, idea in enumerate(contribution)
|
488 |
+
]
|
|
|
489 |
)
|
490 |
+
message = [prompt[0][0](idea=idea, reference_ideas=reference_ideas)]
|
491 |
response = self.generator.create(
|
492 |
messages=message,
|
493 |
max_tokens=10,
|
|
|
499 |
return index
|
500 |
|
501 |
def get_similarity_score(self, idea: str, contribution: str) -> str:
|
502 |
+
prompt = get_prompt()
|
503 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
if idea is None or contribution is None:
|
505 |
return None
|
506 |
try:
|
507 |
+
message = [prompt[0][0](idea=idea, reference_idea=contribution)]
|
|
|
|
|
|
|
|
|
|
|
508 |
response = self.generator.create(
|
509 |
messages=message,
|
510 |
max_tokens=10,
|
|
|
518 |
def novelty_eval(
|
519 |
self,
|
520 |
current_round: int,
|
521 |
+
num_rounds: int, # TODO unused var
|
522 |
max_num_iterations: int,
|
523 |
idea: str,
|
524 |
last_query_results: str,
|
525 |
msg_history: list,
|
526 |
):
|
527 |
+
prompt = get_prompt()
|
528 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
if msg_history is None:
|
530 |
msg_history = []
|
531 |
try:
|
532 |
+
new_msg_history = msg_history + [
|
533 |
+
prompt[1][0](
|
534 |
+
current_round=current_round,
|
535 |
+
num_rounds=max_num_iterations,
|
536 |
+
idea=idea,
|
537 |
+
last_query_results=last_query_results,
|
538 |
+
)
|
539 |
+
]
|
540 |
response = self.generator.create(
|
541 |
messages=[
|
542 |
+
prompt[0][0](num_rounds=max_num_iterations),
|
543 |
*new_msg_history,
|
544 |
],
|
545 |
temperature=0.75,
|
|
|
561 |
def compare_same(
|
562 |
self, idea1: str, idea2: str, idea3: str, idea4: str, idea5: str
|
563 |
) -> str:
|
564 |
+
prompt = get_prompt()
|
565 |
+
|
566 |
+
if not all([idea1, idea2, idea3, idea4, idea5]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
return None
|
568 |
try:
|
569 |
+
message = (
|
570 |
+
[
|
571 |
+
prompt[0][0](),
|
572 |
+
prompt[0][0](
|
573 |
+
idea1=idea1, idea2=idea2, idea3=idea3, idea4=idea4, idea5=idea5
|
574 |
+
),
|
575 |
+
],
|
576 |
)
|
|
|
577 |
response = self.generator.create(
|
578 |
messages=message,
|
579 |
)
|
|
|
584 |
return result
|
585 |
|
586 |
def compare_all(self, idea1: str, idea2: str) -> str:
|
587 |
+
prompt = get_prompt()
|
588 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
if idea1 is None or idea2 is None:
|
590 |
return None
|
591 |
try:
|
592 |
+
message = (
|
593 |
+
[
|
594 |
+
prompt[0][0](),
|
595 |
+
prompt[0][0](
|
596 |
+
idea1=idea1,
|
597 |
+
idea2=idea2,
|
598 |
+
),
|
599 |
+
],
|
600 |
+
)
|
601 |
response = self.generator.create(
|
602 |
messages=message,
|
603 |
)
|
|
|
608 |
return result
|
609 |
|
610 |
def compare_novelty_and_feasibility(self, idea1: str, idea2: str) -> str:
|
611 |
+
prompt = get_prompt()
|
612 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
if idea1 is None or idea2 is None:
|
614 |
return None
|
615 |
try:
|
616 |
+
message = (
|
617 |
+
[
|
618 |
+
prompt[0][0](),
|
619 |
+
prompt[0][0](
|
620 |
+
idea1=idea1,
|
621 |
+
idea2=idea2,
|
622 |
+
),
|
623 |
+
],
|
624 |
+
)
|
625 |
response = self.generator.create(
|
626 |
messages=message,
|
627 |
)
|
|
|
632 |
return result
|
633 |
|
634 |
def compare_novelty(self, idea1: str, idea2: str) -> str:
|
635 |
+
prompt = get_prompt()
|
636 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
if idea1 is None or idea2 is None:
|
638 |
return None
|
639 |
try:
|
640 |
+
message = (
|
641 |
+
[
|
642 |
+
prompt[0][0](),
|
643 |
+
prompt[0][0](
|
644 |
+
idea1=idea1,
|
645 |
+
idea2=idea2,
|
646 |
+
),
|
647 |
+
],
|
648 |
+
)
|
649 |
response = self.generator.create(
|
650 |
messages=message,
|
651 |
)
|
|
|
656 |
return result
|
657 |
|
658 |
def compare_feasibility(self, idea1: str, idea2: str) -> str:
|
659 |
+
prompt = get_prompt()
|
660 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
if idea1 is None or idea2 is None:
|
662 |
return None
|
663 |
try:
|
664 |
+
message = (
|
665 |
+
[
|
666 |
+
prompt[0][0](),
|
667 |
+
prompt[0][0](
|
668 |
+
idea1=idea1,
|
669 |
+
idea2=idea2,
|
670 |
+
),
|
671 |
+
],
|
672 |
+
)
|
673 |
response = self.generator.create(
|
674 |
messages=message,
|
675 |
)
|
src/utils/path_pool.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
r"""_summary_
|
2 |
+
-*- coding: utf-8 -*-
|
3 |
+
|
4 |
+
Module : utils.path_pool
|
5 |
+
|
6 |
+
File Name : path_pool.py
|
7 |
+
|
8 |
+
Description : paths
|
9 |
+
|
10 |
+
Creation Date : 2024-11-09
|
11 |
+
|
12 |
+
Author : Frank Kang([email protected])
|
13 |
+
"""
|
14 |
+
from config.utils import get_dir
|
15 |
+
|
16 |
+
PROMPT_DIR = get_dir('./assets/prompt')
|