SLM-RAG-Arena / utils /prompts.py
aizip-dev's picture
Update utils/prompts.py
744afcc verified
raw
history blame
588 Bytes
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