Building A Multi-Agent AI News Generator With Cohere’s Command R 7B

Let’s use Cohere’s new ⌘R 7B to build a Multi-Agent AI news generator.

Before we start, let’s take a look at what we are building!

The application takes user queries, searches the web, and transforms them into a well-crafted news article, complete with citations!

Technology Stack:

LLM: Cohere ultra-fast ⌘R 7B (can also be replaced with a large model you are familiar with)

Multi-agent architecture: CrewAI

The architecture diagram below illustrates some key components (Agent/Task/Tools) and how they interact!

Building A Multi-Agent AI News Generator With Cohere's Command R 7B
Next is a detailed description and code for each component:

Setting up the LLM and web search tools

Also, create a .env file for its corresponding API keys:

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

Define the Senior Research Analyst Agent

The web-search Agent takes user queries, then uses the Serper web-search tool to fetch results from the internet and integrates them.

Check this out πŸ‘‡

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

Define the research_task

This is the research task we assign to the senior research analyst Agent, which includes a description and expected output.

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

Define the content_writer Agent

The role of the content_writer is to utilize the selected results and transform them into a polished, publishable news article.

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

Define the writing_task

All the details and expected output for the writing task are as follows:

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

Launch Crew

All done! βœ…

Just assemble a team and get started! πŸš€

Building A Multi-Agent AI News Generator With Cohere's Command R 7B

⌘R 7B is lightweight, fast, and suitable for enterprise agent RAG use cases.

This is a 7B model that you can also deploy locally! ✨

For more details, see:

http://cohere.com/blog/command-r7b

All code can be found here:

https://github.com/patchy631/ai-engineering-hub/tree/main/ai_news_generator

Building A Multi-Agent AI News Generator With Cohere's Command R 7B
References:
[1]https://x.com/akshay_pachaar/status/1867924163736080495
[2]https://github.com/patchy631/ai-engineering-hub/tree/main/ai_news_generator
[3]https://cohere.com/blog/command-r7b

Leave a Comment