Spaces:
Runtime error
Runtime error
Update funtions.py
Browse files- funtions.py +14 -14
funtions.py
CHANGED
|
@@ -18,7 +18,7 @@ def call_llm(prompt):
|
|
| 18 |
search_response = exa.search_and_contents(query=prompt, highlights=highlights_options, num_results=3, use_autoprompt=True)
|
| 19 |
info = [sr.highlights[0] for sr in search_response.results]
|
| 20 |
|
| 21 |
-
system_prompt = "You are an academic PhD proposal generator.
|
| 22 |
user_prompt = f"Sources: {info}\nResearch Prompt: {prompt}"
|
| 23 |
|
| 24 |
completion = client.chat.completions.create(
|
|
@@ -38,14 +38,14 @@ def generate_executive_summary(data):
|
|
| 38 |
Research Question: {data["research_question"]}
|
| 39 |
Objectives: {data["objectives"]}
|
| 40 |
Methodology: {data["methodology"]}
|
| 41 |
-
|
| 42 |
Literature Gap: {data["literature_gap"]}
|
| 43 |
|
| 44 |
-
The summary should highlight the research problem,
|
| 45 |
"""
|
| 46 |
return call_llm(prompt)
|
| 47 |
|
| 48 |
-
def
|
| 49 |
prompt = f"""
|
| 50 |
Generate a structured outline for the literature review of a PhD thesis on the following topic:
|
| 51 |
|
|
@@ -54,11 +54,11 @@ def generate_literature_review(data):
|
|
| 54 |
Recent Developments: {data["recent_developments"]}
|
| 55 |
Gaps in Literature: {data["literature_gap"]}
|
| 56 |
|
| 57 |
-
The
|
| 58 |
"""
|
| 59 |
return call_llm(prompt)
|
| 60 |
|
| 61 |
-
def
|
| 62 |
prompt = f"""
|
| 63 |
Write a detailed research methodology section for a PhD proposal based on the following:
|
| 64 |
|
|
@@ -67,7 +67,7 @@ def generate_methodology(data):
|
|
| 67 |
Data Analysis Methods: {data["data_analysis"]}
|
| 68 |
Justification: {data["justification"]}
|
| 69 |
|
| 70 |
-
The methodology should
|
| 71 |
"""
|
| 72 |
return call_llm(prompt)
|
| 73 |
|
|
@@ -89,7 +89,7 @@ def generate_hypotheses(data):
|
|
| 89 |
Research Topic: {data["research_topic"]}
|
| 90 |
Research Question: {data["research_question"]}
|
| 91 |
|
| 92 |
-
The hypotheses should clearly predict expected outcomes
|
| 93 |
"""
|
| 94 |
return call_llm(prompt)
|
| 95 |
|
|
@@ -98,9 +98,9 @@ def generate_contribution_statement(data):
|
|
| 98 |
Generate a statement of contribution for the following PhD research proposal:
|
| 99 |
|
| 100 |
Research Topic: {data["research_topic"]}
|
| 101 |
-
|
| 102 |
|
| 103 |
-
The statement should
|
| 104 |
"""
|
| 105 |
return call_llm(prompt)
|
| 106 |
|
|
@@ -111,7 +111,7 @@ def generate_research_timeline(data):
|
|
| 111 |
Research Topic: {data["research_topic"]}
|
| 112 |
Total Timeframe: {data["total_timeframe"]}
|
| 113 |
|
| 114 |
-
The timeline should break down tasks into phases
|
| 115 |
"""
|
| 116 |
return call_llm(prompt)
|
| 117 |
|
|
@@ -133,7 +133,7 @@ def generate_limitations_section(data):
|
|
| 133 |
Research Topic: {data["research_topic"]}
|
| 134 |
Methodology: {data["methodology"]}
|
| 135 |
|
| 136 |
-
The limitations should
|
| 137 |
"""
|
| 138 |
return call_llm(prompt)
|
| 139 |
|
|
@@ -142,9 +142,9 @@ def generate_future_work_section(data):
|
|
| 142 |
Generate a section on future work based on the following research:
|
| 143 |
|
| 144 |
Research Topic: {data["research_topic"]}
|
| 145 |
-
|
| 146 |
|
| 147 |
-
The future work section should suggest further areas for research
|
| 148 |
"""
|
| 149 |
return call_llm(prompt)
|
| 150 |
|
|
|
|
| 18 |
search_response = exa.search_and_contents(query=prompt, highlights=highlights_options, num_results=3, use_autoprompt=True)
|
| 19 |
info = [sr.highlights[0] for sr in search_response.results]
|
| 20 |
|
| 21 |
+
system_prompt = "You are an academic PhD proposal generator. Read the provided contexts and, if relevant, use them to generate a well-structured research proposal."
|
| 22 |
user_prompt = f"Sources: {info}\nResearch Prompt: {prompt}"
|
| 23 |
|
| 24 |
completion = client.chat.completions.create(
|
|
|
|
| 38 |
Research Question: {data["research_question"]}
|
| 39 |
Objectives: {data["objectives"]}
|
| 40 |
Methodology: {data["methodology"]}
|
| 41 |
+
Contribution to the Field: {data["contribution"]}
|
| 42 |
Literature Gap: {data["literature_gap"]}
|
| 43 |
|
| 44 |
+
The summary should highlight the research problem, its significance, the approach, and expected contributions.
|
| 45 |
"""
|
| 46 |
return call_llm(prompt)
|
| 47 |
|
| 48 |
+
def generate_literature_review_outline(data):
|
| 49 |
prompt = f"""
|
| 50 |
Generate a structured outline for the literature review of a PhD thesis on the following topic:
|
| 51 |
|
|
|
|
| 54 |
Recent Developments: {data["recent_developments"]}
|
| 55 |
Gaps in Literature: {data["literature_gap"]}
|
| 56 |
|
| 57 |
+
The outline should cover key themes, debates, and the relevance of existing work to the proposed research.
|
| 58 |
"""
|
| 59 |
return call_llm(prompt)
|
| 60 |
|
| 61 |
+
def generate_methodology_section(data):
|
| 62 |
prompt = f"""
|
| 63 |
Write a detailed research methodology section for a PhD proposal based on the following:
|
| 64 |
|
|
|
|
| 67 |
Data Analysis Methods: {data["data_analysis"]}
|
| 68 |
Justification: {data["justification"]}
|
| 69 |
|
| 70 |
+
The methodology should demonstrate how the research will be conducted reliably and validly.
|
| 71 |
"""
|
| 72 |
return call_llm(prompt)
|
| 73 |
|
|
|
|
| 89 |
Research Topic: {data["research_topic"]}
|
| 90 |
Research Question: {data["research_question"]}
|
| 91 |
|
| 92 |
+
The hypotheses should clearly predict expected outcomes based on theoretical foundations.
|
| 93 |
"""
|
| 94 |
return call_llm(prompt)
|
| 95 |
|
|
|
|
| 98 |
Generate a statement of contribution for the following PhD research proposal:
|
| 99 |
|
| 100 |
Research Topic: {data["research_topic"]}
|
| 101 |
+
Contribution to the Field: {data["contribution"]}
|
| 102 |
|
| 103 |
+
The statement should highlight how the research will address existing gaps and advance knowledge in the field.
|
| 104 |
"""
|
| 105 |
return call_llm(prompt)
|
| 106 |
|
|
|
|
| 111 |
Research Topic: {data["research_topic"]}
|
| 112 |
Total Timeframe: {data["total_timeframe"]}
|
| 113 |
|
| 114 |
+
The timeline should break down tasks into manageable phases (e.g., literature review, data collection, analysis) with deadlines.
|
| 115 |
"""
|
| 116 |
return call_llm(prompt)
|
| 117 |
|
|
|
|
| 133 |
Research Topic: {data["research_topic"]}
|
| 134 |
Methodology: {data["methodology"]}
|
| 135 |
|
| 136 |
+
The limitations should address possible obstacles and suggest ways to mitigate them.
|
| 137 |
"""
|
| 138 |
return call_llm(prompt)
|
| 139 |
|
|
|
|
| 142 |
Generate a section on future work based on the following research:
|
| 143 |
|
| 144 |
Research Topic: {data["research_topic"]}
|
| 145 |
+
Contribution: {data["contribution"]}
|
| 146 |
|
| 147 |
+
The future work section should suggest further areas for research that could build upon the findings.
|
| 148 |
"""
|
| 149 |
return call_llm(prompt)
|
| 150 |
|