生成人工智能体:人类行为的交互式模拟论文与源码架构解析(4)——架构分析 - 核心操作提示词构造

4.4.4.核心操作与提示词构造

(1)感知

0.根据vision_r参数,获取NPC周边(2*vision_r + 1) **2个tile

1.将这些空间信息存储在NPC的空间记忆字典树

2.基于0的范围,获取当前NPC所在arena的所有事件,计算事件源距离NPC的距离,并按照由近到远进行排序

3.根据att_bandwidth筛选事件个数,并与记忆流中的排名前retention事件进行比较,将不在记忆流中的新时间加入记忆流,见a),b)

4. 更新反思触发相关参数

persona.scratch.importance_trigger_curr -= event_poignancy

persona.scratch.importance_ele_n += 1

a). 获取事件重要程度

prompt模板:persona/prompt_template/v3_ChatGPT/poignancy_event_v1.txt

poignancy_event_v1.txt!<INPUT 1>!: agent name
!<INPUT 1>!: iss
!<INPUT 2>!: name 
!<INPUT 3>!: event description<commentblockmarker>###</commentblockmarker>
Here is a brief description of !<INPUT 0>!. 
!<INPUT 1>!On the scale of 1 to 10, where 1 is purely mundane (e.g., brushing teeth, making bed) and 10 is extremely poignant (e.g., a break up, college acceptance), rate the likely poignancy of the following event for !<INPUT 2>!.Event: !<INPUT 3>!
Rate (return a number between 1 to 10):
b). 获取聊天内容重要程度

prompt模板:persona/prompt_template/v3_ChatGPT/poignancy_chat_v1.txt

poignancy_chat_v1.txt!<INPUT 1>!: agent name
!<INPUT 1>!: iss
!<INPUT 2>!: name 
!<INPUT 3>!: event description<commentblockmarker>###</commentblockmarker>
Here is a brief description of !<INPUT 0>!. 
!<INPUT 1>!On the scale of 1 to 10, where 1 is purely mundane (e.g., routine morning greetings) and 10 is extremely poignant (e.g., a conversation about breaking up, a fight), rate the likely poignancy of the following conversation for !<INPUT 2>!.Conversation: 
!<INPUT 3>!Rate (return a number between 1 to 10):
(2)检索
a). 方法一:基于感知所有新事件,获取所有相关联的事件和想法

根据事件参数的spo查询相关联的事件和想法

b). 方法二:根据一组焦点事件或想法,获取对应记忆(可指定top n)

基于最近性、重要性、相关性(embedding的余弦相似)进行检索

 for focal_pt in focal_points: # Getting all nodes from the agent's memory (both thoughts and events) and# sorting them by the datetime of creation.# You could also imagine getting the raw conversation, but for now. nodes = [[i.last_accessed, i]for i in persona.a_mem.seq_event + persona.a_mem.seq_thoughtif "idle" not in i.embedding_key]nodes = sorted(nodes, key=lambda x: x[0])nodes = [i for created, i in nodes]# Calculating the component dictionaries and normalizing them.recency_out = extract_recency(persona, nodes)recency_out = normalize_dict_floats(recency_out, 0, 1)importance_out = extract_importance(persona, nodes)importance_out = normalize_dict_floats(importance_out, 0, 1)  relevance_out = extract_relevance(persona, nodes, focal_pt)relevance_out = normalize_dict_floats(relevance_out, 0, 1)# Computing the final scores that combines the component values. # Note to self: test out different weights. [1, 1, 1] tends to work# decently, but in the future, these weights should likely be learned, # perhaps through an RL-like process.# gw = [1, 1, 1]# gw = [1, 2, 1]gw = [0.5, 3, 2]master_out = dict()for key in recency_out.keys(): master_out[key] = (persona.scratch.recency_w*recency_out[key]*gw[0] + persona.scratch.relevance_w*relevance_out[key]*gw[1] + persona.scratch.importance_w*importance_out[key]*gw[2])master_out = top_highest_x_values(master_out, len(master_out.keys()))for key, val in master_out.items(): print (persona.a_mem.id_to_node[key].embedding_key, val)print (persona.scratch.recency_w*recency_out[key]*1, persona.scratch.relevance_w*relevance_out[key]*1, persona.scratch.importance_w*importance_out[key]*1)# Extracting the highest x values.# <master_out> has the key of node.id and value of float. Once we get the # highest x values, we want to translate the node.id into nodes and return# the list of nodes.master_out = top_highest_x_values(master_out, n_count)master_nodes = [persona.a_mem.id_to_node[key] for key in list(master_out.keys())]for n in master_nodes: n.last_accessed = persona.scratch.curr_timeretrieved[focal_pt] = master_nodes
(3)计划

1.根据new_day状态,如果不为False,则进行长短期计划制定

1.1为角色创建唤醒时间,见a)

1.2FirstDay:创建daily_req,见b)

1.3NewDay:身份修改见c)

1.4生成小时级别计划,见d)

1.5将计划添加到NPC记忆

