π°News Agent
Staying current with the latest developments is crucial, especially in the fast-paced world of technology and artificial intelligence. A News Agent can help you stay informed by gathering the latest n
Be upto date on what's happening using News Agent
Import Required Libraries
First, import the necessary libraries and modules. These modules will enable the agent to perform web searches, handle task planning, and display results in a readable format.
Setup LLM
Set up the environment variables required for Azure OpenAI configuration. These environment variables include the base URL, deployment name, model name, API version, and API key. This configuration is essential for the Large Language Model (LLM) to function correctly.
Define Admin
Create an Admin instance to manage actions and execute tasks. The Admin will use the DuckDuckGoSearch tool to perform web searches and the TaskPlanner to manage task execution without human intervention.
Execute Agent LLM
Run the Admin with a specific query to fetch the latest news about AI from the web. In this case, the query is set to find recent news related to "Recent AI News Microsoft." The Admin will process this query and return the relevant news articles.
Print the Results
Finally, use the rich library to output the results in a readable format. The Markdown class helps in rendering the news content neatly in the console.
By following these steps, you can set up a News Agent that keeps you updated with the latest news in the field of artificial intelligence. This example uses the power of Azure's GPT-4 model and OpenAGI to perform efficient web searches and present the information in an easily digestible format.
Sample Output
When the above code is executed, the output in the console might look like this:
This output showcases the latest news articles related to Microsoft's developments in artificial intelligence, formatted neatly for readability.
Last updated