Spaces:
Running
on
Zero
Running
on
Zero
def format_rag_prompt( query: str, context: str, accepts_sys: bool) -> str: | |
system_prompt = """ | |
Answer this question based on search result. If you CAN NOT answer, please tell me why and ask for clarification for the query. | |
""" | |
user_prompt = f""" | |
Search result: {context} | |
Question: {query} | |
Answer: | |
""" | |
messages = ( | |
[ | |
{"role": "system", "content": system_prompt}, | |
{"role": "user", "content": user_prompt}, | |
] | |
if accepts_sys | |
else [{"role": "user", "content": system_prompt + user_prompt}] | |
) | |
return messages |