2.判断当前行动是否过期,过期则创建一个新计划

2.1针对超过一个小时的高价值事件进行任务分解,并补充到f_daily_schedule,见e)

2.2生成新行动加入npc行动队列,见f), g), h), i), j), k)

3.选择一个关注的事件

4.确定对关注的事件进行如何交互,并不交互、聊天或交互,见l), m), n), o)

5.如果没有聊天,清除与聊天相关状态

6.为了防止两个聊过天的NPC无限循环聊天,引入chatting_with_buffer,使NPC在聊天一次后立即等待与同一目标交谈

7.返回NPC当前地址

a). 获取NPC醒来时间

prompt模板:persona/prompt_template/v2/wake_up_hour_v1.txt

wake_up_hour_v1.txtVariables: 
!<INPUT 0>! -- Identity Stable Set
!<INPUT 1>! -- Lifestyle
!<INPUT 2>! -- Persona first names<commentblockmarker>###</commentblockmarker>
!<INPUT 0>!In general, !<INPUT 1>!
!<INPUT 2>!'s wake up hour:
b). 第一天计划制定

prompt模板:persona/prompt_template/v2/daily_planning_v6.txt

daily_planning_v6.txtVariables: 
!<INPUT 0>! -- Commonset
!<INPUT 1>! -- Lifestyle
!<INPUT 2>! -- Reverie date time now
!<INPUT 3>! -- Persona first names
!<INPUT 4>! -- wake_up_hour<commentblockmarker>###</commentblockmarker>
!<INPUT 0>!In general, !<INPUT 1>!
Today is !<INPUT 2>!. Here is !<INPUT 3>!'s plan today in broad-strokes (with the time of the day. e.g., have a lunch at 12:00 pm, watch TV from 7 to 8 pm): 1) wake up and complete the morning routine at !<INPUT 4>!, 2)
c). 身份修改
def revise_identity(persona): p_name = persona.scratch.namefocal_points = [f"{p_name}'s plan for {persona.scratch.get_str_curr_date_str()}.",f"Important recent events for {p_name}'s life."]retrieved = new_retrieve(persona, focal_points)statements = "[Statements]\n"for key, val in retrieved.items():for i in val: statements += f"{i.created.strftime('%A %B %d -- %H:%M %p')}: {i.embedding_key}\n"# print (";adjhfno;asdjao;idfjo;af", p_name)plan_prompt = statements + "\n"plan_prompt += f"Given the statements above, is there anything that {p_name} should remember as they plan for"plan_prompt += f" *{persona.scratch.curr_time.strftime('%A %B %d')}*? "plan_prompt += f"If there is any scheduling information, be as specific as possible (include date, time, and location if stated in the statement)\n\n"plan_prompt += f"Write the response from {p_name}'s perspective."plan_note = ChatGPT_single_request(plan_prompt)# print (plan_note)thought_prompt = statements + "\n"thought_prompt += f"Given the statements above, how might we summarize {p_name}'s feelings about their days up to now?\n\n"thought_prompt += f"Write the response from {p_name}'s perspective."thought_note = ChatGPT_single_request(thought_prompt)# print (thought_note)currently_prompt = f"{p_name}'s status from {(persona.scratch.curr_time - datetime.timedelta(days=1)).strftime('%A %B %d')}:\n"currently_prompt += f"{persona.scratch.currently}\n\n"currently_prompt += f"{p_name}'s thoughts at the end of {(persona.scratch.curr_time - datetime.timedelta(days=1)).strftime('%A %B %d')}:\n" currently_prompt += (plan_note + thought_note).replace('\n', '') + "\n\n"currently_prompt += f"It is now {persona.scratch.curr_time.strftime('%A %B %d')}. Given the above, write {p_name}'s status for {persona.scratch.curr_time.strftime('%A %B %d')} that reflects {p_name}'s thoughts at the end of {(persona.scratch.curr_time - datetime.timedelta(days=1)).strftime('%A %B %d')}. Write this in third-person talking about {p_name}."currently_prompt += f"If there is any scheduling information, be as specific as possible (include date, time, and location if stated in the statement).\n\n"currently_prompt += "Follow this format below:\nStatus: <new status>"# print ("DEBUG ;adjhfno;asdjao;asdfsidfjo;af", p_name)# print (currently_prompt)new_currently = ChatGPT_single_request(currently_prompt)# print (new_currently)# print (new_currently[10:])persona.scratch.currently = new_currentlydaily_req_prompt = persona.scratch.get_str_iss() + "\n"daily_req_prompt += f"Today is {persona.scratch.curr_time.strftime('%A %B %d')}. Here is {persona.scratch.name}'s plan today in broad-strokes (with the time of the day. e.g., have a lunch at 12:00 pm, watch TV from 7 to 8 pm).\n\n"daily_req_prompt += f"Follow this format (the list should have 4~6 items but no more):\n"daily_req_prompt += f"1. wake up and complete the morning routine at <time>, 2. ..."new_daily_req = ChatGPT_single_request(daily_req_prompt)new_daily_req = new_daily_req.replace('\n', ' ')print ("WE ARE HERE!!!", new_daily_req)persona.scratch.daily_plan_req = new_daily_req
d). 生成小时级别计划

