[ChatStream] Rakuten/RakutenAI-7B-chat用の ChatPrompt

[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


Read more

【AI×CAD 第5回】CADだけでは伝わらない「なぜ」を残す。設計知の伝承をローカルLLMで始めるための考え方

【AI×CAD 第5回】CADだけでは伝わらない「なぜ」を残す。設計知の伝承をローカルLLMで始めるための考え方

CADには最終的に「何を作ったか」は残るのに、その形にした「なぜ」は形状だけからは分かりません。幾何の事実から問いを立てて設計者に答えてもらい、形状と判断理由を一緒に残す。変更前後の比較も使いながら、設計知の伝承とローカルLLMの活用を業務から考えます。

By Qualiteg コンサルティング