Playback speed
×
Share post
Share post at current time
0:00
/
0:00
Transcript

Building a Multi-agent Financial Analyst

...using Microsoft's Autogen and Llama3-70B.

Lately, we have done quite a few demos where we built multi-agent systems (we’ll link them towards the end of this issue).

Today, let’s do another demo, wherein we’ll build a multi-agent financial analyst using Microsoft’s Autogen and Llama3-70B:

Here’s our tech stack for this demo:

We’ll have two agents in this multi-agent app:

  • Code executor agent → Orchestrates code execution as follows:

    • Accepts user query

    • Collaborates with code writer agent (discussed below)

    • Executes the code locally

    • Collects final results

  • Code writer agent → Uses an LLM to generate code based on user instructions and collaborates with the code executor agent.

If you prefer to watch, we have added a video demo above.

It demonstrates what we’re building today and a quick walkthrough of Qualcomm’s playground to help you get started with everything.


Prerequisites

Get your API keys and free playground access to run Llama 3.1-8B, 70B here →

Next, install the following dependencies and add your API keys obtained from the playground to the .env file.

Define code executor

The LocalCommandLineCodeExecutor runs the AI-generated code and saves all files and results in the specified directory.

Image

Define code executor agent

Code executor agent orchestrates code execution:

  • Accepts user query

  • Collaborates with code writer agent (implemented below)

  • Executes the code locally using the code executor defined above

  • Collects final results

    Image

Define code writer agent

It uses an LLM to generate code based on user instructions and collaborates with the code executor agent.

Image

Almost done!

Start stock analysis

Finally, we provide a query and let the agents collaborate:

Image

Display final results

Recall that we configured the LocalCommandLineCodeExecutor above to save all files and results in the specified directory.

Let’s display the stock analysis chart:

Image

Perfect!

It produces the desired result.

You can find all the code and instructions to run in this GitHub repo: AI Engineering Hub.

We launched this repo recently, wherein we’ll publish the code for such hands-on AI engineering newsletter issues.

This repository will be dedicated to:

  • In-depth tutorials on LLMs and RAGs.

  • Real-world AI agent applications.

  • Examples to implement, adapt, and scale in your projects.

Find it here: AI Engineering Hub (and do star it).

🙌 Also, a big thanks to Qualcomm for partnering with us and letting us use one of the fastest LLM inference engines they provide for today’s newsletter issue.

👉 Over to you: What other topics would you like to learn about?

Thanks for reading Daily Dose of Data Science! Subscribe below and receive a free data science PDF (530+ pages) with 150+ core data science and machine learning lessons.


P.S. For those wanting to develop “Industry ML” expertise:

At the end of the day, all businesses care about impact. That’s it!

  • Can you reduce costs?

  • Drive revenue?

  • Can you scale ML models?

  • Predict trends before they happen?

We have discussed several other topics (with implementations) in the past that align with such topics.

Develop "Industry ML" Skills

Here are some of them:

All these resources will help you cultivate key skills that businesses and companies care about the most.


SPONSOR US

Get your product in front of 115,000+ data scientists and machine learning professionals.

Our newsletter puts your products and services directly in front of an audience that matters — thousands of leaders, senior data scientists, machine learning engineers, data analysts, etc., who have influence over significant tech decisions and big purchases.

To ensure your product reaches this influential audience, reserve your space here or reply to this email to ensure your product reaches this influential audience.