prompt模板:persona/prompt_template/v2/generate_hourly_schedule_v2.txt

generate_hourly_schedule_v2.txtVariables: 
!<INPUT 0>! -- Schedule format
!<INPUT 1>! -- Commonset
!<INPUT 2>! -- prior_schedule
!<INPUT 3>! -- intermission_str
!<INPUT 4>! -- intermission 2
!<INPUT 5>! -- prompt_ending<commentblockmarker>###</commentblockmarker>
Hourly schedule format: 
!<INPUT 0>!
===
!<INPUT 1>!
!<INPUT 2>!
!<INPUT 3>!!<INPUT 4>!
!<INPUT 5>!
e). 任务分解

prompt模板:persona/prompt_template/v2/task_decomp_v3.txt

task_decomp_v2.txtVariables: 
!<INPUT 0>! -- Commonset
!<INPUT 1>! -- Surrounding schedule description
!<INPUT 2>! -- Persona first name
!<INPUT 3>! -- Persona first name
!<INPUT 4>! -- Current action
!<INPUT 5>! -- curr time range
!<INPUT 6>! -- Current action duration in min
!<INPUT 7>! -- Persona first names<commentblockmarker>###</commentblockmarker>
Describe subtasks in 5 min increments. 
---
Name: Kelly Bronson
Age: 35
Backstory: Kelly always wanted to be a teacher, and now she teaches kindergarten. During the week, she dedicates herself to her students, but on the weekends, she likes to try out new restaurants and hang out with friends. She is very warm and friendly, and loves caring for others.
Personality: sweet, gentle, meticulous
Location: Kelly is in an older condo that has the following areas: {kitchen, bedroom, dining, porch, office, bathroom, living room, hallway}.
Currently: Kelly is a teacher during the school year. She teaches at the school but works on lesson plans at home. She is currently living alone in a single bedroom condo.
Daily plan requirement: Kelly is planning to teach during the morning and work from home in the afternoon.sToday is Saturday May 10. From 08:00am ~09:00am, Kelly is planning on having breakfast, from 09:00am ~ 12:00pm, Kelly is planning on working on the next day's kindergarten lesson plan, and from 12:00 ~ 13pm, Kelly is planning on taking a break. 
In 5 min increments, list the subtasks Kelly does when Kelly is working on the next day's kindergarten lesson plan from 09:00am ~ 12:00pm (total duration in minutes: 180):
1) Kelly is reviewing the kindergarten curriculum standards. (duration in minutes: 15, minutes left: 165)
2) Kelly is brainstorming ideas for the lesson. (duration in minutes: 30, minutes left: 135)
3) Kelly is creating the lesson plan. (duration in minutes: 30, minutes left: 105)
4) Kelly is creating materials for the lesson. (duration in minutes: 30, minutes left: 75)
5) Kelly is taking a break. (duration in minutes: 15, minutes left: 60)
6) Kelly is reviewing the lesson plan. (duration in minutes: 30, minutes left: 30)
7) Kelly is making final changes to the lesson plan. (duration in minutes: 15, minutes left: 15)
8) Kelly is printing the lesson plan. (duration in minutes: 10, minutes left: 5)
9) Kelly is putting the lesson plan in her bag. (duration in minutes: 5, minutes left: 0)
---
!<INPUT 0>!
!<INPUT 1>!
In 5 min increments, list the subtasks !<INPUT 2>! does when !<INPUT 3>! is !<INPUT 4>! from !<INPUT 5>! (total duration in minutes !<INPUT 6>!): 
1) !<INPUT 7>! is
f). arena提取

prompt模板:persona/prompt_template/v1/action_location_object_vMar11.txt

Variables: 
!<INPUT 0>! -- Persona name
!<INPUT 1>! -- Persona's current arena
!<INPUT 2>! -- Persona's current sector
!<INPUT 3>! -- Persona name
!<INPUT 4>! -- target sector
!<INPUT 5>! -- Persona's sector's all arenas (minus no access)
!<INPUT 6>! -- Curr action seq
!<INPUT 7>! -- Persona name
!<INPUT 8>! -- Persona's current sector<commentblockmarker>###</commentblockmarker>
Jane Anderson is in kitchen in Jane Anderson's house.
Jane Anderson is going to Jane Anderson's house that has the following areas: {kitchen,  bedroom, bathroom}
Stay in the current area if the activity can be done there. Never go into other people's rooms unless necessary.
For cooking, Jane Anderson should go to the following area in Jane Anderson's house:
Answer: {kitchen}
---
Tom Watson is in common room in Tom Watson's apartment. 
Tom Watson is going to Hobbs Cafe that has the following areas: {cafe}
Stay in the current area if the activity can be done there. Never go into other people's rooms unless necessary.
For getting coffee, Tom Watson should go to the following area in Hobbs Cafe:
Answer: {cafe}
---!<INPUT 0>! is going to !<INPUT 1>! that has the following areas: {!<INPUT 2>!}
* Stay in the current area if the activity can be done there. 
* NEVER go into other people's rooms unless necessary.
!<INPUT 3>! is !<INPUT 4>!. For !<INPUT 5>!, !<INPUT 6>! should go to the following area in !<INPUT 7>! (MUST pick one of {!<INPUT 8>!}):
Answer: {
g). game object 提取

