description 和 instructions 以及许多其他设置来提示 Agents。这些设置用于构建发送给语言模型的系统消息。
理解这些提示词是如何创建的将帮助您构建更好的 Agent。
关键的两个参数是:
- Description: 指导 Agent 整体行为的描述。
- Instructions: 关于如何实现其目标的精确、任务特定的指令列表。
Description and instructions only provide a formatting benefit, we do not alter or abstract any information and you can always set the
system_message to provide your own system prompt.系统消息
系统消息是通过description、instructions 和其他一些设置创建的。description 会添加到系统消息的开头,而 instructions 则作为列表添加到 “Instructions” 之后。例如:
instructions.py
debug_mode=True 以查看日志):
直接设置系统消息
您可以通过system_message 参数手动设置系统消息。
用户消息
发送给Agent.run() 或 Agent.print_response() 函数的输入 message 用作用户消息。
默认系统消息
Agent 会创建一个默认的系统消息,可以使用以下参数进行自定义:默认用户消息
Agent 会创建一个默认的用户消息,该消息是输入消息或带有context 的消息(如果 enable_rag=True)。默认用户消息可以使用以下内容进行自定义: