聊天機器人的角色扮演提示

使用 OpenAI API 的提示工程

Fouad Trad

Machine Learning Engineer

角色扮演提示

  • 指定聊天機器人扮演特定角色
  • Chatbot → 戲劇中的演員
  • Chatbot 會調整以符合角色
  • 語言與內容配合該人設
  • 互動更有效

 

顯示各種面具與偽裝以呈現角色扮演的圖像。

使用 OpenAI API 的提示工程

角色扮演範例

問題: 你能提供貴公司所提供的 Product X 的技術規格嗎?

顯示使用者與三位角色(客服、專案經理、銷售工程師)的圖像

使用 OpenAI API 的提示工程

角色扮演範例

問題: 你能提供貴公司所提供的 Product X 的技術規格嗎?

顯示使用者與三位角色(客服、專案經理、銷售工程師)的圖像

使用 OpenAI API 的提示工程

角色扮演範例

問題: 你能提供貴公司所提供的 Product X 的技術規格嗎?

顯示使用者與三位角色(客服、專案經理、銷售工程師)的圖像

使用 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...