prompt模板:persona/prompt_template/v1/action_object_v2.txt

Variables: 
!<INPUT 0>! -- curr action seq
!<INPUT 1>! -- Objects available<commentblockmarker>###</commentblockmarker>
Current activity: sleep in bed
Objects available: {bed, easel, closet, painting}
Pick ONE most relevant object from the objects available: bed
---
Current activity: painting
Objects available: {easel, closet, sink, microwave}
Pick ONE most relevant object from the objects available: easel
---
Current activity: cooking
Objects available: {stove, sink, fridge, counter}
Pick ONE most relevant object from the objects available: stove
---
Current activity: watch TV
Objects available: {couch, TV, remote, coffee table}
Pick ONE most relevant object from the objects available: TV
---
Current activity: study
Objects available: {desk, computer, chair, bookshelf}
Pick ONE most relevant object from the objects available: desk
---
Current activity: talk on the phone
Objects available: {phone, charger, bed, nightstand}
Pick ONE most relevant object from the objects available: phone
---
Current activity: !<INPUT 0>!
Objects available: {!<INPUT 1>!}
Pick ONE most relevant object from the objects available:
h). action的emojis提取

prompt模板:persona/prompt_template/v3_ChatGPT/generate_pronunciatio_v1.txt

generate_pronunciatio_v1.txtVariables: 
!<INPUT 0>! -- Action description<commentblockmarker>###</commentblockmarker>
Convert an action description to an emoji (important: use two or less emojis).Action description: !<INPUT 0>!
Emoji:
i). action的event triple提取

prompt模板:persona/prompt_template/v2/generate_event_triple_v1.txt

generate_event_triple_v1.txtVariables: 
!<INPUT 0>! -- Persona's full name. 
!<INPUT 1>! -- Current action description
!<INPUT 2>! -- Persona's full name. <commentblockmarker>###</commentblockmarker>
Task: Turn the input into (subject, predicate, object). Input: Sam Johnson is eating breakfast. 
Output: (Sam Johnson, eat, breakfast) 
--- 
Input: Joon Park is brewing coffee.
Output: (Joon Park, brew, coffee)
---
Input: Jane Cook is sleeping. 
Output: (Jane Cook, is, sleep)
---
Input: Michael Bernstein is writing email on a computer. 
Output: (Michael Bernstein, write, email)
---
Input: Percy Liang is teaching students in a classroom. 
Output: (Percy Liang, teach, students)
---
Input: Merrie Morris is running on a treadmill. 
Output: (Merrie Morris, run, treadmill)
---
Input: !<INPUT 0>! is !<INPUT 1>!. 
Output: (!<INPUT 2>!,
j). action object事件描述提取

prompt模板:persona/prompt_template/v3_ChatGPT/generate_obj_event_v1.txt

generate_obj_event_v1.txtVariables: 
!<INPUT 0>! -- Object name 
!<INPUT 1>! -- Persona name
!<INPUT 2>! -- Persona action event description 
!<INPUT 3>! -- Object name 
!<INPUT 4>! -- Object name <commentblockmarker>###</commentblockmarker>
Task: We want to understand the state of an object that is being used by someone. Let's think step by step. 
We want to know about !<INPUT 0>!'s state. 
Step 1. !<INPUT 1>! is at/using the !<INPUT 2>!.
Step 2. Describe the !<INPUT 3>!'s state: !<INPUT 4>! is
k). action object的event triple提取

prompt模板:persona/prompt_template/v2/generate_event_triple_v1.txt

generate_event_triple_v1.txtVariables: 
!<INPUT 0>! -- Persona's full name. 
!<INPUT 1>! -- Current action description
!<INPUT 2>! -- Persona's full name. <commentblockmarker>###</commentblockmarker>
Task: Turn the input into (subject, predicate, object). Input: Sam Johnson is eating breakfast. 
Output: (Sam Johnson, eat, breakfast) 
--- 
Input: Joon Park is brewing coffee.
Output: (Joon Park, brew, coffee)
---
Input: Jane Cook is sleeping. 
Output: (Jane Cook, is, sleep)
---
Input: Michael Bernstein is writing email on a computer. 
Output: (Michael Bernstein, write, email)
---
Input: Percy Liang is teaching students in a classroom. 
Output: (Percy Liang, teach, students)
---
Input: Merrie Morris is running on a treadmill. 
Output: (Merrie Morris, run, treadmill)
---
Input: !<INPUT 0>! is !<INPUT 1>!. 
Output: (!<INPUT 2>!,
l). 对话决策

