Update functions.py
Browse files- functions.py +42 -13
functions.py
CHANGED
|
@@ -15,9 +15,10 @@ highlights_options = {
|
|
| 15 |
"highlights_per_url": 1, # Get the best highlight for each URL
|
| 16 |
}
|
| 17 |
|
|
|
|
| 18 |
def get_report_fields(report_type):
|
| 19 |
"""
|
| 20 |
-
Return a list of fields (field_key, field_label) based on the report type.
|
| 21 |
"""
|
| 22 |
common_fields = [
|
| 23 |
("research_topic", "Research Topic"),
|
|
@@ -29,23 +30,51 @@ def get_report_fields(report_type):
|
|
| 29 |
]
|
| 30 |
|
| 31 |
if report_type == "PhD Proposal":
|
| 32 |
-
return common_fields + [
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
]
|
| 36 |
elif report_type == "Research Paper":
|
| 37 |
-
return common_fields + [
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
]
|
| 41 |
elif report_type == "Thesis":
|
| 42 |
-
return common_fields + [
|
| 43 |
-
|
| 44 |
-
("limitations", "Limitations")
|
| 45 |
-
]
|
| 46 |
|
| 47 |
return common_fields
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
|
|
|
|
|
|
| 49 |
def call_llm(prompt):
|
| 50 |
"""
|
| 51 |
Call the Exa and Groq APIs to generate content using the provided prompt.
|
|
|
|
| 15 |
"highlights_per_url": 1, # Get the best highlight for each URL
|
| 16 |
}
|
| 17 |
|
| 18 |
+
|
| 19 |
def get_report_fields(report_type):
|
| 20 |
"""
|
| 21 |
+
Return a list of fields (tuples of field_key, field_label) based on the report type.
|
| 22 |
"""
|
| 23 |
common_fields = [
|
| 24 |
("research_topic", "Research Topic"),
|
|
|
|
| 30 |
]
|
| 31 |
|
| 32 |
if report_type == "PhD Proposal":
|
| 33 |
+
return common_fields + [("justification", "Justification for Methodology"),
|
| 34 |
+
("literature_gap", "Literature Gap")]
|
| 35 |
+
|
|
|
|
| 36 |
elif report_type == "Research Paper":
|
| 37 |
+
return common_fields + [("introduction", "Introduction"),
|
| 38 |
+
("conclusion", "Conclusion")]
|
| 39 |
+
|
|
|
|
| 40 |
elif report_type == "Thesis":
|
| 41 |
+
return common_fields + [("abstract", "Abstract"),
|
| 42 |
+
("limitations", "Limitations")]
|
|
|
|
|
|
|
| 43 |
|
| 44 |
return common_fields
|
| 45 |
+
|
| 46 |
+
def get_report_sections(report_type):
|
| 47 |
+
"""
|
| 48 |
+
Return a dictionary mapping section names to corresponding functions based on report type.
|
| 49 |
+
"""
|
| 50 |
+
report_sections = {
|
| 51 |
+
"PhD Proposal": [
|
| 52 |
+
("Executive Summary", "generate_executive_summary"),
|
| 53 |
+
("Research Objectives", "generate_research_objectives"),
|
| 54 |
+
("Research Methodology", "generate_methodology_section"),
|
| 55 |
+
("Research Timeline", "generate_research_timeline")
|
| 56 |
+
],
|
| 57 |
+
"Research Paper": [
|
| 58 |
+
("Introduction", "generate_proposal_introduction"),
|
| 59 |
+
("Literature Review", "generate_literature_review_outline"),
|
| 60 |
+
("Research Methodology", "generate_methodology_section"),
|
| 61 |
+
("Conclusion", "generate_contribution_statement")
|
| 62 |
+
],
|
| 63 |
+
"Thesis": [
|
| 64 |
+
("Abstract", "generate_proposal_introduction"),
|
| 65 |
+
("Research Objectives", "generate_research_objectives"),
|
| 66 |
+
("Methodology", "generate_methodology_section"),
|
| 67 |
+
("Limitations", "generate_limitations_section")
|
| 68 |
+
]
|
| 69 |
+
}
|
| 70 |
+
return report_sections.get(report_type, [])
|
| 71 |
+
|
| 72 |
+
# Define the actual generation functions, like:
|
| 73 |
+
def generate_executive_summary(data):
|
| 74 |
+
return f"Executive Summary for {data['research_topic']}"
|
| 75 |
|
| 76 |
+
# Add other report generation functions similar to this
|
| 77 |
+
|
| 78 |
def call_llm(prompt):
|
| 79 |
"""
|
| 80 |
Call the Exa and Groq APIs to generate content using the provided prompt.
|