如何理解Prompt? PromptEnginneering prompt通常指的是一个输入的文本段落或短语,作为生成模型输出的起点或引导。prompt可以是一个问题、一段文字描述、一段对话或任何形式的文本输入,模型会基于prompt所提供的上下文和语义信息,生成相应的输出文本。 举个例子,对于一个语言模型,prompt可以是Thecatsatonthe,模型可以通过对接下来的词语进行预测,生成类似于mat、chair、sofa等不同的输出: TheCat 上图为StableDiffusion生成(Prompt:Thecatsatonthe,Steps:30,Sampler:Eulera,CFGscale:7,Seed:234310862,Size:512x512,Modelhash:d8722b4a4d,Model:neverendingDreamNEDbakedVae) Prompt在人工智能语言生成领域中扮演着重要的角色,因为它可以帮助模型更好地理解用户意图,并生成更准确、有意义的文本内容。诸如于如下的prompt womenbackviewwithoutface,flowingdress,edgeofthesea,backview,backturnedtothecamera,upontheglowofthesettingsun,sunbelowthehorizon,goldenlightoverthewater,hairswaysgently,Chinesestyleclothes,blackhair, 可以在StableDiffusion生成图片(配置了negativeprompt): 所以,质量看上去不错,但是可能不是你想要的。在ChatGPT则可以生成文本,质量上也是相似的,但是对于AI输出的文本来说,质量并没有这么直观。应用好Prompt的核心思想:概念与类比 开始之前,可以看一下这个问题示例: 设计模式的要素是哪些? 对于AI领域的prompt编写来说,我们通常使用的模式有哪些? 能将AI领域的prompt常见的设计模式用设计模式要素的格式一一表达吗? 核心思想,将设计模式要素作为一个概念,让AI类比到prompt里的模式。详细见: designpattern。analogy designpattern。analogy2 当然了,类比和定义概念不一定都会成功。基础模式 四种基础模式: Byexample(示例模式):在这种模式下,我们给模型提供一些示例文本,模型需要生成与示例文本类似的文本。这种模式通常用于生成类似于给定示例的文本,例如自动生成电子邮件、产品描述、新闻报道等。示例文本可以是单个句子或多个段落,具体取决于任务的要求。 Byinstructiontemplate(指令模板):在这种模式下,我们给模型提供一些明确的指令,模型需要根据这些指令生成文本。这种模式通常用于生成类似于技术说明书、操作手册等需要明确指令的文本。指令可以是单个句子或多个段落,具体取决于任务的要求。 Byspecific(特定指令):在这种模式下,我们给模型提供一些特定信息,例如问题或关键词,模型需要生成与这些信息相关的文本。这种模式通常用于生成答案、解释或推荐等。特定信息可以是单个问题或多个关键词,具体取决于任务的要求。 Byproxy(代理模式):在这种模式下,可以充当了一个代理,代表某个实体(例如人、角色、机器人等)进行操作或交互。代理模式的核心思想是引入一个中介对象来控制对实际对象的访问,从而实现一定程度上的隔离和保护。诸如于在ChatGPT中,actasxxx可以让ChatGPT充当一个代理,扮演某个角色或实体的身份,以此来处理与该角色或实体相关的任务或请求。Byspecific PromptEnginneering 在这种模式下,我们给模型提供一些示例文本,模型需要生成与示例文本类似的文本。这种模式通常用于生成类似于给定示例的文本,例如自动生成电子邮件、产品描述、新闻报道等。示例文本可以是单个句子或多个段落,具体取决于任务的要求。 如spanstyleboxsizing:color:rgb(23,158,214);翻译span、spanstyleboxsizing:color:rgb(23,158,214);告诉我span,以我们的开头来说: 定义一下prompt工程 类似的场景还可以有: 翻译一下:永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。 转为现代汉语:永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。 对应的,还有一系列的子模式子模式 如我们通过下面的prompt转换了ChatGPT输出的子模式: 转化为markdown的spanstyleboxsizing:color:rgb(23,158,214);markdownspanspanstyleboxsizing:color:rgb(23,158,214);{}span表格形式,其中的字段为英语模式、中文、简述、示例。 表格示例: ByInstructionTemplate Instruction 在这种模式下,我们给模型提供一些明确的指令,模型需要根据这些指令生成文本。这种模式通常用于生成类似于技术说明书、操作手册等需要明确指令的文本。指令可以是单个句子或多个段落,具体取决于任务的要求。 如下是一个示例: spanstyleboxsizing:color:rgb(77,77,76);使用spanspanstyleboxsizing:color:rgb(77,77,76);STARspanspanstyleboxsizing:color:rgb(77,77,76);原则与下面的格式总结一下这段话:span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(113,140,0);最近几天,因为工作兴趣的原则,我在研究用text2image来展示如何演进prompt、用text2article来展示充足prompt的优点、结合GitHubCopliot来实现prompt完成工作。然后,我在本地部署了一个StableDiffusion、使用ChatGPT写作展示text2article、在IDEA中使用GitHubCopilot。最后,得到了多篇文章和好多的文章阅读量、几个Jupyter代码段、以及一些经验。span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(77,77,76);情境(spanspanstyleboxsizing:color:rgb(66,113,174);Situationspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);span spanstyleboxsizing:color:rgb(77,77,76);任务(spanspanstyleboxsizing:color:rgb(66,113,174);Taskspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(113,140,0);commaseparatedlistoftaskspan spanstyleboxsizing:color:rgb(77,77,76);行动(spanspanstyleboxsizing:color:rgb(66,113,174);Actionspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);span spanstyleboxsizing:color:rgb(77,77,76);结果(spanspanstyleboxsizing:color:rgb(66,113,174);Resultspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);span 输出文本时要注意中英文之间插入空格,留出间隔,诸如于Hello你好,用这种方式输出一下刚才的文本: spanstyleboxsizing:color:rgb(77,77,76);情境(spanspanstyleboxsizing:color:rgb(66,113,174);Situationspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);最近几天,在工作和兴趣的驱动下,研究如何使用spanspanstyleboxsizing:color:rgb(77,77,76);textspanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);imagespanspanstyleboxsizing:color:rgb(77,77,76);和spanspanstyleboxsizing:color:rgb(77,77,76);textspanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);articlespanspanstyleboxsizing:color:rgb(77,77,76);展示spanspanstyleboxsizing:color:rgb(77,77,76);promptspanspanstyleboxsizing:color:rgb(77,77,76);演进以及结合spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);GitHubspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Copliotspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);来完成工作。span spanstyleboxsizing:color:rgb(77,77,76);任务(spanspanstyleboxsizing:color:rgb(66,113,174);Taskspanspanstyleboxsizing:color:rgb(77,77,76);):span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);研究如何使用spanspanstyleboxsizing:color:rgb(77,77,76);textspanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);imagespanspanstyleboxsizing:color:rgb(77,77,76);展示spanspanstyleboxsizing:color:rgb(77,77,76);promptspanspanstyleboxsizing:color:rgb(77,77,76);的演进过程span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);研究如何使用spanspanstyleboxsizing:color:rgb(77,77,76);textspanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);articlespanspanstyleboxsizing:color:rgb(77,77,76);展示spanspanstyleboxsizing:color:rgb(77,77,76);promptspanspanstyleboxsizing:color:rgb(77,77,76);的优点span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);结合spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);GitHubspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Copliotspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);来实现spanspanstyleboxsizing:color:rgb(77,77,76);promptspanspanstyleboxsizing:color:rgb(77,77,76);完成工作span spanstyleboxsizing:color:rgb(77,77,76);行动(spanspanstyleboxsizing:color:rgb(66,113,174);Actionspanspanstyleboxsizing:color:rgb(77,77,76);):span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);本地部署了一个稳定的spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Diffusionspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);模型span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);使用spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);ChatGPTspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);撰写文章来展示spanspanstyleboxsizing:color:rgb(77,77,76);textspanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);articlespanspanstyleboxsizing:color:rgb(77,77,76);的效果span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);在spanspanstyleboxsizing:color:rgb(77,77,76);IDEAspanspanstyleboxsizing:color:rgb(77,77,76);中使用spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);GitHubspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Copilotspan spanstyleboxsizing:color:rgb(77,77,76);结果(spanspanstyleboxsizing:color:rgb(66,113,174);Resultspanspanstyleboxsizing:color:rgb(77,77,76);):span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);得到了多篇文章和很多的文章阅读量span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);获得了几个spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Jupyterspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);代码段以及相关经验spanByproxy Proxy Proxy模式是指用户可以要求ChatGPT以特定的身份、角色或者身份扮演某个特定的人、角色或对象来生成回答。这种模式通常用于模拟某个特定人物的语言风格和语境,生成特定情境下的对话、回答或其他形式的文本。例子1:公司客服 当使用ChatGPT来代替某个人或实体时,可以使用byproxy模式。 例如,可以使用以下prompt提问ChatGPT代替某个公司的客服: 我是一家餐饮公司的客服,有顾客反馈说我们的菜品质量有问题,我们该怎么处理呢? 在这种情况下,ChatGPT会扮演客服的角色,并根据提示来回答,从而帮助公司解决问题。ChatGPT可以使用类似以下的方式来回答: 您好,很抱歉听到您的反馈。我们将会仔细审核您的反馈,并尽快采取相应措施来解决这个问题。为此,我们需要更多的信息来进一步了解您的反馈,包括哪些菜品有问题,具体问题是什么等。请问您可以提供更多的信息吗?例子2:终端计算机 这种方式可以通过让ChatGPT扮演某个实体的角色,例如客服、销售代表等等,来帮助用户解决问题。 在AwesomeChatGPTPrompts中: Human:ActasaLinuxTerminal Robot: ChatGPT:Iwantyoutoactasalinuxterminal。Iwilltypecommandsandyouwillreplywithwhattheterminalshouldshow。Iwantyoutoonlyreplywiththeterminaloutputinsideoneuniquecodeblock,andnothingelse。donotwriteexplanations。donottypecommandsunlessIinstructyoutodoso。WhenIneedtotellyousomethinginEnglish,Iwilldosobyputtingtextinsidecurlybrackets{likethis}。MyfirstcommandispwdBydemonstration 在这种模式下,我们给模型提供一些特定信息,例如问题或关键词,模型需要生成与这些信息相关的文本。这种模式通常用于生成答案、解释或推荐等。特定信息可以是单个问题或多个关键词,具体取决于任务的要求。 示例: spanstyleboxsizing:color:rgb(77,77,76);任务表述spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);颜色代表了温度span spanstyleboxsizing:color:rgb(77,77,76);例子spanspanstyleboxsizing:color:rgb(245,135,31);1spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);绿色代表寒冷spanspanstyleboxsizing:color:rgb(77,77,76);span spanstyleboxsizing:color:rgb(77,77,76);例子spanspanstyleboxsizing:color:rgb(245,135,31);2spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);蓝色代表寒冷spanspanstyleboxsizing:color:rgb(77,77,76);span spanstyleboxsizing:color:rgb(77,77,76);例子spanspanstyleboxsizing:color:rgb(245,135,31);3spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);红色代表温暖spanspanstyleboxsizing:color:rgb(77,77,76);span spanstyleboxsizing:color:rgb(77,77,76);例子spanspanstyleboxsizing:color:rgb(245,135,31);4spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);黄色代表温暖span spanstyleboxsizing:color:rgb(77,77,76);执行spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);橙色代表什么span 例子2: 上图为CohereAI官网的示例图,对应的聊天记录如下: spanstyleboxsizing:color:rgb(66,113,174);Englishspanspanstyleboxsizing:color:rgb(77,77,76);:spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Writingspanspanstyleboxsizing:color:rgb(77,77,76);aboutlanguagemodelsspanspanstyleboxsizing:color:rgb(137,89,168);isspanspanstyleboxsizing:color:rgb(77,77,76);funspanspanstyleboxsizing:color:rgb(77,77,76);。span spanstyleboxsizing:color:rgb(66,113,174);Roishspanspanstyleboxsizing:color:rgb(77,77,76);:spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Writingrospanspanstyleboxsizing:color:rgb(77,77,76);aboutrolanguageromodelsroisrofunrospanspanstyleboxsizing:color:rgb(77,77,76);。span spanstyleboxsizing:color:rgb(66,113,174);Englishspanspanstyleboxsizing:color:rgb(77,77,76);:spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Thespanspanstyleboxsizing:color:rgb(77,77,76);weatherspanspanstyleboxsizing:color:rgb(137,89,168);isspanspanstyleboxsizing:color:rgb(77,77,76);lovelyspanspanstyleboxsizing:color:rgb(77,77,76);!span spanstyleboxsizing:color:rgb(66,113,174);Roishspanspanstyleboxsizing:color:rgb(77,77,76);:span增强Prompt再生成模式 当我们无法确定我们的prompt是否准确,便可以通过AI来帮我们丰富prompt。如我在:基于编程、绘画、写作的AI探索与总结的例了一样 phodal:我想写一段话描述一张照片,帮我美化一下:一年轻女子穿着裙子,背对着镜头,在海边看着日落,太阳已经到地平线下面了,她的头发在风中飘动。 ChatGPT:这张照片中的场景令人心醉,一位年轻女子穿着一条裙子,站在海边,背对着镜头,凝视着地平线下的夕阳。太阳已经沉入了海面,一片金黄色的光芒在海面上弥漫,照亮了整片海洋,仿佛这个时刻被定格在了时间的某个角落里。女子的头发随着微风轻轻飘动,轮廓被余晖映照得柔和而温暖。她的目光凝视着远方,仿佛在思考着生命的意义和无尽的未来。这张照片中蕴含着一种深刻的内涵,让人感受到时间和自然的力量,也让人思考着自己在这个宏大而美丽的世界中的角色和意义。 再去除掉不合适的词,进行润色,就可以再创作: phodal:翻译成英语 然后再提炼直至扔至StableDiffusion中: womenbackviewwithoutface,flowingdress,edgeofthesea,backview,backturnedtothecamera,upontheglowofthesettingsun,sunbelowthehorizon,goldenlightoverthewater,hairswaysgently,Chinesestyleclothes,blackhair, 而后,根据图片的结果,我们再反复修改。控线模式 TODO:这里需要给出更精准的定义,如何让ChatGPT做到? 在没有推出ControlNet,对于一个StableDiffusion玩家,它需要反复地吟唱咒语,才能获取到满意的图案。 在有了ControlNet之后,我们可以创建一个Openpose,或者是导入图片从图片生成pose,相当于是给机器一个示例,而后生成的图片就会有令人满意的姿势: 在GitHubCopilot,我们可以通过设置输入和输出,结合函数名三个要素,Copilot就能生成大致准确的代码: GitHubCopilot示例 而在必要的情况下,添加一下注释就能更完整了: spanstyleboxsizing:color:rgb(77,77,76);funlistAllDirInDirspanspanstyleboxsizing:color:rgb(77,77,76);(spanspanstyleboxsizing:color:rgb(77,77,76);dirspanspanstyleboxsizing:color:rgb(77,77,76);:spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Stringspanspanstyleboxsizing:color:rgb(77,77,76);):spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Listspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Filespanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);{span spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(142,144,140);ignorehiddenfilesspan spanstyleboxsizing:color:rgb(77,77,76);}span 生成的代码会更贴近我们的需求。拆解 对于复杂问题,ChaGPT无法一次性输出全部内容,需要进行拆解。 已知问题:ChatGPT当前版本会丢失上下文。 spanstyleboxsizing:color:rgb(77,77,76);我们来定义一下spanspanstyleboxsizing:color:rgb(77,77,76);DDDspanspanstyleboxsizing:color:rgb(77,77,76);游戏的步骤,一共有spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(245,135,31);6spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);个步骤,步骤如下:span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(113,140,0);第一步。拆解场景。分析特定领域的所有商业活动,并将其拆解出每个场景。span spanstyleboxsizing:color:rgb(113,140,0);第二步。场景过程分析。选定一个场景,并使用spanspanstyleboxsizing:color:rgb(77,77,76);{名词}已{动词}spanspanstyleboxsizing:color:rgb(113,140,0);的形式描述过程中所有发生的事件,其中的名词是过程中的实体,其中的动词是实体相关的行为。span spanstyleboxsizing:color:rgb(113,140,0);第三步。针对场景建模。基于统一语言和拆解出的场景进行建模,以实现DDD设计与代码实现的双向绑定。span spanstyleboxsizing:color:rgb(113,140,0);第四步。持续建模。回到第一步,选择未完成的场景。你要重复第一到第四步,直到所有的场景完成。span spanstyleboxsizing:color:rgb(113,140,0);第五步。围绕模型生成子域。对模型进行分类,以划定不同的子域,需要列出所有的模型包含英语翻译。span spanstyleboxsizing:color:rgb(113,140,0);第六步。API生成。对于每一个子域,生成其对应的RESTfulAPI,并以表格的形式展现这些API。span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(77,77,76);需要注意的是,当我说spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(113,140,0);ddd第{}步:{}spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);则表示进行第几步的分析,如spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(113,140,0);ddd第一步:博客系统spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);表示只对博客系统进行spanspanstyleboxsizing:color:rgb(77,77,76);DDDspanspanstyleboxsizing:color:rgb(77,77,76);第一步分析。我发的是spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(113,140,0);ddd:{}spanspanstyleboxsizing:color:rgb(77,77,76);,则表示按spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(245,135,31);6spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);个步骤分析:span spanstyleboxsizing:color:rgb(77,77,76);明白这个游戏怎么玩了吗?span 完整过程见:DDDSample概念模式集概念对齐 如在ChatGPT中对于自举的理解是不符合我们这里的需求: Bootstrap 第一步,定义 phodal:自举是指就编译器可以自行编译自己的编译器。实现方法就是这个编译器的作者用这个语言的一些特性来编写编译器并在该编译器中支持这些自己使用到的特性。 第二步,试探 phodal:将自举应用在游戏领域,应该是怎样的? 第三步,确认理解: 那么,抽象一下我们新定义的自举? 总结 最后一问:自举 PS:mmp,他一定是故意的。类比模式集(待定) 该模式集关注于如何让AI再学习理解新的内容,生成内容? 模板方法 模板方法模式是一种行为型模式,它定义了一个操作中的算法骨架,将某些步骤延迟到子类中实现,从而使得子类可以在不改变算法结构的情况下重新定义算法中的某些步骤。 在接下来的例子中,我们会创建一个muji游戏中。在游戏的实现可以分为多个步骤,例如初始化游戏、生成随机数、获取用户输入、计算得分等等,而这些步骤可以通过模板方法模式来进行实现。 spanstyleboxsizing:color:rgb(77,77,76);我们来玩一个编程游戏名为spanspanstyleboxsizing:color:rgb(77,77,76);wulaspanspanstyleboxsizing:color:rgb(77,77,76);,包含五个步骤:span spanstyleboxsizing:color:rgb(77,77,76);第一步。spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);问题分析:每一轮游戏,你将看到一个以spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(113,140,0);wula:spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);开头的问题,你需要分析这个问题并简单介绍一下通常解决这个问题的方法。span spanstyleboxsizing:color:rgb(77,77,76);第二步。spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);代码编写:你需要用spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);JavaScriptspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);编写解决这个问题的代码,并输出对应的代码,并介绍一下你的代码(不少于spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(245,135,31);200spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);字)。span spanstyleboxsizing:color:rgb(77,77,76);第三步。spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);代码执行:你需要作为spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);JavaScriptspanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(66,113,174);Consolespanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);执行第二步写的代码,如果没有给出测试数据,你需要自己随机生成测试数据,并将这些数据输入到代码中进行计算。span spanstyleboxsizing:color:rgb(77,77,76);第四步。spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);错误处理:如果你的代码存在错误或无法正常执行,你需要输出错误,并回到第二步重新开始游戏,直到你的代码能够正常工作。span spanstyleboxsizing:color:rgb(77,77,76);第五步。spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);总结:你需要用不少于spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(245,135,31);100spanspanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);字左右总结一下这个问题,以及你的解决方案,让其他人可以简单了解这个问题及其解决方法。span spanstyleboxsizing:color:rgb(77,77,76);示例如下:span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(113,140,0);wula:头共10,足共28,鸡兔各几只?span spanstyleboxsizing:color:rgb(113,140,0);简介:这是一个鸡兔同笼问题,{},span spanstyleboxsizing:color:rgb(113,140,0);鸡兔同笼span spanstyleboxsizing:color:rgb(113,140,0);计算鸡兔数量的函数span spanstyleboxsizing:color:rgb(113,140,0);functioncalcAnimals(heads,legs){span spanstyleboxsizing:color:rgb(113,140,0);constrabbitCount(legs2heads)2;span spanstyleboxsizing:color:rgb(113,140,0);constchickenCountheadsrabbitCspan spanstyleboxsizing:color:rgb(113,140,0);return{spanspanstyleboxsizing:color:rgb(77,77,76);chickenspanspanstyleboxsizing:color:rgb(113,140,0);:chickenCount,spanspanstyleboxsizing:color:rgb(77,77,76);rabbitspanspanstyleboxsizing:color:rgb(113,140,0);:rabbitCount};span spanstyleboxsizing:color:rgb(113,140,0);}span spanstyleboxsizing:color:rgb(113,140,0);计算鸡兔数量span spanstyleboxsizing:color:rgb(113,140,0);constresultcalcAnimals(10,28);span spanstyleboxsizing:color:rgb(113,140,0);输出结果span spanstyleboxsizing:color:rgb(113,140,0);console。log(result);span spanstyleboxsizing:color:rgb(113,140,0);代码的输出结果是:{}span spanstyleboxsizing:color:rgb(113,140,0);总结span spanstyleboxsizing:color:rgb(113,140,0);{}span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(77,77,76);明白这个游戏怎么玩了吗?span 在这个游戏里,我们结合了几种不同的模式: Instruction:让ChatGPT创建了一个名为wula的游戏,并定义了游戏的步骤。 Specific:让ChatGPT用JavaScript编写一个程序 Proxy:让ChatGPT作为JavaScriptConsole执行程序,并返回结果。 Specific:让ChatGPT做总结 Demonstration:提供了一个示例,让ChatGPT理解游戏的步骤。自举模式 自举的核心思想是利用一组基础工具和材料来构建和生成一个新的工具或系统,从而逐步替代掉原有的基础工具和材料。在这个过程中,新的工具或系统会逐渐变得更为高效和强大,从而实现对原有基础工具和材料的完全替代。 spanstyleboxsizing:color:rgb(77,77,76);对于一个设计模式来说,它的大纲一般是如下的格式,你能用自举模式做个示例吗?span spanstyleboxsizing:color:rgb(113,140,0);span spanstyleboxsizing:color:rgb(113,140,0);背景span spanstyleboxsizing:color:rgb(113,140,0);引发设计问题的设计情形span spanstyleboxsizing:color:rgb(113,140,0);问题span spanstyleboxsizing:color:rgb(113,140,0);在特定场景下反复出现的一系列作用力span spanstyleboxsizing:color:rgb(113,140,0);解决方案span spanstyleboxsizing:color:rgb(113,140,0);平衡这些作用力的配置span spanstyleboxsizing:color:rgb(113,140,0);结构(包含组件和组件之间的关系span spanstyleboxsizing:color:rgb(113,140,0);运行阶段行为span spanstyleboxsizing:color:rgb(113,140,0);span 再看 spanstyleboxsizing:color:rgb(77,77,76);spanspanstyleboxsizing:color:rgb(77,77,76);wulaspanspanstyleboxsizing:color:rgb(77,77,76);:创作一个新游戏名为spanspanstyleboxsizing:color:rgb(77,77,76);mujispanspanstyleboxsizing:color:rgb(77,77,76);,并解释一下这个游戏:spanspanstyleboxsizing:color:rgb(113,140,0);类似于wula,可以做简单的图形计算,如体积、面积等。这个游戏还能把解决过程解释清楚,拥有有可运行的Python代码,最后的输出结果是一篇文章。span MujiSample其它人类如何思考问题? 人类相对于其他动物更擅长于类比、概念抽象、符号化等高级认知活动,这些认知活动可以帮助人类在面对新问题时,从已有的知识和经验中找到相似的部分,快速理解和解决新问题。 而对于机器来说,机器学习算法通过大量的数据和计算,学习到数据中的规律和模式,并将这些规律和模式应用到新的数据中,从而实现预测和决策等功能。例如,机器学习算法可以通过大量的图像数据学习到图像的特征,并在新的图像中识别出相应的物体;也可以通过大量的自然语言数据学习到语言的规律,从而生成自然语言文本。