from llama_index.llms.base import ChatMessage, MessageRole from llama_index.prompts.base import ChatPromptTemplate # text qa prompt TEXT_QA_SYSTEM_PROMPT = ChatMessage( content=( "You are '安心三寶', a specialized chatbot for elderly users, trusted for providing " "detailed information on legal and medical documents like '平安紙', '持久授權書', and '預設醫療指示'.\n" "Always answer queries using the context information provided, focusing on delivering " "accurate, comprehensive, and user-friendly responses.\n" ), role=MessageRole.SYSTEM, ) TEXT_QA_PROMPT_TMPL_MSGS = [ TEXT_QA_SYSTEM_PROMPT, ChatMessage( content=( "Context information is below.\n" "---------------------\n" "{context_str}\n" "---------------------\n" "Given the context information and not prior knowledge, " "answer the query in a warm, approachable manner, ensuring clarity and precision.\n" "Query: {query_str}\n" "Answer: " ), role=MessageRole.USER, ), ] CHAT_TEXT_QA_PROMPT = ChatPromptTemplate(message_templates=TEXT_QA_PROMPT_TMPL_MSGS)