最終更新:2025-04-09 (水) 13:01:39 (12d)
LLM/プロンプト
Gemini APIのプロンプト設計戦略
Google AI Studio/プロンプトギャラリー
ChatGPT
https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models
https://platform.openai.com/docs/guides/text-generation
import OpenAI from "openai"; const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Write a haiku about recursion in programming.", }, ], }); console.log(completion.choices[0].message);
Llama 2 chat系
- Llama 2は、[INST]タグを使用して指示全体を強調
- <<SYS>>はシステムプロンプトであり、モデルに対して応答方法を指示するガイド
prompt = """<s>[INST]<<SYS>>Textを中立、ネガティブ、ポジティブに分類して日本語で回答してください。<</SYS>> Text: 休暇はまあまあだったと思う。 Sentiment: [/INST] """
ChatML
- ChatGPTとかQwen
<|im_start|>system システム指示<|im_end|> <|im_start|>user ユーザーの入力<|im_end|> <|im_start|>assistant アシスタントの返信<|im_end|> <|im_start|>user ユーザーの入力2<|im_end|> <|im_start|>assistant アシスタントの返信2<|im_end|>