MultiAgent进行访谈

目标

我们利用多Agent进行访谈,访谈能够根据预设话题和时间,自动进行访谈提纲生成,访谈和统计汇总。

流程

我们按照功能分成3个Agent,分别是interviewer_outline_agent, interviewer_interactive_agent, interviewer_summary_agent, 分别对应访谈的三个阶段。

每个Agent的主要prompt

Prompt功能明细
一、润色和大纲

  1. touchup(背景润色)
    Prompt:
    Here is an interview background. Please complete it by adding details such as the purpose of the interview, the interviewee, the interview time, etc. The output language should match the language of the interview background.
    interview background:{project_background}
    参数解释:project_background是用户传入的项目背景

  2. 访谈大纲生成
    Please write an appropriate interview outline based on the expected number of questions and topic of the interview. When designing an interview outline, it should progress from simple to difficult and from broad to specific, encouraging the interviewee to share their thoughts and feelings. please generate the outline language by {language}.
    Topic: {project_name}
    Interview requirements: {preset_requirement}
    {project_background}
    Output format should be markdown. Like this:
    # title
    ## subtitle
    - question
    - question
    ## subtitle
    - question
    参数解释: project_name 项目名称, preset_requirement一些预设,如果有的话. project_background访谈的背景

二、进行访谈
3. 访谈的开始(第1个问题)
Now, we’re about to begin an interview centered around the theme of {topic_name}.
The background of this interview is {topic_background}. {interview_style}.
Please introduce yourself name is Chikka, as an Interviewer, then describe the interview topic and background, and finally, following the interview style, pose the first question. Please ask in {language}.
Interview Tip: The current sub-topic is {next_question_title}. The question to be asked to the user is: {next_question_content}.
Output:
参数解释:topic_background访谈背景,interview_style: 访谈的风格, next_question_title: 生成大纲的子标题,next_question_content:子标题下具体的问题的内容
Tips: 访谈的不同阶段,使用不同的提示

  1. 访谈开始询问其他问题
    We are about to begin an interview focused on {topic_name}. The background of this interview is {topic_background}. {interview_style}.Please ask in {language}.
    Previous interview records: {history_context}
    information: current is {current_topic_question_idx} question,talking subtitle is {next_question_title}, Question to be asked:{next_question_content},
    Output:
    参数解释:topic_background访谈背景,interview_style: 访谈的风格, next_question_title: 生成大纲的子标题,next_question_content:子标题下具体的问题的内容, current_topic_question_idx:当前进行到了第几个问题

  2. 访谈的最后一个问题
    We are about to begin an interview focused on {topic_name}. The background of this interview is {topic_background}. {interview_style},We are now in the final stage of the interview, and the interview is about to conclude. Please refer to the user’s previous interview records and the interview prompts below to ask the last interview question. Please ask in {language}.
    Previous interview records: {history_context}
    interview prompts: current is {current_topic_question_idx} question,talking subtitle is {next_question_title}, next question is about {next_question_content},
    The final interview question is:
    参数解释:topic_background访谈背景,interview_style: 访谈的风格, next_question_title: 生成大纲的子标题,next_question_content:子标题下具体的问题的内容, current_topic_question_idx:当前进行到了第几个问题

  3. 深度追问时的prompt
    We are about to begin an interview focused on {topic_name}. The background of this interview is {topic_background}. {interview_style},Please continue the in-depth interview based on the user’s previous interview records and ask the next question.Please ask in {language}.
    Previous interview records: {history_context}
    interview prompts: current is {current_topic_question_idx} question,talking subtitle is {next_question_title},
    Next Question:
    参数解释:topic_background访谈背景,interview_style: 访谈的风格, next_question_title: 生成大纲的子标题,next_question_content:子标题下具体的问题的内容, current_topic_question_idx:当前进行到了第几个问题

三、报告生成
6.报告生成的Abstract开头部分
Below is a transcript of an interview. Please generate a summary for it, and output it in the following format, making sure to use a “Title:” and start with the word ‘Abstract:’.Please output by {language}
transcript: {context}
Title:
Abstract:

参数解释:language是系统设置的语言,context,报告的所有中间部分的输出结果
Tips: 报告的开头和结尾都依赖报告的中间部分,中间的所有子主题都会被先总结。

7.报告的中间部分,大纲的子主题的每个总结
Below is one aspect of an interview record. Now, the aspect dimension’s title, relevant interview questions, and all users’ responses to these questions are provided. Please output by {language}.
aspect dimension’s title: {dimension_title}
interview questions: {questions_text}
all users’ responses: {answers_text}
Please summarize efficiently in the following format,Use headings starting with “Title:” and “Summary:”.
Title:
Summary:
参数解释:dimension_title,大纲中的每个子主题,questions_text该主题下的所有问题,answers_text该主题下所有用户的回答

8.报告的最后部分,报告的总结结果
Below is a transcript of an interview. Please generate a summary for it, Summarize as comprehensively as possible, with no fewer than three paragraphs, and output it in the following format, making sure to use a “Title:” and start with the word ‘Summary:’. Please output by {language}.
transcript: {context}
Title:
Summary:
参数解释:language,用户报告设定的语言,context,报告的所有中间部分的输出结果

四、AI数字人的Prompt

Please read your previous historical conversations first, and then answer the user’s question. Please answer in {language}. history_conversations: {history_context} User’s Question: {user_question} Answer the user’s question:

参数解释:language,用户报告设定的语言,history_context,2轮的对话历史记录, user_question被提出的问题

访谈的不同深度时的不同prompt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
if depth == 0:
description = dedent(f"""
Please formulate the {already_asked_num + 1}th question based on the interview outline below. {question_style}
{questions_strategy}
Outline: {outline}
""")
else:
# 构建QA_records,因为我们depth设置
QA_records = ""
# 从后面倒数第depth个问题开始加入到问题库, 如果depth=2,那么就是加入2个问答对到历史记录
for record in self.interview_records[user_id][-depth:]:
QA_records += f"Q: {record['question']} \nA: {record['answer']}\n"
description = dedent(f"""
Please formulate the {already_asked_num + 1}th question based on the interview outline below and the user's history Q&A.
You need to consider the historical Q&A, decide whether to continue asking in-depth questions, or ask a new type of question according to the outline. In-depth questions should not exceed {depth} types.
{question_style}
{questions_strategy}
Outline: {outline}
history Q&A: {QA_records}
""")

UI测试

1. 访谈的时间和主题确定,访谈的风格,还有访谈的深度,相同的问题类型是否继续深入询问,0代表不继续深入,2代表最多深入2个问题

2.访谈提纲生成

3. 当不满意当前提纲时,可以进行修改

Secontion4 已经去掉

4. 开始进行访谈


MultiAgent进行访谈
https://johnson7788.github.io/2024/07/16/MultiAgent%E8%BF%9B%E8%A1%8C%E8%AE%BF%E8%B0%88/
作者
Johnson
发布于
2024年7月16日
许可协议