[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

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

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

まず結論 2026年11月23日時点のLLMランキング 日本語対応LLMランキングの2026年11月23日版です。前置きは後回しにして、まず最新のランキングからお見せします。 フロンティアモデルの最新ランキング TOP20(Epoch Capabilities Index) フロンティアモデル TOP20Epoch Capabilities Index(総合能力の指数) 2026年11月23日更新1Claude Fable 5.2NEWAnthropic API 公開 11/09ECIが初めて170を超えた、新しい首位173.42GPT-6.2 AstraNEWOpenAI API 公開 11/17首位と約0.6ポイント差。ほぼ並ぶ2位172.83Gemini 4 CarbonNEWGoogle API 公開 11/10前回首位の2本を抜いて3位に169.74GPT-6 AstraOpenAI API 公開 09/03169.25Claude Opus 5.5Anthropic

By Qualiteg プロダクト開発部
GPT-6.2 Astra・Sol 完全ガイド モデル仕様とAPI料金・Claude/Gemini比較・Codex運用ポイント

GPT-6.2 Astra・Sol 完全ガイド モデル仕様とAPI料金・Claude/Gemini比較・Codex運用ポイント

GPT-6.2 Astra・Solの完全ガイド。Astraは前作より20%安い単価で独立評価の総合指数を5ポイント上げ、Solは価格据え置きで前作のAstraの水準に届きました。API料金と公表ベンチマーク、Claude・Gemini 4との価格と性能の比較、履歴を書き換えない作りへの移行、ChatGPT WorkとCodexでの使い方をまとめます。

By Qualiteg プロダクト開発部
Gemini 4 Neon・Carbon・Hydrogen・Argon 完全ガイド 4モデルの違いとAPI料金・他社モデルとの比較

Gemini 4 Neon・Carbon・Hydrogen・Argon 完全ガイド 4モデルの違いとAPI料金・他社モデルとの比較

Gemini 4 Neon・Carbon・Hydrogen・Argonの完全ガイド。11月18日に加わったNeonを含む4モデルの関係と選び方、12月1日からのAPI料金、Google公表ベンチマークと独立評価、LLMランキングのデータも使ったGPT-6.2・Claudeとの多角的な比較、思考レベルやlong decodeなどAPI移行の要点、GeminiアプリとAntigravityでの使い方をまとめました。

By Qualiteg プロダクト開発部