Spaces:
Sleeping
Sleeping
def generate_multi_doc_context(context_group): | |
multi_doc_text = "" | |
for context_text, year, quarter, ticker in context_group: | |
print((context_text, year, quarter, ticker)) | |
if context_text == "": | |
break | |
else: | |
multi_doc_text = ( | |
multi_doc_text | |
+ "\n" | |
+ f"Source: {quarter} {ticker} Earnings Call {year}" | |
+ "\n" | |
+ context_text | |
) | |
return multi_doc_text | |
def generate_prompt_alpaca_style(query_text, context): | |
prompt = f"""Below is an instruction that describes a task, paired with an input that provides further context. Use the following guidelines to write a response that that appropriately completes the request: | |
### Instruction: | |
- Write a detailed paragraph consisting of exactly five complete sentences that answer the question based on the provided context. | |
- Focus on addressing the specific question posed, providing as much relevant information and detail as possible. | |
- Only use details from the provided context that directly address the question; do not include any additional information that is not explicitly stated. | |
- Aim to provide a clear and concise summary that fully addresses the question. | |
Question: {query_text} | |
Context: {context} | |
### Response:""" | |
return prompt | |