diff --git a/examples/st_game/prompts/poignancy_action_v1.txt b/examples/st_game/prompts/poignancy_action_v1.txt new file mode 100644 index 000000000..34975696b --- /dev/null +++ b/examples/st_game/prompts/poignancy_action_v1.txt @@ -0,0 +1,15 @@ +poignancy_event_v1.txt + +!!: agent name +!!: iss +!!: name +!!: event description + +### +Here is a brief description of !!. +!! + +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 !!. + +Event: !! +Rate (return a number between 1 to 10): \ No newline at end of file diff --git a/examples/st_game/prompts/poignancy_thought_v1.txt b/examples/st_game/prompts/poignancy_thought_v1.txt new file mode 100644 index 000000000..9a4db5166 --- /dev/null +++ b/examples/st_game/prompts/poignancy_thought_v1.txt @@ -0,0 +1,15 @@ +poignancy_thought_v1.txt + +!!: agent name +!!: iss +!!: name +!!: event description + +### +Here is a brief description of !!. +!! + +On the scale of 1 to 10, where 1 is purely mundane (e.g., I need to do the dishes, I need to walk the dog) and 10 is extremely significant (e.g., I wish to become a professor, I love Elie), rate the likely significance of the following thought for !!. + +Thought: !! +Rate (return a number between 1 to 10): \ No newline at end of file diff --git a/examples/st_game/prompts/run_gpt_prompts.py b/examples/st_game/prompts/run_gpt_prompts.py index 14b699c15..d817d5907 100644 --- a/examples/st_game/prompts/run_gpt_prompts.py +++ b/examples/st_game/prompts/run_gpt_prompts.py @@ -19,6 +19,30 @@ def get_poignancy_action(scratch: Scratch, content: BasicMemory.content) -> str: content] return prompt_input + # 1. Prompt构建 + # 2. Instruction给出 + prompt_template = "poignancy_action_v1.txt" # 保留原来的注释 + prompt_input = create_prompt_input(scratch, content) # 保留原来的注释 + prompt = prompt_generate(prompt_input, prompt_template) + special_instruction = "The output should ONLY contain ONE integer value on the scale of 1 to 10." + poignancy = special_response_generate(prompt, special_instruction) + try: + poi_dict = json.loads(poignancy) + return str(poi_dict['poignancy']) # 将返回值强制转换为字符串 + except json.JSONDecodeError as e: + return poignancy + +def get_poignancy_chat(scratch: Scratch, content: BasicMemory.content) -> str: + """ + 衡量会话心酸度 + """ + def create_prompt_input(scratch, content): + prompt_input = [scratch.name, + scratch.iss, + scratch.name, + content] + return prompt_input + # 1. Prompt构建 # 2. Instruction给出 prompt_template = "poignancy_chat_v1.txt" # 保留原来的注释