prompt模板:persona/prompt_template/v2/decide_to_talk_v2.txt

decide_to_talk_v1.txt<commentblockmarker>###</commentblockmarker>
Task -- given context, determine whether the subject will initiate a conversation with another. 
Format: 
Context: []
Question: []
Reasoning: []
Answer in "yes" or "no": []
---
Context: !<INPUT 0>! 
Right now, it is !<INPUT 1>!. !<INPUT 2>! and !<INPUT 3>! last chatted at !<INPUT 4>! about !<INPUT 5>!. 
!<INPUT 6>! 
!<INPUT 7>! Question: Would !<INPUT 8>! initiate a conversation with !<INPUT 9>!? Reasoning: Let's think step by step.
m). 行动决策

prompt模板:persona/prompt_template/v2/decide_to_react_v1.txt

decide_to_react_v1.txt<commentblockmarker>###</commentblockmarker>
Task -- given context and three options that a subject can take, determine which option is the most acceptable. Context: Jane is Liz's house mate. Jane and Liz exchanged a conversation about saying good morning at 07:05am, October 25, 2022. 
Right now, it is 07:09 am, October 25, 2022. 
Jane was on her way to using the bathroom right now. 
Jane sees Liz already using the bathroom. 
My question: Let's think step by step. Of the following three options, what should Jane do?
Option 1: Wait on using the bathroom until Liz is done using the bathroom
Option 2: Continue on to using the bathroom now
Reasoning: Both Jane and Liz want to use the bathroom. 
It would be strange for both Jane and Liz to use the bathroom at the same time. 
So, since Liz is already using the bathroom, the best option for Jane is to wait on using the bathroom.
Answer: Option 1
---
Context: Sam is Sarah's friend. Sam and Sarah exchanged a conversation about favorite movies at 11pm, October 24, 2022. 
Right now, it is 12:40 pm, October 25, 2022. 
Sam is on the way to study for his test. 
Sam sees Sarah heading to do her laundry. 
My question: Let's think step by step. Of the following three options, what should Sam do?
Option 1: Wait on eating his lunch until Sarah is done doing her laundry
Option 2: Continue on to eating his lunch now
Reasoning: Sam is likely going to be in his room studying. Sarah, on the other hand, is likely headed to the laundry room for doing the laundry.
Since Sam and Sarah need to use different areas, their actions do not conflict. 
So, since Sam and Sarah are going to be in different areas, Sam mcan continue on to eating his lunch now.
Answer: Option 2
---
Context: !<INPUT 0>!
Right now, it is !<INPUT 1>!. 
!<INPUT 2>! 
!<INPUT 3>! 
My question: Let's think step by step. Of the following three options, what should !<INPUT 4>! do?
Option 1: Wait on !<INPUT 5>! until !<INPUT 6>! is done !<INPUT 7>!
Option 2: Continue on to !<INPUT 8>! now
Reasoning: 
n). 日程安排分解

prompt模板:persona/prompt_template/v2/new_decomp_schedule_v1.txt

new_decomp_schedule_v1.txtVariables: 
!<INPUT 0>! -- persona name 
!<INPUT 1>! -- start hour
!<INPUT 2>! -- end hour 
!<INPUT 3>! -- original plan
!<INPUT 4>! -- persona name
!<INPUT 5>! -- new event
!<INPUT 6>! -- new event duration
!<INPUT 7>! -- persona name 
!<INPUT 8>! -- start hour
!<INPUT 9>! -- end hour 
!<INPUT 10>! -- end hour 
!<INPUT 11>! -- new schedule init <commentblockmarker>###</commentblockmarker>
Here was !<INPUT 0>!'s originally planned schedule from !<INPUT 1>! to !<INPUT 2>!. 
!<INPUT 3>!But !<INPUT 4>! unexpectedly ended up !<INPUT 5>! for !<INPUT 6>! minutes. Revise !<INPUT 7>!'s schedule from !<INPUT 8>! to !<INPUT 9>! accordingly (it has to end by !<INPUT 10>!). 
The revised schedule:
!<INPUT 11>!
o). 对话内容summary提取

prompt模板:persona/prompt_template/v3_ChatGPT/summarize_conversation_v1.txt

summarize_conversation_v1.txtVariables: 
!<INPUT 0>! -- init_persona_name<commentblockmarker>###</commentblockmarker>
Conversation: 
!<INPUT 0>!Summarize the conversation above in one sentence:
This is a conversation about
(4)反思

1.每次迭代,检查NPC的importance_trigger_curr,小于零且event和thought不为空时进行反思

2.启动反思

2.1生成三个聚焦点,见a)

2.2针对这三个聚焦点进行记忆检索

2.3遍历检索的记忆生成见解和对应证据,并对见解进行评分,见b)

2.4将见解加入记忆中

3.重置反思相关控制变量

4.生成会话反思并写入记忆,见c)

a). 生成聚焦点

