Spaces:
Sleeping
Sleeping
File size: 1,340 Bytes
c49f0b0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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
|