AutoGPT源码的17个收获
阅读完AutoGPT源码后,对openai的api有17个新的认知:
- 用极严苛的标准(规范的json)来规范输出,让输出更容易用代码来串联。gpt能遵循的很好。
- [prompt原文]Constructively self-criticize your big-picture behavior constantly.
- [prompt原文]Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.
- prompt的长度能比想像的长很多。AutoGPT的初始输入模板大概有3000+字符,prompt要够长才能够好用。
- 用assistant role做COT。
- 用计算的token使用量控制输入。
- [prompt原文]~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.
- [prompt原文]If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
- 分section描述要求,prompt要分段,用好换行符来表达段落。
- 限制loop次数和重复次数。
- 每次都把时间告诉llm。
- context用system role。This reminds you of these events from your past:\\n{relevant_memory}\\n\\n。历史信息要根据内容相似度与当前请求做一次筛查。
- token个数可以用tiktoken算的,不需要请求openai。
- 把human feedback追加到历史记录中,这个很聪明,比纯的assistant历史要好。
- command的结果和14的处理是一样的。
- system相当于你希望他知道的知识,省了组织忽悠的话了。
- COT的实现:
- 在messages加了完整历史对话,assistant消息
- 在prompt中加了按相似度抽取的部分消息:This reminds you of these events from your past:xxx