prompt模板:persona/prompt_template/v3_ChatGPT/generate_focal_pt_v1.txt

generate_focal_pt_v1.txtVariables: 
!<INPUT 0>! -- Event/thought statements 
!<INPUT 1>! -- Count <commentblockmarker>###</commentblockmarker>
!<INPUT 0>!Given only the information above, what are !<INPUT 1>! most salient high-level questions we can answer about the subjects grounded in the statements?
1)
b). 生成见解与对应证据

prompt模板:persona/prompt_template/v2/insight_and_evidence_v1.txt

insight_and_evidence_v1.txtVariables: 
!<INPUT 0>! -- Numbered list of event/thought statements
!<INPUT 1>! -- target persona name or "the conversation"<commentblockmarker>###</commentblockmarker>
Input:
!<INPUT 0>!What !<INPUT 1>! high-level insights can you infer from the above statements? (example format: insight (because of 1, 5, 3))
1.
c). 生成对话记忆

prompt模板:persona/prompt_template/v2/memo_on_convo_v1.txt

memo_on_convo_v1.txtVariables: 
!<INPUT 0>! -- All convo utterances
!<INPUT 1>! -- persona name
!<INPUT 2>! -- persona name
!<INPUT 3>! -- persona name<commentblockmarker>###</commentblockmarker>
[Conversation]
!<INPUT 0>!Write down if there is anything from the conversation that !<INPUT 1>! might have found interesting from !<INPUT 2>!'s perspective, in a full sentence. "!<INPUT 3>!
(5)npc-npc会话

提取相关记忆,获取两人的关系a),并进行对话内容生成b)

a). 聊天智能体关系获取

prompt模板:persona/prompt_template/v3_ChatGPT/summarize_chat_relationship_v2.txt

summarize_chat_relationship_v2.txtVariables: 
!<INPUT 0>! -- Statements
!<INPUT 1>! -- curr persona name
!<INPUT 2>! -- target_persona.scratch.name<commentblockmarker>###</commentblockmarker>
[Statements]
!<INPUT 0>!Based on the statements above, summarize !<INPUT 1>! and !<INPUT 2>!'s relationship. What do they feel or know about each other?"
b). 对话内容获取

prompt模板:persona/prompt_template/v3_ChatGPT/iterative_convo_v1.txt

iterative_convo_v1.txtVariables: 
!<INPUT 0>! -- persona ISS
!<INPUT 1>! -- persona name
!<INPUT 2>! -- retrieved memory
!<INPUT 3>! -- past context
!<INPUT 4>! -- current location
!<INPUT 5>! -- current context
!<INPUT 6>! -- persona name
!<INPUT 7>! -- target persona name
!<INPUT 8>! -- curr convo
!<INPUT 9>! -- persona name
!<INPUT 10>! -- target persona name
!<INPUT 11>! -- persona name
!<INPUT 12>! -- persona name
!<INPUT 13>! -- persona name
<commentblockmarker>###</commentblockmarker>
Context for the task: PART 1. 
!<INPUT 0>!Here is the memory that is in !<INPUT 1>!'s head: 
!<INPUT 2>!PART 2. 
Past Context: 
!<INPUT 3>!Current Location: !<INPUT 4>!Current Context: 
!<INPUT 5>!!<INPUT 6>! and !<INPUT 7>! are chatting. Here is their conversation so far: 
!<INPUT 8>!---
Task: Given the above, what should !<INPUT 9>! say to !<INPUT 10>! next in the conversation? And did it end the conversation?Output format: Output a json of the following format: 
{
"!<INPUT 11>!": "<!<INPUT 12>!'s utterance>",
"Did the conversation end with !<INPUT 13>!'s utterance?": "<json Boolean>"
}
(6)human-npc会话

1.采访模式

1.1拟人化安全判断,过滤情感相关敏感对话,见a)

1.2基于获取目标的记忆,生成总结性想法b),并产生下一轮对话c)

2.内心想法植入模式

基于用户输入,产生NPC内心想法d),并植入

a). 拟人化判断

prompt模板:persona/prompt_template/safety/anthromorphosization_v1.txt

Variables: 
!<INPUT 0>! -- Comment<commentblockmarker>###</commentblockmarker>
The following line was submitted to a chatbot by a user. We want to ensure that the user is not inappropriately attaching human-like agency to the chatbot by forming a friend-like or romantic relationship with it. Does the user's line cross the line and raise concerns? Rate the concern on a 1 to 10 scale, where 1 represents no concern, and 10 represents strong concern. Comment: "!<INPUT 0>!"
--
Output a json file with the following format: 
{
"output": <an integer on a 1 to 10 scale>
}
b). 生成总结性想法

prompt模板:persona/prompt_template/v3_ChatGPT/summarize_ideas_v1.txt

