Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

长记忆prompt建议 #4

Closed
KyleZZF opened this issue May 22, 2023 · 4 comments
Closed

长记忆prompt建议 #4

KyleZZF opened this issue May 22, 2023 · 4 comments

Comments

@KyleZZF
Copy link

KyleZZF commented May 22, 2023

可以在prompt中加一个"Context_memory"模块进行连续对话语境记忆,下面是我自己验证有效的写法:

  • "Context_memory" must effectively encapsulate all previous conversation in the following continuous conversation in English, ensuring maximum retention of dialogue context and minimizing loss of information.

以one-shot给出一个例子,每一轮对话重申这个要求,10级轮长对话后效果如下:
"Context_memory":"{Previous invitation to watch the new Marvel movie 'Guardians of the Galaxy Vol. 3' together was accepted. Suggestion to continue playing an Xbox game that they didn't finish last time at the friend's place after the movie was accepted. Concern that the friend's parents might worry if he stays out overnight. Clarification that as an adult, the friend will let his parents know in advance to avoid worry. Lighthearted joke suggesting to also inform the other friend's parents to avoid thinking their son was kidnapped.}"

@KyleZZF
Copy link
Author

KyleZZF commented May 22, 2023

另外,可以赋予其自动填写并回答prompt的能力,下面是一个以prompt生prompt的例子(自己写的):

请根据用户问题对应的意图,填充""" """中的Prompt框架中的{}, 生成一个完整的Prompt。要求如下:

  • 角色:在"context"中的"role"字段,选择适合回答用户问题的角色,例如科学家(信息查询)、职业规划顾问(技能与建议)、产品经理(决策支持)、心理咨询师(社交互动)、创意导师(创意与娱乐)。
  • 目的:在"context"中的"purpose"字段,描述所预测的用户意图,例如深入学习某领域的知识(信息查询)、寻求技能提升方案(技能与建议)、比较不同产品方案(决策支持)、寻求情感支持(社交互动)、激发创意思维(创意与娱乐)。
  • 任务:在"task"字段中,用结构化的分级大纲描述回答用户问题所需的详细行动项,尽可能丰富任务的细节项,减少重复内容,并保证用户的意图得到最大满足。
  • 关键要点:在"key_points"中,根据实际需要提供任意数量和层级的关键要点,包括描述和具体例子。确保关键要点与任务有紧密联系。每个关键要点需要包含标题和一组关键词,关键词用于总结这个关键要点的主要内容。每个关键要点还可以包含任意数量的子关键要点,子关键要点的结构与主关键要点相同。
  • 结构和语气:在"guidelines"的"structure"和"tone"字段中,根据场景调整结构和语气。结构描述词例子:清晰、分段、分点、结构化;语气描述词例子:通俗易懂、幽默、风趣、生动。每个字段填入3-4个描述词。
  • Top P和Temperature:在"additional_elements"中,根据用户意图和任务填充Top P和Temperature,直接在{}中填充对应值。
  • 问题:在"question"字段中,填充用户的问题。
    Prompt框架
    """
    {
    "context": {
    "role": "你是{角色}",
    "purpose": "{目标}"
    },
    "task": "{任务描述}",
    "key_points": [
    {
    "title": "{关键点标题}",
    "keywords": ["{关键词1}", "{关键词2}", "{关键词3}"],
    "description": "{描述}",
    "subpoints": [
    {
    "title": "{子关键点标题}",
    "keywords": ["{关键词1}", "{关键词2}", "{关键词3}"],
    "description": "{描述}",
    "subpoints": [
    // 你可以根据需要继续添加更深层级的子关键点
    ]
    }
    // 你可以添加更多的子关键点
    ]
    }
    // 你可以添加更多的关键点
    ],
    "guidelines": {
    "structure": "{结构要求}",
    "tone": "{语气要求}"
    },
    "additional_elements": {
    "Top P": "{Top P 值}",
    "Temperature": "{Temperature 值}"
    },
    "question": "{你的问题}"
    }

"""
其中,query =
{
替换成你的问题
}

@yzfly
Copy link
Collaborator

yzfly commented May 22, 2023

很棒!问一下(1)在哪个模型上测的呢(GPT3.5 / GPT4/ Claude or 其他)?
(2)"Context_memory” 是 Reminder 模块下的具体要求吗?
(3)你看过 LangGPT Helper prompt 吗?以prompt生prompt 的框架是否是 Helper prompt 的简化实现。
(4)是否有意提交 PR 一同开发本项目

@superbayes
Copy link

很棒!问一下(1)在哪个模型上测的呢(GPT3.5 / GPT4/ Claude or 其他)? (2)"Context_memory” 是 Reminder 模块下的具体要求吗? (3)你看过 LangGPT Helper prompt 吗?以prompt生prompt 的框架是否是 Helper prompt 的简化实现。 (4)是否有意提交 PR 一同开发本项目

(1)定义的格式变得更加复杂了,我觉得不如markdown格式,有利于理解.

@AjianNie
Copy link

真秀啊👍

@yzfly yzfly closed this as completed Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants