Investors make use of Asset Management companies to efficiently manage their assets on their behalf without having any concerns, therefore choosing the correct company is very important which means investors need to query what they want to know in order to make a decision. Asset Management companies want to make sure that they can appeal to investors by providing them with information through their websites. Finding an asset management company that suits your needs and convincing investors to choose your asset management company to assist can be daunting for both parties. AI can alleviate this for both the investor and the asset management company by making sure the investor's questions are answered and the asset management company can answer questions without human interaction.
Asset Management companies rely on their website to provide information about their investment and financial services so that investors are willing to choose them, but how does an investor simplify the process of obtaining answers about an asset management company? This can be resolved with MindsDB's integration with LlamaIndex by creating a Q&A model.
MindsDB is an AI Automation platform for building AI/ML powered features and applications. It works by connecting any data source with any AI/ML model or framework and automating how real-time data flows between them. MindsDB is integrated with LlamaIndex, which makes use of its data framework for connecting custom data sources to large language models. LlamaIndex data ingestion allows you to connect to data sources like PDF’s, webpages, etc., provides data indexing and a query interface that takes input prompts from your data and provides knowledge-augmented responses, thus making it easy to Q&A over documents and webpages.
For this case, let's explore how to create a Q&A model for the Asset Management company Blackrock that can help investors obtain information seamlessly. This can be done using LlamaIndex, OpenAI as the LLM, and Blackrock’s About-Us webpage.
Blackrock is an asset management company that provides services to investors for investment, advisory and risk management solutions and makes a great example of how creating a Q&A model with MindsDB’s integration with LlamaIndex can be beneficial.
How to create a Q&A model using MindsDB and LlamaIndex.
MindsDB has a great SQL Editor in it's Cloud GUI for you to use. If you would like to sign up for a demo Cloud account, you can do so here.
To create a model, you will have to create the ML engine using the CREATE ML_ENGINE
syntax in the SQL Editor.
CREATE ML_ENGINE engine_name
FROM llama_index
You can provide the name llamaindex
to the ML_ENGINE.
On execution, you get:
We will make use of a file that has been uploaded into the GUI. If you would like to know how to upload a file, you can check the documentation here.. You can find a sample dataset here.
To upload the file, navigate to the 'Add Icon' on the MindsDB Gui and Upload File.
You can ensure that the data has been uploaded by selecting the file.
Run the following syntax:
SELECT * FROM files.about_blackrock LIMIT 10;
On execution, you get:
Once you have created the engine and successfully uploaded your file, you can create the model with the CREATE MODEL
syntax.
CREATE MODEL model_name
FROM datasource
(SELECT * FROM table_name)
PREDICT column_to_be_predicted
USING
engine = 'llamaindex',
index_class = 'vector_store_index',
reader = 'reader_type',
source_url_link = 'source_url_link',
input_column = 'column_name',
openai_api_key = 'your_api_key';
To ensure that the model is created based on the LlamaIndex engine, the USING
clause is used to include the engine
which is the ml_engine LlamaIndex, index_class
is used to define the type of index class used, reader
to define the type of reader for the data scrapping, source_url_link
defines the URL link used to get the answers from, input_column
defines the column used to prompt the model, and openai_api_key
is defined with your OpenAI key to gain access to OpenAI models.
CREATE MODEL qa_blackrock
FROM files
(SELECT * FROM about_blackrock)
PREDICT Answers
USING
engine = 'llamaindex',
index_class = 'GPTVectorStoreIndex',
reader = 'DFReader',
source_url_link = 'https://www.blackrock.com/za/individual/about-us',
input_column = 'Questions',
openai_api_key = 'your_api_key';
On execution, you get:
Where:
Expression | Description |
---|---|
qa_blackrock |
The name provided to the model. |
engine |
The engine used, which is Llamaindex. |
qa_blackrock |
The name provided of the model. |
engine |
The engine name - here, LlamaIndex. |
index_class |
The vector store index used. |
reader |
The reader that reads the data/webpage. |
input_column |
prompt provided as a question to the model. |
openai_api_key |
API key of the LLM OpenAI. |
source_url_link |
The webpage link. |
input_column |
The column that stores prompt to the model. |
openai_api_key |
OpenAI API key. |
The status of the model can be verified that it has trained successfully into a complete status by using the DESCRIBE
syntax.
DESCRIBE qa_blackrock
On execution, you get:
Querying the Q&A model
The Q&A model has been successfully created and can now be prompted with questions with the SELECT
statement.
SELECT Questions,Answers
FROM mindsdb.qa_blackrock
WHERE Questions = 'What is the best long term investment with minimal risks for private investors';
On execution, you get:
The answer provided is:
The best long-term investment with minimal risks for private investors is a diversified portfolio of low-cost index funds. These funds typically track a broad market index, such as the S&P 500, and provide exposure to a wide variety of publicly traded companies with minimal risk. Blackrock is one of the largest asset management companies in the world, and offers a range of index funds, exchange-traded funds, and other investment products for private investors.
You can also query batch predictions using the JOIN
clause.
SELECT a.Questions,b.Answers
FROM mindsdb.qa_blackrock as b
JOIN files.about_blackrock as a;
On execution, you get:
The Q&A model has successfully retrieved information from the webpage and answered the questions prompted
How can Investors and Asset Management companies incorporate a Q&A model?
Not only can the investors create this Q&A model for themself for decision-making about multiple asset management companies, but also the asset management company can use it to make sure that possible clients are equipped to have their questions answered.
Asset Management companies can embed this Q&A model into their webpage which allows a reader/investor to prompt the model questions about the given webpage, therefore sparing time of having to read through the whole webpage and allowing investors to obtain the information they are looking for.
AI Workflows with MindsDB
Being able to have users come to your website and QA your webpage is great, but being notified about the questions your webpage is receiving is even better.
An AI workflow can be created by sending the questions prompting the Q&A model as slack notifications in an organization's Slack channel using MindsDB's application integration with Slack.
Connecting Slack to MindsDB can be done in quick easy steps:
- Connecting an existing Slack Application to MindsDB OR
- Create a new Slack application to connect to MindsDB
Slack-SDK is used to implement this handler, which is a Python Library offering a package for each of Slack’s APIs. As we are sending notifications to Slack,the Slack app token for authentication will be used to set up a Slack application to receive notifications. You can follow Method 1 in this guide to see how you can set up a Slack app and a Bot User OAuth Token.
Connecting Slack to MindsDB
Once you have created a Slack app or have an existing one, you can go ahead and connect the Slack application to MindsDB.
The CREATE DATABASE
syntax would be used to establish a connection between Slack and MindsDB using the Bot User OAuth Token.
CREATE DATABASE slack_app
WITH
ENGINE = 'slack',
PARAMETERS = {
"token": "xoxb-your_token"
};
On execution, you get:
Query successfull
Setting up an AI Workflow.
As this use case is for a Q&A model being embedded into a website, the model's data source will be adjusted.
The question that will prompt the model will first be saved into a database, and then the model will be trained and provided an answer on the webpage.
Instead of the model, that needs to be embedded into the website, which syntax is this:
CREATE MODEL qa_blackrock
FROM files
(SELECT * FROM about_blackrock)
PREDICT Answers
USING
engine = 'blackrock_qa',
index_class = 'GPTVectorStoreIndex',
reader = 'DFReader',
source_url_link = 'https://www.blackrock.com/za/individual/about-us',
input_column = 'Questions',
openai_api_key = 'your_api_key';
The syntax will rather look like this:
CREATE MODEL qa_blackrock
FROM database
(SELECT * FROM schema.table)
PREDICT Answers
USING
engine = 'blackrock_qa',
index_class = 'GPTVectorStoreIndex',
reader = 'DFReader',
source_url_link = 'https://www.blackrock.com/za/individual/about-us',
input_column = 'Questions',
openai_api_key = 'your_api_key';
For the sake of this example,we will continue to use files as the datasource.
Here is how to send messages to a Slack channel:
INSERT INTO slack_app.channels (channel, text)
VALUES("llama_test", "Here are questions from potential investors");
On execution, you get:
In the Slack channel you will see the message notification:
Now you can set up a job to receive notifications each time your webpage gets prompted a question. The CREATE JOB
syntax will be used.
CREATE JOB investor_questions (
RETRAIN qa_blackrock
USING
join_learn_process = true;
INSERT INTO slack_app.channels (channel, text)
VALUES("llama_test", "Here are questions from potential investors");
INSERT INTO slack_app.channels(channel, text)
SELECT "llama_test" AS channel,
concat('Question: ', a.Questions, chr(10), 'Answer: ', b.Answers) as text
FROM mindsdb.qa_blackrock as b
JOIN files.about_blackrock as a
LIMIT 3;
)
EVERY 5 minutes;
You will receive notifications every 5 minutes if the Q&A model is prompted:
You have successfully set up a Q&A model that can be used to be embedded into your webpage and also have an AI workflow that sends notifications to your slack channel each time your model is prompted.
This creates an overview of the kind of information that investors are looking for. It can help you see what services you lack and can implement into your business model. You can take these questions and enhance your webpage’s information. Thus improving the quality of your webpage even further. With the power of Large Language Models, MindsDB makes it possible to serve your potential interested investors, improving the consumer experience and leveraging the power of AI workflows to improve the quality of your company’s presentation as a website.
You check out MindsDB by signing up for a demo account. If you would like to learn more you can visit MindsDB's Documentation. If you want to contribute to MindsDB, visit their Github repository and if you like it give it a star. MindsDB has a vibrant Slack Community and amazing team that provides technical support, if you would like to join you can sign up here.
Twitter:Chan_vdw
Github: chandrevdw31
Top comments (3)
Very informative article. Loved reading it. 👌
This tutorial is informative and very well explained
Thank you so much Shobhit