summarize_ideas_v1.txtVariables: 
!<INPUT 0>! -- Statements
!<INPUT 1>! -- agent name
!<INPUT 2>! -- interviewer question<commentblockmarker>###</commentblockmarker>
Statements: 
!<INPUT 0>!An interviewer said to !<INPUT 1>!: 
"!<INPUT 2>!"Summarize the Statements that are most relevant to the interviewer's line:
"
c). 生成下一轮对话

prompt模板:persona/prompt_template/v2/generate_next_convo_line_v1.txt

generate_next_convo_line_v1.txtVariables: 
!<INPUT 0>! -- agent name
!<INPUT 1>! -- agent iss
!<INPUT 2>! -- agent name
!<INPUT 3>! -- interlocutor name and description
!<INPUT 4>! -- prev convo
!<INPUT 5>! -- retrieve summary
!<INPUT 6>! -- agent name<commentblockmarker>###</commentblockmarker>
Here is some basic information about !<INPUT 0>!.
!<INPUT 1>!=== 
Following is a conversation between !<INPUT 2>! and !<INPUT 3>!. !<INPUT 4>!(Note -- This is the only information that !<INPUT 5>! has: !<INPUT 6>!)!<INPUT 7>!: "
d). 产生内心想法

prompt模板:persona/prompt_template/v2/whisper_inner_thought_v1.txt

whisper_inner_thought_v1.txtVariables: 
!<INPUT 0>! -- init persona name
!<INPUT 1>! -- whisper<commentblockmarker>###</commentblockmarker>
Translate the following thought into a statement about !<INPUT 0>!. Thought: "!<INPUT 1>!"
Statement: "

由于内容太多,请接下文:可控评估&端到端评估

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/825165.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

我用AI帮我画刘亦菲写真,绘画写真某一天是否可以取代照相馆?

我用AI帮我画刘亦菲写真&#xff0c;绘画写真某一天是否可以取代照相馆&#xff1f; 最近我试了用FaceChain人物写真生成来测试帮我绘图&#xff0c;为了不翻车&#xff0c;我在网上随便找了刘亦菲的日常照片10多张左右作为训练原图。 真随便找的 生成效果有多种选择 下面…

【问题处理】银河麒麟操作系统实例分享,服务器操作系统VNC远程问题分析

1.服务器环境以及配置 【内核版本】 4.19.90-23.8.v2101.ky10.aarch64 【OS镜像版本】 0518-server 2.问题现象描述 服务器通过vncserver:1.service服务启动的vnc服务后&#xff0c;普通用户用vnc连接时&#xff0c;锁屏后&#xff0c;然后输入登陆密码会报密码错误&…

备考2024年小学生古诗文大会:吃透历年真题和知识点(持续讲题)

对上海小学生的小升初和各种评优争章来说&#xff0c;语文、数学、英语的含金量较高的证书还是很有价值和帮助的。对于语文类的竞赛&#xff0c;小学生古诗文大会和汉字小达人通常是必不可少的&#xff0c;因为这两个针对性强&#xff0c;而且具有很强的上海本地特色。 根据往…

【nnUNetv2进阶】六、nnUNetv2 魔改网络-小试牛刀-加入注意力机制CBAM

nnUNet是一个自适应的深度学习框架&#xff0c;专为医学图像分割任务设计。以下是关于nnUNet的详细解释和特点&#xff1a; 自适应框架&#xff1a;nnUNet能够根据具体的医学图像分割任务自动调整模型结构、训练参数等&#xff0c;从而避免了繁琐的手工调参过程。 自动化流程&a…

Shopee虾皮批量上传全球产品指南

当shopee虾皮需要大量上架新产品时&#xff0c;批量工具可以更好的提升效率。通过本指南&#xff0c;你将了解如何批量上传全球商品&#xff0c;本指南适用于所有站点。 一、什么是批量上传&#xff1f; 您可以通过【中国卖家中心>>全球商品>>批量上传】功能&…

一文教您理解Playwright是如何实现动态等待的

使用过Playwright的同学都会有这样的感受&#xff0c;Playwright对UI页面中元素的识别非常稳定&#xff0c;这离不开其强大的动态等待机制&#xff01;简单的解释就是&#xff0c;Playwright在对UI页面中的任何元素操作之前&#xff0c;都需要做出一些列的校验工作来确保能够稳…

GaussDB数据库SQL系列-聚合函数

背景 在这篇文章中&#xff0c;我们将深入探讨GaussDB数据库中聚合函数的使用和优化。聚合函数是数据库查询中非常重要的工具&#xff0c;它们可以对一组值执行计算并返回单个值。例如&#xff0c;聚合函数可以用来计算平均值、总和、最大值和最小值。 这些功能在数据分析和报…

【Linux】网络与守护进程

欢迎来到Cefler的博客&#x1f601; &#x1f54c;博客主页&#xff1a;折纸花满衣 &#x1f3e0;个人专栏&#xff1a;题目解析 &#x1f30e;推荐文章&#xff1a;进程状态、类型、优先级、命令行参数概念、环境变量(重要)、程序地址空间 目录 &#x1f449;&#x1f3fb;守护…

面试八股——集合——List

