Update pages/Report_Writer.py
Browse files- pages/Report_Writer.py +48 -1
pages/Report_Writer.py
CHANGED
|
@@ -14,9 +14,56 @@ from llama_index.core.node_parser import TokenTextSplitter
|
|
| 14 |
|
| 15 |
# Configure Google Gemini
|
| 16 |
Settings.embed_model = FastEmbedEmbedding(model_name="BAAI/bge-small-en-v1.5")
|
| 17 |
-
Settings.llm = Gemini(api_key=os.getenv("GOOGLE_API_KEY"), temperature=0.
|
| 18 |
llm = Gemini(api_key=os.getenv("GOOGLE_API_KEY"), temperature=0.1, model_name="models/gemini-pro")
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Load and index the input data
|
| 21 |
def load_data(document_text):
|
| 22 |
# Use a text splitter to break the document into smaller chunks
|
|
|
|
| 14 |
|
| 15 |
# Configure Google Gemini
|
| 16 |
Settings.embed_model = FastEmbedEmbedding(model_name="BAAI/bge-small-en-v1.5")
|
| 17 |
+
Settings.llm = Gemini(api_key=os.getenv("GOOGLE_API_KEY"), temperature=0.1, model_name="models/gemini-pro")
|
| 18 |
llm = Gemini(api_key=os.getenv("GOOGLE_API_KEY"), temperature=0.1, model_name="models/gemini-pro")
|
| 19 |
|
| 20 |
+
DEFAULT_REPORT_FORMAT = """
|
| 21 |
+
Title Page
|
| 22 |
+
|
| 23 |
+
Includes the report title, author's name, and date.
|
| 24 |
+
|
| 25 |
+
Abstract
|
| 26 |
+
|
| 27 |
+
A concise summary of the report, covering the background, objectives, methodology, key findings, and conclusions.
|
| 28 |
+
|
| 29 |
+
Table of Contents
|
| 30 |
+
|
| 31 |
+
Lists sections and subsections with corresponding page numbers for easy navigation.
|
| 32 |
+
|
| 33 |
+
Introduction
|
| 34 |
+
|
| 35 |
+
Provides background information, defines the scope of the report, and states the objectives.
|
| 36 |
+
|
| 37 |
+
Literature Review
|
| 38 |
+
|
| 39 |
+
Reviews relevant literature and previous research related to the report topic.
|
| 40 |
+
|
| 41 |
+
Methodology/Approach
|
| 42 |
+
|
| 43 |
+
Details the methods used to gather data or conduct experiments, including design and analytical techniques.
|
| 44 |
+
|
| 45 |
+
Results and Discussion
|
| 46 |
+
|
| 47 |
+
Presents findings in a clear format, often using tables, figures, and charts, followed by a discussion interpreting these results.
|
| 48 |
+
|
| 49 |
+
Conclusions
|
| 50 |
+
|
| 51 |
+
Summarizes the main findings and their implications, often linking back to the report's objectives.
|
| 52 |
+
|
| 53 |
+
Recommendations
|
| 54 |
+
|
| 55 |
+
Suggests actions based on the findings, highlighting potential future work or improvements.
|
| 56 |
+
|
| 57 |
+
References
|
| 58 |
+
|
| 59 |
+
Lists all sources cited in the report, adhering to a specific referencing style.
|
| 60 |
+
|
| 61 |
+
Appendices
|
| 62 |
+
|
| 63 |
+
Contains supplementary material that supports the main text, such as raw data, detailed calculations, or additional figures.
|
| 64 |
+
|
| 65 |
+
"""
|
| 66 |
+
|
| 67 |
# Load and index the input data
|
| 68 |
def load_data(document_text):
|
| 69 |
# Use a text splitter to break the document into smaller chunks
|