多代理博客生成器
我用3个AI代理组成了一个团队。内容策略师负责编写大纲,博客作家负责撰写博客,编辑负责校对。

在黑客松期间,我决定探索多AI代理系统。与通常的LLM交互不同,机器需要在每一步都持续获得人类的反馈,而多AI代理系统中,多个LLM代理(具有不同的角色、目标和背景故事)相互协作并互相提示。
除此之外,这些代理可以与工具互动,如使用API、读取个人数据等。它与模型无关,因此你可以使用OpenAI GPT模型、Cohere、Llama、Huggingface等。
我用了一天时间完成了DeepLearning.ai关于多AI代理系统的快速课程,并开始动手实践。接下来的几天里,我用3个代理组成了一个团队。内容策略师负责编写大纲,博客作家负责撰写博客,编辑负责校对。
content_strategist = Agent(
role='Senior Content Strategist',
goal="Plan an outline for a blog post content to highlight new discoveries and educate your readers about {topic}",
backstory="""You work for a fun startup that loves to tinker with new technologies.
You love your work and have a passion for structured communication.
Your expertise lies in organizing content effectively so it's easy to follow and understand.
You have a knack for dissecting huge chunks of information, highlighting the important points, creating lesson plans, and sharing your learnings with other people.""",
verbose=True,
allow_delegation=False,
tools=[search_tool, scrape_tool, read_notes, semantic_search_notes],
step_callback=lambda step: self.step_callback(step, "Content Strategist")
)
blog_writer = Agent(
role='Tech Blogger',
goal='Craft a compelling blog post about {topic} based on given outline and notes',
backstory="""You are a renowned tech blogger, known for your insightful and engaging articles that are easy to follow and learn from.
You have years of experience writing guides about {topic}, learning reflections, teaching and mentoring people.
You are excellent at synthesizing lots of information with clarity and brevity.
You like to make your articles fun to read, like metaphors and appropriately inserting emojis where suitable.
You transform complex concepts into compelling narratives that is easy to understand.""",
verbose=True,
allow_delegation=True,
tools=[read_notes, semantic_search_notes],
step_callback=lambda step: self.step_callback(step, "Tech Blogger")
)
editor = Agent(
role='Senior Blog Editor',
goal='Proofread blogs to ensure the content is fun to read, informative, accurately includes the important points',
backstory="""You work as a senior blog editor with years of experience in writing.
You have great attention to details, ensuring the concepts are best delivered, well-written, and search engine optimized.
You take pride in only publishing the very best writing.""",
verbose=True,
allow_delegation=True,
tools=[read_notes, semantic_search_notes],
step_callback=lambda step: self.step_callback(step, "Senior Blog Editor")
)
提示感觉是另一种工艺。我不会称之为编程。正如课程中所述,一个很好的思维框架是像管理者一样思考。目标是什么?流程是什么?我需要雇用什么样的人来完成它?
这里是一个关于Crew AI的示例摘录,使用我从课程中写下的笔记。由我本人撰写,Crew AI多AI代理系统。
在Crew AI的核心是多代理系统,其中AI代理协同工作以实现共同目标。这些代理被训练成专门执行特定任务,如研究、写作或分析,并可以无缝地相互交互以实现复杂目标。通过利用Crew AI,开发人员可以创建动态系统,其中代理可以委派任务、共享信息并协同工作以实现最佳结果。
通过将任务结构化为明确的角色、目标和背景故事,Crew AI使开发人员能够创建复杂的workflow,模仿现实世界的情景。从内容规划到客户服务自动化,Crew AI可以简化流程、提高效率并增强整体用户体验。
1、想法
还不错……并不明显比直接提示LLM好很多。但将任务分解成每个代理(具有其专业知识)将处理的块,使结果更加集中和针对其有限的上下文量身定制。你还可以让代理自动相互碰撞想法并委派任务。
我对于可以插入特定任务的工具感到兴奋,例如:
SerperDevTool
允许代理在Google上搜索主题,ScrapeWebsiteTool
从特定URL刮取内容,WebsiteSearchTool
对网站进行RAG语义搜索,FileReadTool
读取文件,MDXSearchTool
对markdown文件进行语义搜索。
不过,当我了解到SerperDevTool是付费API时,我感到很失望:

2、创建一个UI
我并不满意在终端中看到执行日志,决定为其搭建一个Streamlit UI。我对streamlit很陌生,所以这个教程对我开始很有帮助。

3、用我的读书笔记试一试
如果你阅读这篇博客,你就会知道我喜欢为我读过的书写总结,但这很耗时间。Tldr;在我的过程中,我会在阅读一本书时做高亮和笔记,然后在写总结时阅读这些笔记。
当然,还有更多细微差别,我并不期望crew能捕捉到,因为挑选仅包含在摘要中的重要点是品味的问题 🍩。
借助我创建的博客构建器,我现在可以将包含我导出笔记的markdown文件作为上下文传递,并尝试生成博客。它工作得相当好!不会取代我,但这是一个很好的开始,以克服空白页面的诅咒,而大部分工作变成了编辑工作 🤓。
我们传递的上下文笔记。看起来非常原始 🥩。

这是我们的高级内容策略师生成的初始大纲 🤖

这是高级博客编辑最终确定的大纲 🤖

4、未来的想法
Crew AI自己在repo中有一些示例,比如游戏构建器、为Instagram帖子生成图像描述和副本(可以将其输入到图像生成器如Midjourney中)、创建着陆页、营销策略、旅行/活动计划器等。
如果你发现自己花费数小时来做某事,我认为值得写一个crew来为你完成它或引导你完成它。
我相信AI是伟大的导师,并将取代任务(而不是工作)。Crew AI似乎建立了一个很好的框架来扩展LLM所提供的功能。干杯 🍻
原文链接:Creating a Blog Builder with Multi AI Agent
汇智网翻译整理,转载请标明出处