Coder Social home page Coder Social logo

rocklandceo / financial-analysis-chatbot-with-chat-gpt-rag-llamaindex-and-langchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from actualityai/financial-analysis-chatbot-with-chat-gpt-rag-llamaindex-and-langchain

0.0 0.0 0.0 1.36 MB

Revolutionising Investment Analysis with AI - Annual Reports Compared

License: MIT License

Python 100.00%

financial-analysis-chatbot-with-chat-gpt-rag-llamaindex-and-langchain's Introduction

Financial Analysis chatbot with Chat GPT, RAG, LlamaIndex and Langchain.

This chatbot is different to others in that is built to avoid the poor performance of chatbots that have the embeddings of multiple PDF and other documents all embedded together in one large dataset.

Instead it uses Retrieval Augmented Generation (RAG) and LlamaIndex to not only create a separate embeddings dataset for each PDF but it uses QueryEngineTool and SubQuestionQueryEngine to break down a complex query (like compare and contrast) into multiple sub questions and sends them to their specific targetted dataset.

All responses are then gathered and sent to a response synthesiser to produce the final response to your question.

Tech used includes Chat GPT / Open Ai, Retrieval Augmented Generation (RAG), LlamaIndex and, under the hood, LlamaIndex uses Langchain.

Video Tutorial

https://www.youtube.com/watch?v=VeyTTpZs5S8&ab_channel=ActualityAI

Instructions

Step 1

First, install the required packages:

pip install -r requirements.txt

Step 2

Copy and paste your Open AI API key in both the embed.py and chat.py files here

openai.api_key = "copy-and-paste-your-openai-api-key-here"

Step 3

Run embed.py

python embed.py 

This will create 2 new sub directories containing embeddings created from the 2 PDF files which will be called apple_docs.DB and ms_docs.DB

apple_docs.DB are the emebeddings created from the text of the PDF of Apple's most recent 10-K (Annual Report) and ms_docs.DB are the emebeddings created from the text of the PDF of Microsoft's most recent 10-K (Annual Report)

Step 4

Talk to the chatbot :

python chat.py

Any question you ask will result in two things :

  1. It will be broken down into multiple sub questions and then sent to both datasets.
  2. All responses are then gathered and sent to a response synthesiser to produce the final response to your question.

The multiple sub questions in step one will all be colour coded so you can see what questions are being directed to what dataset and also what their response was.

The final response from step 2 (which is not colour coded) will then be displayed.

For example try a simple question like "What was the profit info for the year?"

Or perhaps something much more complicated like ... "How have the profit margins evolved, and what are the key drivers? Break them down into a summary for both companies formatted as bullet points."

financial-analysis-chatbot-with-chat-gpt-rag-llamaindex-and-langchain's People

Contributors

actualityai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.