チャットボットのロールプレイ・プロンプト

OpenAI API で学ぶプロンプトエンジニアリング

Fouad Trad

Machine Learning Engineer

ロールプレイ・プロンプト

  • チャットボットに特定の役割を与える
  • チャットボット=舞台の役者
  • 役割に合わせて応答を調整
  • 役柄に合う言葉づかいと内容
  • やり取りがより効果的に

 

ロールプレイを表す仮面や変装の画像。

OpenAI API で学ぶプロンプトエンジニアリング

ロールプレイ例

【質問】御社の製品Xの技術仕様を教えていただけますか。

ユーザーと3人(カスタマーサポート、プロジェクトマネージャー、セールスエンジニア)を表す画像

OpenAI API で学ぶプロンプトエンジニアリング

ロールプレイ例

【質問】御社の製品Xの技術仕様を教えていただけますか。

ユーザーと3人(カスタマーサポート、プロジェクトマネージャー、セールスエンジニア)を表す画像

OpenAI API で学ぶプロンプトエンジニアリング

ロールプレイ例

【質問】御社の製品Xの技術仕様を教えていただけますか。

ユーザーと3人(カスタマーサポート、プロジェクトマネージャー、セールスエンジニア)を表す画像

OpenAI API で学ぶプロンプトエンジニアリング

カスタマーサポート担当者

カスタマーサポート担当者の画像。

  • 案内を提供
  • 公式サイトへ誘導
  • 支援を提供
OpenAI API で学ぶプロンプトエンジニアリング

プロダクトマネージャー

  • 戦略的な利点を強調
  • 製品との整合に注力

プロダクトマネージャーの画像。

OpenAI API で学ぶプロンプトエンジニアリング

セールスエンジニア

  • 技術的な要点に注力
    • プロセッサ
    • 機能
    • セキュリティ

セールスエンジニアの画像。

OpenAI API で学ぶプロンプトエンジニアリング

ロールプレイ・プロンプト

  • モデルに特定の役割振る舞うよう指示する
system_prompt = "Act as an expert financial analyst."

user_prompt = "Offer insights into retirement planning for individuals approaching retirement age." print(get_response(system_response, user_response))
OpenAI API で学ぶプロンプトエンジニアリング

金融アナリスト(専門家)

Proper retirement planning is crucial to ensure a comfortable and financially stable retirement. Here are some key
considerations:

- Evaluate Your Financial Position: Begin by assessing your current financial situation [...]
- Set Retirement Goals: Determine your retirement goals and lifestyle preferences [...]
- Estimate Retirement Expenses: Project your retirement expenses by categorizing them into essential [...]
[...]

Remember, retirement planning is a complex process, and everyone's situation is unique. 
It's advisable to work with a certified financial planner who can provide personalized advice based on 
your individual needs and goals.
OpenAI API で学ぶプロンプトエンジニアリング

より効果的なロールプレイ

  • 役割内の具体要件を指定
  • 性格や専門性などの特性を付与
system_prompt = "Act as a seasoned technology journalist covering the latest trends 
in the tech industry. You're known for your thorough research and insightful analysis."

user_prompt = "What is the impact of artificial intelligence on job markets?" print(get_response(system_response, user_response))
OpenAI API で学ぶプロンプトエンジニアリング

テクノロジージャーナリスト

Title: "Navigating the New Normal: How Artificial Intelligence is Reshaping Job Markets"

As the technological landscape continues to evolve at an unprecedented pace, one of the most 
significant transformations we're witnessing is the integration of Artificial Intelligence 
(AI) into various industries [...].

While AI's potential to streamline processes [...]. Let's explore the multifaceted impact 
of AI on employment...

1. Automation and Job Displacement: [...]
2. Augmentation and Enhanced Creativity: [...]
[...]

In conclusion, the impact of AI on job markets is undeniable, reshaping traditional roles 
and paving the way for novel opportunities [...]
OpenAI API で学ぶプロンプトエンジニアリング

要件付きロールプレイ

  • ロールプレイのプロンプトに、応答方針や振る舞いを指定できる
system_prompt = "Act as a seasoned technology journalist covering the latest trends 
in the tech industry. You're known for your in-depth research and insightful analysis."






OpenAI API で学ぶプロンプトエンジニアリング

要件付きロールプレイ

  • ロールプレイのプロンプトに、応答方針や振る舞いを指定できる。
system_prompt = "Act as a seasoned technology journalist covering the latest trends 
in the tech industry. You're known for your in-depth research and insightful analysis.
If the question is related to tech, you answer to the best of your knowledge.
Otherwise, you just respond with 'I am trained to only discuss technology topics."

user_prompt = "Which American literature books do you recommend?" print(get_response(system_prompt, user_prompt))
I am trained to only discuss technology topics.
OpenAI API で学ぶプロンプトエンジニアリング

練習しましょう!

OpenAI API で学ぶプロンプトエンジニアリング

Preparing Video For Download...