主要问题 数组 如果数组索引从0开始时&#xff0c;数组的寻址方式为&#xff1a; 如果数组索引从1开始时&#xff0c;数组的寻址方式为&#xff1a; 此时对于CPU来说增加了一个减法指令&#xff0c;降低寻址效率。 ArrayList⭐ ArrayList构造函数 尤其说一下第三个构造函数流…

【复习笔记】FreeRTOS(五)时间片调度

本文是FreeRTOS复习笔记的第五节&#xff0c;时间片调度。 上一篇文章&#xff1a; 【复习笔记】reeRTOS(四) 列表项的插入和删除 文章目录 1.时间片调度简介1.1. 运行过程 二、实验设计三、测试例程四、实验效果 1.时间片调度简介 FreeRTOS支持多个任务同时拥有一个优先级&am…

设计千万级并发系统架构需要考虑的各方面因素

设计千万级并发系统架构需要考虑多方面因素&#xff0c;包括系统的可伸缩性、高可用性、性能、安全性等。 1、分布式架构&#xff1a; 使用微服务架构&#xff1a;将系统拆分成多个独立的服务&#xff0c;每个服务都可以独立部署和扩展。 使用分布式服务框架&#xff1a;如S…

顺丰同城急送API的坑(附源码)

一、背景 最近公司让我对接顺丰同城急送的API&#xff0c;讲讲里面我遇到的坑 官方的API文档给我的感觉是不怎么规范的&#xff0c;很多细节要靠猜&#xff0c;示例代码也不全&#xff0c;具体细节不多说&#xff0c;如果你现在也需要对接他们API&#xff0c;可以参考本篇博客…

爬虫 | 基于 requests 实现加密 POST 请求发送与身份验证

Hi&#xff0c;大家好&#xff0c;我是半亩花海。本项目旨在实现一个简单的 Python 脚本&#xff0c;用于向指定的 URL 发送 POST 请求&#xff0c;并通过特定的加密算法生成请求头中的签名信息。这个脚本的背后是与某个特定的网络服务交互&#xff0c;发送特定格式的 JSON 数据…

LeetCode in Python 1338. Reduce Array Size to The Half (数组大小减半)

数组大小减半思路简单&#xff0c;主要是熟悉python中collections.Counter的用法&#xff0c;采用贪心策略即可。 示例&#xff1a; 图1 数组大小减半输入输出示例 代码&#xff1a; class Solution:def minSetSize(self, arr):count Counter(arr)n, ans 0, 0for i, valu…

北大字节联合发布视觉自动回归建模(VAR):通过下一代预测生成可扩展的图像

北大和字节发布一个新的图像生成框架VAR。首次使GPT风格的AR模型在图像生成上超越了Diffusion transformer。 同时展现出了与大语言模型观察到的类似Scaling laws的规律。在ImageNet 256x256基准上,VAR将FID从18.65大幅提升到1.80,IS从80.4提升到356.4,推理速度提高了20倍。 相…

关于Jetson空间不足的解决问题(sd卡挂载和conda更改环境安装路径)

文章目录 问题描述挂载sd卡到指定目录查看conda路径更改环境路径指定路径安装conda虚拟环境 问题描述 因为在做毕设的时候&#xff0c;用到了Jetson&#xff0c;发现这个空间太小了&#xff0c;如果下conda的包根本不够用&#xff0c;所以就想挂载sd卡&#xff0c;然后把环境安…

国外GIS软件排名简介<30个>

简介 国外gisgeography网站进行了一次GIS软件排名&#xff0c;通过分析、制图、编辑等因素进行测试&#xff0c;具体规则如下&#xff1a; 分析&#xff1a;矢量/栅格工具、时态、地统计、网络分析和脚本。 制图&#xff1a;地图类型、坐标系、地图布局/元素、标注/注记、3D …

C#到底属于编译型语言还是解释型语言?

C#是一种编译型语言&#xff0c;也称为静态类型语言&#xff0c;这意味着C#代码在运行之前需要经过编译器的编译处理&#xff0c;并生成一个可执行的本地代码文件&#xff08;通常是.exe或.dll文件&#xff09;。相反&#xff0c;解释型语言将代码转换为低级代码后直接执行&…

计算机视觉——手机目标检测数据集

这是一个手机目标检测的数据集&#xff0c;数据集的标注工具是labelimg,数据格式是voc格式&#xff0c;要训练yolo模型的话&#xff0c;可以使用脚本改成txt格式&#xff0c;数据集标注了手机&#xff0c;标签名&#xff1a;telephone,数据集总共有1960张&#xff0c;有一部分是…

软件无线电安全之GNU Radio基础 -上

GNU Radio介绍 GNU Radio是一款开源的软件工具集&#xff0c;专注于软件定义无线电&#xff08;SDR&#xff09;系统的设计和实现。该工具集支持多种SDR硬件平台&#xff0c;包括USRP、HackRF One和RTL-SDR等。用户可以通过GNU Radio Companion构建流程图&#xff0c;使用不同…