[ChatStream] Rakuten/RakutenAI-7B-chat用の ChatPrompt
    昨日発表された Rakuten/RakutenAI-7B-chat 用の ChatPrompt をご紹介します
from chatstream import AbstractChatPrompt
SYSTEM_PROMPT = """\
A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. \
"""
class ChatPromptRakutenMistral(AbstractChatPrompt):
    def __init__(self):
        super().__init__()  # Call the initialization of the base class
        self.set_system(f"{SYSTEM_PROMPT}")
        self.set_requester("USER")
        self.set_responder("ASSISTANT")
    def get_stop_strs(self):
        if not self.chat_mode:
            return None
        return []
    def get_replacement_when_input(self):
        return None
    def get_replacement_when_output(self):  # replace when response_text gotten
        return None
    def create_prompt(self, opts={}):
        if self.chat_mode == False:
            return self.get_requester_last_msg()
        # Chat Mode == True の場合のプロンプトを構築する
        ret = self.system
        for chat_content in self.get_contents(opts):
            chat_content_role = chat_content.get_role()
            chat_content_role_type = chat_content.get_role_type()
            chat_content_message = chat_content.get_message()
            if chat_content_role:
                if chat_content_message:
                    merged_message = chat_content_role + ": " + chat_content_message + " "
                else:
                    merged_message = chat_content_role + ":"
                ret += merged_message
        return ret
    async def build_initial_prompt(self, chat_prompt):
        # 初期プロンプトは実装しない
        pass