Building an AI Crew to Analyze Financial Data with CrewAI and n8n

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is a quick introduction on setting up an environment for AI automation using a team of AI agents we're going to use financial analysis as the first use case to get started specifically we're going to use fundamental stock analysis with SEC 10K data so what is this SEC 10K data SEC 10K 10K data is a comprehensive report that is filed annually by a public traded company about its Financial performance and it is a requirement by the uh SEC this report contains a lot of detailed information and it's sent to shareholders uh before an annual meeting so this is uh a source of great insight for Value investors to understand deeply about a company so the use case that we're going to uh do specifically is to automatically analyze uh this SEC 10K data to gain a deep understanding of a company in this case we're going to take Nvidia as an example of the company that we're going to uh Deep dive in with our AI agents so one of the key things uh that we we can do with the crew of AI agents is the ability for it to figure out the right questions to ask uh given a certain prompt so we'll we'll see that uh in action shortly and at the end of the analysis uh it's going to produce a report that gives us much deeper insight about a company so to set the stage uh we're going to uh set up a AI crew so this is a team of agents and there's going to be three personas the first is a uh senior research analyst they're responsible for interacting with the SEC 10K data and uncover insights into the company NVIDIA the second uh Persona is a Visionary so this Visionary develops uh or does deep thinking on the implications of analysis uh that's done by the senior research analyst so this is uh looking at the implications of Technology implications of the analysis and finally there is a senior editor who writes professional quality articles that are easy to understand so they are the one that uh puts everything together to present a report so how we're going to uh build this out is uh we going we're going to use uh two main Technologies one is uh crew AI so crew AI is a AI agent framework that's designed to enable a AI agents to assume roles like uh what we Shar in the previous slide uh to share goals so that they can work together on a common task and work together in a cohesive uh unit uh just just like a a team would uh in in real life and this uh crew of Agents uh if this framework allows us to express interactions of agents in in a much easier way so this is um uh on uh on one hand uh the the crew of agents that will drive the analysis on on the right hand side uh we're taking a no code or low code approach uh to um to to uh help drive this uh uh analysis so um on the right hand side is a flow visual flow that I'm using with a tool called n8n and so there's going to be a template in the uh riplet that I will show uh shortly uh which uh um has this flow and essentially um this is a Q&A flow so uh we load in the sec1 data 10K data into uh this Vector store and this is the retrieval part of it so um the crew of AI agents will call into this uh web hook and then get this information back to help answer the questions about um Nvidia all right so here's uh at the end what the report will look like and I'll give you uh a a view so this is the report that the crew of Agents uh will uh produce an example of a report so it will uh give you a lot of uh comprehensive information about uh this company the key business models the uh breakthrough Technologies potential industry impacts uh competitive landscape major risks and come up with a conclusion so this is all from uh fundamental analysis with SEC 10K uh information so let's go ahead and dive into uh the environment uh that produces this and and we'll look more into the details of of the flow okay so let's uh walk through the uh development environment so in the uh video below I will put a link that uh gives you uh a link to this uh riplet so this riplet allows you to just uh Fork your own and just create a development environment uh exactly like this very easily right so you can take this URL and then you Fork it and then uh and then when you go to uh main.py uh you'll have uh this code so uh this code actually has uh uh additional comment out um uh things that enable you to do web searches and um I've added also uh a a um section here for open BB tools that we'll add to that uh in a future video so so there's um um a lot more capabilities in here but let's start with just the uh SC SEC tools okay so SEC tools is uh What uh we're using here to call into na10 so in this tool here I've uh created uh something that uh you know tells the large language model uh that this is a tool about uh SC SEC 10K about Nvidia and that it's useful for answering fundamental questions about Nvidia from the SEC 10K all right so then uh when the AI uh determines that it needs to use the tool it's going to call into uh this web uh hook here right this web Hook is environment variable that you set in your secrets right so um I'll also link to the video on on building the uh chat with your data flow in n10 so I'll do that in the link uh so I you know I have this tool and I instantiate the tool here now I'm using a service here called uh together. one of the things I like about this service is that it has a lot of um a l large amount of Open Source models one of the open source models that we're using here is this one by news research I I just found that this to be a quite a good model uh that's uh based on the mistal small uh which is uh the one of the first open source uh mixture of experts um large language model so this is this is quite a good one and uh when you sign up for together. a they give you $25 credit uh so it's just really uh handy uh when uh doing um this kind of experimentation so um I've put in their basal in here and now in this section of code all I've done is defined uh the three agents uh the senior research analyst and I go into some more details into what they do and the Visionary go into some details here in terms of what they do and then the senior writer and or editor some details here and then this part here is then the task that we're asked we're asking this crew of agents to do all right so the first task is uh done by the senior um research and they're going to conduct a comprehensive analysis this is the uh different things that they're going to be doing and the expected output is a full analysis in bullet form uh this is the second task is stun by the Visionary and uh they uh take the output and they uh dive deeper into it right they dive deeper into the uh results of uh what the senior analyst does and finally the third task is done by the writer uh who summarizes and and makes it professional writing quality so let's go ahead and then uh try this out and I can explain what it's doing right so to run it I go python name. Pui all right so it's uh running the first task uh by the senior uh research agent you can see this and look what it's doing uh it's asking so so the AI is figuring out uh what questions to ask and what tools to call to answer the question so uh it's figuring out what are the risk factors and then calling the tool and inside this tool it's calling the n10 workflow and answering that question all right so it's going to go through and cycle through and uh iterate through so look at the other question uh who are n's competitors and how does it compare to them and so it's figuring out based on this initial prompt what are the specific questions to ask and then it's going uh to the N1 flow which then uh chats with the um chats with the vector store and it finds the answer all right so then uh the SC analyst uh has finished their work and now the Visionary is adding to it right so it's taking this task and it's adding uh more uh insight into it so you can see additional insights here and then finally uh it's going to uh uh work with uh have a conversation with the senior uh uh research analyst and ask more questions so that it can uh get more insight all right so there's more insight here and then you can see it processing and thinking more and now we're going to the senior editor side so this person is uh uh taking that information from both the senior analyst as well as Visionary and pulling it together uh for a report so um that's uh kind of the the gist of how how this works um I've put into a section here of the templates so this is your na10 uh template and you can use this into N1 and I'll link that into the the U uh the video section as well okay um all right uh so so um hope hope this helps to get uh uh you started and uh um let me know uh in the comments if you have any questions
Info
Channel: Derek Cheung
Views: 9,015
Rating: undefined out of 5
Keywords:
Id: pMvizUx5n1g
Channel Id: undefined
Length: 10min 24sec (624 seconds)
Published: Tue Mar 12 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.