[ChatStream] meta-llama/Meta-Llama-3-8B-Instruct 用の ChatPromptクラス

[ChatStream] meta-llama/Meta-Llama-3-8B-Instruct 用の ChatPromptクラス

昨日(2024/4/19) に発表になった Llama3 用の ChatPrompt クラス※をご紹介します。

from chatstream import AbstractChatPrompt

SYSTEM_PROMPT = """\
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\
"""


class ChatPromptMetaLlamaLlama3Instruct(AbstractChatPrompt):
    """
    meta-llama/Meta-Llama-3-8B-Instruct

    Prompt Guide from
    https://huggingface.co/blog/llama3
    """

    def __init__(self):
        super().__init__()
        self.set_requester("user")
        self.set_responder("assistant")

    def is_skip_special_token(self):
        return False

    def get_stop_strs(self):
        if not self.chat_mode:
            return None
        return ['<|eot_id|>']

    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 = f"<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{self.system}<|eot_id|>"

        merged_message = ""
        for chat_content in self.get_contents(opts):

            chat_content_role = chat_content.get_role()
            chat_content_message = chat_content.get_message()

            if chat_content_role:

                if chat_content_message:
                    merged_message = f"<|start_header_id|>{chat_content_role}<|end_header_id|>\n\n{chat_content_message}<|eot_id|>"
                else:
                    merged_message = f"<|start_header_id|>{chat_content_role}<|end_header_id|>\n\n"

                ret += merged_message
        return ret

※ChatStream ご利用のお客様は、最新の ChatStream にも取り込まれておりますが、手動で対応したい場合は上のクラスをご利用ください


Read more

【AI×CAD 第3回】「この形、抜けません」を設計中に知る。金型DFM(抜き勾配・アンダーカット・肉厚)をブラウザで自動チェック

【AI×CAD 第3回】「この形、抜けません」を設計中に知る。金型DFM(抜き勾配・アンダーカット・肉厚)をブラウザで自動チェック

抜き勾配・アンダーカット・局所的な肉厚の要注意箇所は、型開き方向を決めれば形状から機械的に一次チェックできます。わざと不良を仕込んだ樹脂ケースでCADASの金型DFMを実走し、要勾配11.8%・アンダーカット0.2%(横穴のみ)・肉厚中央値2.00mmが出るまでと、その判定の仕組みを解説します。

By Qualiteg コンサルティング
Claude Codeで急にgrepが承認待ちになる v2.1.259でRead denyルールがBashのgrepにも効くようになった

Claude Codeで急にgrepが承認待ちになる v2.1.259でRead denyルールがBashのgrepにも効くようになった

Claude Code を bypassPermissions で走らせているのに、今日から grep -r が承認待ちで止まるようになった。原因は 2026年9月2日リリースの v2.1.259 で、settings.json の Read deny ルールが Bash の grep にも当たるようになったこと。前日の v2.1.258 と並べて実測し、通る書き方と通らない書き方を表にまとめました。

By Qualiteg プロダクト開発部
日本語対応 LLMランキング2026 ~ベンチマーク分析レポート~(9月1日版)

日本語対応 LLMランキング2026 ~ベンチマーク分析レポート~(9月1日版)

はじめに 本レポートは、Nejumi Leaderboard 4のベンチマークデータ(2026/9/1版)に基づいて、日本語対応LLMの性能を総合的に分析したものです。 前回は 2026/7/10 版の分析レポート を公開しましたが、わずか2か月弱で首位が入れ替わり、 オープンモデルが総合3位に食い込む激アツの回となりました! (定期的に最新LLMランキングを更新してまいります。当社のX(旧Twitter)をフォローいただくことで更新情報を受け取り可能です) Nejumi Leaderboard 4は、日本語タスクにおけるLLMの性能を多角的に評価する信頼性の高いベンチマークとして知られています。汎用的言語性能(GLP)とアラインメント(ALT)の2軸で構成され、翻訳・要約・推論・コーディングから毒性・バイアス・真実性まで、幅広い観点をカバーしているのが特徴です。 本分析では、商用APIモデルとオープンモデルの両方を対象に、それぞれの特徴や傾向を詳しく見ていきます。 まず、今回の3大トピックを先にご紹介します。 * Claude Opus 5が総合スコア0.8720で

By Qualiteg プロダクト開発部, Qualiteg コンサルティング