Spaces:
Build error
Build error
Upload utils.py
Browse files
utils.py
CHANGED
@@ -115,6 +115,20 @@ def text_lookup(data, sentence_ids):
|
|
115 |
|
116 |
|
117 |
def generate_prompt(query_text, context_list):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
context = " \n\n".join(context_list)
|
119 |
prompt = f"""
|
120 |
Context information is below:
|
@@ -152,11 +166,11 @@ def retrieve_transcript(data, year, quarter, ticker):
|
|
152 |
["File_Name"],
|
153 |
]
|
154 |
.drop_duplicates()
|
155 |
-
.iloc[0,0]
|
156 |
)
|
157 |
print(row)
|
158 |
# convert row to a string and join values with "-"
|
159 |
-
#row_str = "-".join(row.astype(str)) + ".txt"
|
160 |
open_file = open(
|
161 |
f"Transcripts/{ticker}/{row}",
|
162 |
"r",
|
|
|
115 |
|
116 |
|
117 |
def generate_prompt(query_text, context_list):
|
118 |
+
context = " \n\n".join(context_list)
|
119 |
+
prompt = f"""
|
120 |
+
Answer the question as truthfully as possible using the provided text.
|
121 |
+
Try to include as many key details as possible and format the answer in points.
|
122 |
+
|
123 |
+
Context:
|
124 |
+
{context}
|
125 |
+
|
126 |
+
Q: {query_text}
|
127 |
+
A:"""
|
128 |
+
return prompt
|
129 |
+
|
130 |
+
|
131 |
+
def generate_prompt_2(query_text, context_list):
|
132 |
context = " \n\n".join(context_list)
|
133 |
prompt = f"""
|
134 |
Context information is below:
|
|
|
166 |
["File_Name"],
|
167 |
]
|
168 |
.drop_duplicates()
|
169 |
+
.iloc[0, 0]
|
170 |
)
|
171 |
print(row)
|
172 |
# convert row to a string and join values with "-"
|
173 |
+
# row_str = "-".join(row.astype(str)) + ".txt"
|
174 |
open_file = open(
|
175 |
f"Transcripts/{ticker}/{row}",
|
176 |
"r",
|