AutoGen is a Microsoft open-source library for enabling Large Language Model (LLM) applications with multi-agent collaborations, teach ability and personalisation. With the AutoGen framework, users can build LLM workflows.
This example writes a blog post with a maximum length of 3 paragraphs. The subject is "Artificial Intelligence".
It uses OpenAI's ChatGPT 4 model.
This example uses a total of 6 agents using reflection. Reflection is a general prompting strategy which involves having LLMs analyse their own outputs, behaviours, knowledge, or reasoning processes.
The Critic agent coordinates the work and uses the Writer agent to write a blog post.
A set of 4 reviewer agents are nested within the Critic agent as the "inner monologue" of the Critic agent to reflect on the blog post written by the Writer agent. These 4 nested reviewer agents are:
- A "Search Engine Optimisation (SEO) Reviewer" that optimises the content for search engines
- A "Legal Reviewer" that checks for legal compliance
- A "Ethical Reviewer" that checks that there are no ethical issues
- A "Meta Reviewer" that aggregates and reviews the work of the previous 3 reviewers and generates final suggestions about the content. Note that the first 3 reviewer agents have their answers summarised and JSON formatted by an LLM before their answers are passed on to the ""Meta Reviewer", so that the "Meta Reviewer" can better processes these answers.
This example uses a maximum of 2 turns, which means that the initial answer from the Writer agent gets reviewed and then the review suggestions get forwarded by the Critic agent to the Writer agent again. The Writer agent then generates the final answer that incorporates the feedback from the reviewers.
You need an OpenAI API key for this example. Get your OpenAI API key here. You can insert your OpenAI API key in the main.py
script, or you can supply your OpenAI API key either via the .env
file, or through an environment variable called OPENAI_API_KEY
. If you don't want to use an OpenAI model, then you can also use other models, including local models.
>>>>> The final answer will look similar to this example: <<<<< |
---|
Artificial Intelligence (AI) is rapidly transforming industries across the board, from enhancing efficiencies in the healthcare sector to raising significant ethical and privacy concerns. Modern AI applications, like predictive healthcare analytics, are not just innovative; they're proving essential in managing unprecedented volumes of data and improving patient outcomes. Moreover, AI's integration into everyday technologies — from smartphones to autonomous vehicles — illustrates its widespread impact and potential to further shape our digital future.
Despite its benefits, AI introduces complex challenges, particularly concerning job displacement and privacy. As AI automates tasks, sectors such as manufacturing and administrative services face the highest risk of job loss, urging a societal shift towards reskilling and adapting workforce capabilities. Privacy issues are equally pressing; AI's ability to process vast amounts of personal data raises significant concerns about individual rights and freedoms, necessitating strict compliance with evolving privacy laws and regulations.
Navigating the future with AI demands a balanced approach, embracing its transformative possibilities while vigilantly addressing ethical and legal implications. It's essential for stakeholders to engage in ongoing dialogues about fair AI practices, promote transparency, and ensure an equitable distribution of AI advances. By responsibly leveraging AI, industries can achieve unprecedented growth and innovation, ultimately enhancing global welfare and leading us towards a more efficient, sustainable, and equitable future.