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

使用 OpenAI API 的 Prompt Engineering

Fouad Trad

Machine Learning Engineer

角色扮演提示

  • 要求聊天机器人扮演特定角色
  • 聊天机器人 -> 戏剧中的演员
  • 聊天机器人会调整以匹配角色
  • 语言与内容贴合该人设
  • 互动更高效

 

展示面具与伪装以体现角色扮演的图像。

使用 OpenAI API 的 Prompt Engineering

角色扮演示例

问题: 能提供你们公司产品 X 的技术规格吗?

显示一位用户和三个人,分别代表客服、产品经理和售前工程师。

使用 OpenAI API 的 Prompt Engineering

角色扮演示例

问题: 能提供你们公司产品 X 的技术规格吗?

显示一位用户和三个人,分别代表客服、产品经理和售前工程师。

使用 OpenAI API 的 Prompt Engineering

角色扮演示例

问题: 能提供你们公司产品 X 的技术规格吗?

显示一位用户和三个人,分别代表客服、产品经理和售前工程师。

使用 OpenAI API 的 Prompt Engineering

客服人员

显示客服人员的图像。

  • 提供指导
  • 引导至网站
  • 提供协助
使用 OpenAI API 的 Prompt Engineering

产品经理

  • 突出战略价值
  • 关注产品匹配度

显示产品经理的图像。

使用 OpenAI API 的 Prompt Engineering

售前工程师

  • 聚焦技术细节
    • 处理器
    • 功能
    • 安全性

显示售前工程师的图像。

使用 OpenAI API 的 Prompt Engineering

角色扮演提示

  • 指示模型以特定角色进行"扮演"
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 的 Prompt Engineering

资深金融分析师

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 的 Prompt Engineering

更有效的角色扮演

  • 在角色内加入具体要求
  • 融入个性与专业特质
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 的 Prompt Engineering

科技记者

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 的 Prompt Engineering

带要求的角色扮演

  • 在角色提示中可指定回复准则与行为规范
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 的 Prompt Engineering

带要求的角色扮演

  • 在角色提示中可指定回复准则与行为规范。
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 的 Prompt Engineering

让我们来练习!

使用 OpenAI API 的 Prompt Engineering

Preparing Video For Download...