{"id":21941,"date":"2023-08-27T09:50:22","date_gmt":"2023-08-27T09:50:22","guid":{"rendered":"https:\/\/algotrading101.com\/learn\/?p=21941"},"modified":"2023-11-15T20:01:34","modified_gmt":"2023-11-15T20:01:34","slug":"warren-buffett-chatbot-chatgpt-openai","status":"publish","type":"post","link":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/","title":{"rendered":"Build a Warren Buffett Chatbot using OpenAI&#8217;s API"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"900\" height=\"675\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet.webp\" alt=\"\" class=\"wp-image-22054\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet.webp 900w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet-300x225.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet-768x576.webp 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">Note that this article does not refer to custom GPTs. Using custom GPTs, it is possible to build a Warren Buffett chatbot without code. Learn more about custom GPTs <a href=\"https:\/\/openai.com\/blog\/introducing-gpts\">here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Table of contents:<\/h3>\n\n\n\n<ol>\n<li><a href=\"#how-to-build-warren-buffett-chatbot\">How to build a Warren Buffett Chatbot<\/a><\/li>\n\n\n\n<li><a href=\"#what-is-openai\">What is OpenAI?<\/a><\/li>\n\n\n\n<li><a href=\"#what-is-chatgpt\">What is ChatGPT?<\/a><\/li>\n\n\n\n<li><a href=\"#what-is-whisper\">What is Whisper?<\/a><\/li>\n\n\n\n<li><a href=\"#what-is-stable-whisper\">What is StableWhisper?<\/a><\/li>\n\n\n\n<li><a href=\"#getting-started\">Getting started<\/a><\/li>\n\n\n\n<li><a href=\"#what-is-diarization\">What is Diarization?<\/a><\/li>\n\n\n\n<li><a href=\"#perform-diarization-and-transcription\">How to perform diarization and transcription with Whisper?<\/a>\n<ul>\n<li><a href=\"#pre-requisites\">Installing pre-requisites<\/a><\/li>\n\n\n\n<li><a href=\"#transcription-and-diarization\">Transcription and diarization<\/a><\/li>\n\n\n\n<li><a href=\"#cleaning-videos-and-transcripts\">Cleaning videos and transcripts<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#what-is-fine-tuning\">What is fine-tuning?<\/a><\/li>\n\n\n\n<li><a href=\"#chatgpt-fine-tuning\">How to organize the data for ChatGPT finetuning?<\/a><\/li>\n\n\n\n<li><a href=\"#fine-tune-chatgpt\">How to fine-tune ChatGPT on your own data?<\/a><\/li>\n\n\n\n<li><a href=\"#chat-with-warren-buffet-chatgpt\">How to chat with Warren Buffett using ChatGPT?<\/a><\/li>\n\n\n\n<li><a href=\"#thoughts-and-ideas\">My thoughts and ideas<\/a><\/li>\n\n\n\n<li><a href=\"#full-code\">Full code<\/a><\/li>\n<\/ol>\n\n\n\n<a name=\"how-to-build-warren-buffett-chatbot\">\n\n\n\n<h2 class=\"wp-block-heading\">How to build a Warren Buffett Chatbot using OpenAI?<\/h2>\n\n\n\n<p>First, we will collect data on Warren Buffett&#8217;s market knowledge via video interviews. Next, we will clean and process this data. Lastly, using OpenAI&#8217;s API, we will fine-tune our own ChatGPT model by training it on the prepared data.<\/p>\n\n\n\n<a name=\"what-is-openai\">\n\n\n\n<h2 class=\"wp-block-heading\">What is OpenAI?<\/h2>\n\n\n\n<p>OpenAI is an American artificial intelligence research laboratory that is primarily focused on NLP tasks through using Large Language Models (LLMS) such as ChatGPT, Whisper, and the like.<\/p>\n\n\n\n<p>Link to website: <a href=\"https:\/\/openai.com\">https:\/\/openai.com<\/a><\/p>\n\n\n\n<a name=\"what-is-chatgpt\">\n\n\n\n<h2 class=\"wp-block-heading\">What is ChatGPT?<\/h2>\n\n\n\n<p>ChatGPT is an LLM developed by OpenAI that is used for solving a wide range of tasks ranging from finance to bedtime stories.<\/p>\n\n\n\n<p>Link to website: <a href=\"https:\/\/chat.openai.com\">https:\/\/chat.openai.com<\/a><\/p>\n\n\n\n<a name=\"what-is-whisper\">\n\n\n\n<h2 class=\"wp-block-heading\">What is Whisper?<\/h2>\n\n\n\n<p>Whisper is an automatic speech recognition (ASR) system trained on 680,000 hours of multilingual and multitask supervised data collected from the web. It is great for transcription and similar tasks.<\/p>\n\n\n\n<p>Link to repo: <a href=\"https:\/\/github.com\/openai\/whisper\">https:\/\/github.com\/openai\/whisper<\/a><\/p>\n\n\n\n<a name=\"what-is-stable-whisper\">\n\n\n\n<h2 class=\"wp-block-heading\">What is StableWhisper?<\/h2>\n\n\n\n<p>StableWhisper is an alteration of OpenAI&#8217;s Whisper model that produces more reliable timestamps.<\/p>\n\n\n\n<p>The issue with the original Whisper is that it is prone to overshoot segments and thus produce unreliable timestamps that end up with sentences being cut up halfway and similar. This isn&#8217;t a big issue if we want to do summaries but for diarization, it reduces our accuracy.<\/p>\n\n\n\n<p>There are procedures that can make these realignments on the original Whisper output such as using Wav2Vec2, and different punctuation models. Depending on your use case, this might be overkill and I&#8217;ve opted for using StableWhisper that doesn&#8217;t solve all the issues but helps considerably.<\/p>\n\n\n\n<p>Link to the repo: <a href=\"https:\/\/github.com\/jianfch\/stable-ts\/tree\/main\">jianfch\/stable-ts: ASR with reliable word-level timestamps using OpenAI&#8217;s Whisper (github.com)<\/a><\/p>\n\n\n\n<a name=\"getting-started\">\n\n\n\n<h2 class=\"wp-block-heading\">Getting started<\/h2>\n\n\n\n<p>This article will have the goal of creating an AI Chatbot that will simulate chatting with Warren Buffett with ChatGPT.<\/p>\n\n\n\n<p>To achieve such a goal, we will need to do several things that will be laid out below:<\/p>\n\n\n\n<ol>\n<li>Collect training data<\/li>\n\n\n\n<li>Clean and organize the training data<\/li>\n\n\n\n<li>Finetune ChatGPT on the data<\/li>\n\n\n\n<li>Chat<\/li>\n<\/ol>\n\n\n\n<p>The amount of data that we will be using in this article won&#8217;t be too much so that the reader can follow the article without issues and also for brevity.<\/p>\n\n\n\n<p>The audios that we will use are these three YouTube videos that are picked semi-randomly where Warren Buffett was interviewed or hosted:<\/p>\n\n\n\n<ol>\n<li><a href=\"https:\/\/youtu.be\/JvEas_zZ4fM\">Watch CNBC&#8217;s full interview with Berkshire Hathaway CEO Warren Buffett<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=SEZwkbliJr8\">Warren Buffett reveals his investment strategy for mastering the market<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=UKw_NjWtg5w\">Warren Buffett and Charlie Munger join the 2023 Berkshire Hathaway annual meeting \u2014 5\/6\/23<\/a><br><a href=\"https:\/\/www.youtube.com\/@CNBCtelevision\"><\/a><a href=\"https:\/\/www.youtube.com\/@YahooFinance\"><\/a><a href=\"https:\/\/www.youtube.com\/@CNBCtelevision\"><\/a><a href=\"https:\/\/www.youtube.com\/@CNBCtelevision\"><\/a><\/li>\n<\/ol>\n\n\n\n<p>Each video is different and will present its own challenge. The difference between videos 1 and 2 is that the interviewers are of different sexes which results in the male voice being more &#8220;similar&#8221; to Warren&#8217;s which could pose a threat to the diarization accuracy.<\/p>\n\n\n\n<p>The third video is very long and has many speakers and it showcases the issue that these models face for panel formats of discussion.<\/p>\n\n\n\n<p>When it comes to text data, for best results it would require a different treatment and use of a vector database which I&#8217;ll show in another article.<\/p>\n\n\n\n<p>One thing to note is that you can easily extend the training data by adding more videos to it. You can also add other types of personas such as Soros and thus combine a&nbsp;hybrid value investor and macro trader.<\/p>\n\n\n\n<p>You could also split the data to get different versions of Warren Buffett such as the one previous to the year X and the other after.<\/p>\n\n\n\n<p>For this, I&#8217;ll be using my own PC that has an ASUS ROG Strix RTX3060 12GB GPU. For those that don&#8217;t have a GPU or have a weaker one, I suggest using Kaggle or Google Colab as they offer free ones.<\/p>\n\n\n\n<p>Now that we have covered the main points, let us work with the videos.<\/p>\n\n\n\n<p>Make sure that you have a fresh environment to work in. I usually use conda:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>conda create -n buffett<\/code><\/pre><\/div>\n\n\n\n<a name=\"what-is-diarization\">\n\n\n\n<h2 class=\"wp-block-heading\">What is Diarization?<\/h2>\n\n\n\n<p>Diarization is a process in speech processing that involves identifying and segmenting different speakers in an audio recording. Essentially, it&#8217;s about determining &#8220;who spoke when&#8221; which is useful for tasks such as transcribing multi-speaker conversations.<\/p>\n\n\n\n<a name=\"perform-diarization-and-transcription\">\n\n\n\n<h2 class=\"wp-block-heading\">How to perform diarization and transcription with Whisper?<\/h2>\n\n\n\n<p>To perform diarization and prescription with Whisper, we will need to use another approach as Whisper sadly doesn&#8217;t perform diarization out-of-the-box at the time of writing. <\/p>\n\n\n\n<p>Moreover, we will be using the StableWhisper library and not the original Whisper one to gain on performance.<\/p>\n\n\n\n<p>There are only a couple of diarization projects out there with mixed results. It seems that there aren&#8217;t a lot of contributions to the diarization process overall (well, at least open-source ones) that solve the problem with high accuracy.<\/p>\n\n\n\n<p>I tried out a few of them such as the pyannote gated HuggingFace model and have found that it doesn&#8217;t perform better than a simple clustering pipeline I wrote. I found one HugginFace project and refactored it as the code for it wasn&#8217;t the best and was kept strictly inside HuggingFace.<\/p>\n\n\n\n<p>The refactored version that can perform both transcription and diarization can be found on our AlgoTrading101 GitHub repository and can easily be used and cloned into Kaggle, Google Colab, locally and etc.<\/p>\n\n\n\n<p>The project features a Gradio UI and has improved and cleaned code from its original version which can be found on <a href=\"https:\/\/huggingface.co\/spaces\/vumichien\/Whisper_speaker_diarization\">HugginFace<\/a> which wasn&#8217;t coded by me. <a href=\"https:\/\/github.com\/AlgoTrading101\/AlgoTrading101-Buffet-ChatGPT\">My version<\/a> features a more accurate diarization process, more accurate transcriptions and timestamps, and other quality improvements.<\/p>\n\n\n\n<p>It was a quick refactor, and PRs are welcome.<\/p>\n\n\n\n<p>You can also use the HuggingFace version and skip the bottom installation header part but it often fails for me.<\/p>\n\n\n\n<a name=\"pre-requisites\">\n\n\n\n<h3 class=\"wp-block-heading\">Installing pre-requisites<\/h3>\n\n\n\n<p>We&#8217;ll start by installing the prerequisites that will ensure that you can use the above repo. First, clone the repo and install its requirements in a fresh environment that we created.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ git clone https:\/\/github.com\/AlgoTrading101\/AlgoTrading101-Warren-Buffett-ChatGPT.git\n$ pip install -r requirements.txt\n$ pip install -qq https:\/\/github.com\/pyannote\/pyannote-audio\/archive\/refs\/heads\/develop.zip<\/code><\/pre><\/div>\n\n\n\n<p>After that, create a <code>.env<\/code> file in the root of the repository by following the example template in <code>env.example<\/code>. The most important variable is to set your <code>HUGGINGFACE_TOKEN<\/code> as this will be needed to get the models that we will use from HuggingFace. <\/p>\n\n\n\n<p>If you don&#8217;t have a token, please navigate to their website and create an account by clicking the &#8220;Sign Up&#8221; button in the upper right corner.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"409\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-1024x409.webp\" alt=\"\" class=\"wp-image-22045\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-1024x409.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-300x120.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-768x307.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-1536x613.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/huggingface_main_website-2048x818.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When you log into your account, click on your account icon in the upper right corner and navigate to Settings and then on the left menu click Access Tokens. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"506\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-1024x506.webp\" alt=\"\" class=\"wp-image-22050\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-1024x506.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-300x148.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-768x380.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-1536x759.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/hugginface_token-2048x1012.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>There you can create a new token with &#8220;read&#8221; permissions and paste it into your env.<\/p>\n\n\n\n<p>The next two things are <strong>only <\/strong>for users that want to run this <strong>locally<\/strong>. Ensure that you have <code>ffmpeg<\/code> installed. To quickly check for this open up a terminal and run <code>ffmpeg<\/code>. If you don&#8217;t see anything popping up with the version number and similar, there is an installation guide for each major OS <a href=\"https:\/\/www.videoproc.com\/resource\/how-to-install-ffmpeg.htm\">here<\/a>.<\/p>\n\n\n\n<p>Because we are using PyTorch, you will probably want to re-install it with your adequate version of Cuda by using this link <a href=\"https:\/\/pytorch.org\/get-started\/locally\/\">here<\/a>. I will rely on the CUDA that conda provides by following this link over <a href=\"https:\/\/pytorch.org\/get-started\/locally\/\">here<\/a> and selecting the latest supported version:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia<\/code><\/pre><\/div>\n\n\n\n<p>To see up to which version your GPU supports the CUDA, you can run this command and read the version number in the upper right corner:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>nvidia-smi<\/code><\/pre><\/div>\n\n\n\n<p>To start the Gradio UI, we run the following (if you face issues with HuggingFace, I suggest running it as an administrator for the first time so it can pull the models easily):<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>python main.py<\/code><\/pre><\/div>\n\n\n\n<p>Now navigate to this URL to access it: http:\/\/127.0.0.1:7860\/<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"693\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-1024x693.webp\" alt=\"\" class=\"wp-image-22052\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-1024x693.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-300x203.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-768x520.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-1536x1039.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/transcription-diarization-2048x1385.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you want all of this inside a notebook, you can move the contents of <code>main.py<\/code> into a notebook and run it that way.<\/p>\n\n\n\n<a name=\"transcription-and-diarization\">\n\n\n\n<h3 class=\"wp-block-heading\">Transcription and diarization<\/h3>\n\n\n\n<p>We begin our transcription and diarization process by pasting our YouTube video URL and then clicking the &#8220;Download YouTube video&#8221; button. After the video has been downloaded, you will be able to play it to confirm that it is functional. <\/p>\n\n\n\n<p><strong>Note:<\/strong> If the video is too long, sometimes it won&#8217;t appear straight away as it is being rendered and you can check if it is downloaded by observing your file structure or console output. But, you still need to wait for it to appear in order to continue the process. This can take some time depending on the video length.<\/p>\n\n\n\n<p>The next step is to select the Whisper model you want to use, and the assumed number of speakers in the video.<\/p>\n\n\n\n<p> The model that I suggest using is the large-v2 one as it offers the best transcription accuracy and segmentation. I&#8217;ve tried the lower ones and they had mixed accuracy results. The base one is also fine.<\/p>\n\n\n\n<p>The goal of this article is to show you what you can do and how to do it. You can bring in more advanced pipelines and experiment with different models and use cases.<\/p>\n\n\n\n<p>When it comes to the number of speakers, if you set it to 0 speakers, it will try to dynamically infer the number of speakers. It is not the best at doing it so I suggest setting this number if you know it or aren&#8217;t too lazy to check as the dynamic recognition needs improvements to be more precise.<\/p>\n\n\n\n<p>It can also be an assumed number of speakers.<\/p>\n\n\n\n<p>Now, click the &#8220;Transcribe audio and diarization&#8221; button and watch the magic happen. When it completes, and it usually doesn&#8217;t take too long, you will see your dataset at the bottom of the page. You will also be able to find its CSV in the output folder.<\/p>\n\n\n\n<p>The diarization works by applying three clustering algorithms (KMeans, Agglomerative Clustering, and a Gaussian Mixture Model) on the audio segment embeddings and labeling the segment with a vote where 2\/3 algorithms agreed.<\/p>\n\n\n\n<p>This ensures the higher accuracy of the diarization and avoids relying on just one algorithm. I&#8217;ve found this approach to work well and it doesn&#8217;t require the usage of fancy neural networks and similar big models.<\/p>\n\n\n\n<p>If you are using this on a Cloud or the like, you can also download the output to your local computer by pressing the download button inside the UI.<\/p>\n\n\n\n<p>The dataset will have your transcript with adequate timestamps and speaker(s).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result-1024x527.webp\" alt=\"\" class=\"wp-image-22046\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result-1024x527.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result-300x154.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result-768x395.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result-1536x790.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/diarization_result.webp 1594w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the Full code section of this article, you will find all the datasets inside the output folder of our repo.<\/p>\n\n\n\n<a name=\"cleaning-videos-and-transcripts\">\n\n\n\n<div class=\"wp-block-group is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<h3 class=\"wp-block-heading\">Cleaning videos and transcripts<\/h3>\n\n\n\n<p>When it comes to (pre\/post)processing your videos and transcripts, you can cut out the parts from the videos where Warren Buffett wasn&#8217;t a part of the conversation as you can argue that we don&#8217;t need those. <\/p>\n\n\n\n<p>This is the case for the last video labeled with the number 3 in which Buffett started speaking around the 1 hour mark. Thus, we will need to intercept the workflow. I&#8217;ll trim the part up to the 1-hour mark and split the remainder into 4 parts so that it can fit into my memory without issues.<\/p>\n\n\n\n<p>The next thing that I&#8217;ll do for all transcripts is to deal with the fact that even the StableWhisper overshoots or undershoots a peculiar segment which can mess with the diarization clustering algorithms as they get leakage from its neighboring segment which can result in interesting results.<\/p>\n\n\n\n<p>To combat this and increase accuracy I will create a cleaning pipeline that will check if a sentence is stopped midway and tape it back together where it is obvious. For example, ending a sentence with a comma, next row starting with a lowercase word or number, etc. <\/p>\n\n\n\n<p>We will also merge the speaker into one if it repeats for two or more rows. The pipeline can be found inside the <code>clean.ipynb<\/code> notebook and is an optional but recommended step. Feel free to think of ways to improve this pipeline and make it more robust.<\/p>\n\n\n\n<p>To completely fix the Whisper issue, we would need more heavy AI algorithms that I&#8217;ve mentioned before. As improved models of Whisper and diarization algorithms come out, this will be less of an issue.<\/p>\n<\/div><\/div>\n\n\n\n<p>Now that the datasets are cleaned, I will rename the speaker columns into &#8220;BUFFETT&#8221; where it makes sense and merge all datasets into a single one. I will also do some manual cleaning as Buffett stutters can mess up the segments and overall diarization.<\/p>\n\n\n\n<p>Let&#8217;s move on to prepare a schema that can be used for ChatGPT finetuning.<\/p>\n\n\n\n<a name=\"what-is-fine-tuning\">\n\n\n\n<h2 class=\"wp-block-heading\">What is fine-tuning?<\/h2>\n\n\n\n<p>Fine-tuning is a technique in machine learning that involves adjusting the hyperparameters of a model to improve its performance on a specific dataset. This is usually done when a model was trained on a general-purpose dataset and can help improve its performance on specific tasks.<\/p>\n\n\n\n<a name=\"chatgpt-fine-tuning\">\n\n\n\n<h2 class=\"wp-block-heading\">How to organize the data for ChatGPT fine-tuning?<\/h2>\n\n\n\n<p>To organize the data for ChatGPT fine-tuning, we will need to do two things. The first thing that we will do is restructure our dataset to be in a ChatGPT-friendly fine-tuning format. This means that we will have two columns labeled prompt and completion.<\/p>\n\n\n\n<p>The prompt column will hold our prompt and overall context while the completion column will always be tied to Buffett&#8217;s answer. In order to make this more interesting and precise, I will create that the last 5 rows before Buffett&#8217;s answer are a single prompt.<\/p>\n\n\n\n<p>Take note that you can do any number of previous rows to be your prompt, I&#8217;ve chosen 5 based on some similar projects I did way back ago.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>df = pd.read_csv(&quot;output\/full_transcripts.csv&quot;)\ndf = df.dropna()\ndf = df.reset_index(drop=True)\n\nprompt_response = {&#39;prompt&#39;:[],&#39;completion&#39;:[]}\n\nfor i in range(len(df)):\n    if df[&#39;Speaker&#39;][i] == &#39;BUFFETT&#39;:\n        prompt = df[&#39;Text&#39;][i-5:i]\n        prompt = &#39; &#39;.join(prompt)\n        response = df[&#39;Text&#39;][i]\n        prompt_response[&#39;prompt&#39;].append(prompt)\n        prompt_response[&#39;completion&#39;].append(response)\n\n\ndf_clean = pd.DataFrame(prompt_response).shift(-2)\ndf_clean = df_clean.dropna()\ndf_clean<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"976\" height=\"231\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning_data.webp\" alt=\"\" class=\"wp-image-22047\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning_data.webp 976w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning_data-300x71.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning_data-768x182.webp 768w\" sizes=\"(max-width: 976px) 100vw, 976px\" \/><\/figure>\n\n\n\n<p>By having a larger prompt we allow the model to understand the context of the overall conversation more deeply and provide better answers. Usually, it is required to have about 500 prompt-completion pairs to feel the fine-tuning and we have 788 which would be a solid amount.<\/p>\n\n\n\n<p>Now, you would need to do more post-processing of the data in order to make fine-tuning possible. But, we have a helper that is provided by OpenAI that we run like this:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>openai tools fine_tunes.prepare_data -f .\\output\\train.csv<\/code><\/pre><\/div>\n\n\n\n<p>This will take us through all the steps and create a file in a <code>jsonl<\/code> format that is used for training. It will prompt us by asking if we want to add certain things to make the fine-tuning process better and we&#8217;ll say &#8220;yes&#8221; to all.<\/p>\n\n\n\n<p>Now, we are finally ready to commence the fine-tuning process!<\/p>\n\n\n\n<a name=\"fine-tune-chatgpt\">\n\n\n\n<h2 class=\"wp-block-heading\">How to fine-tune ChatGPT on your own data?<\/h2>\n\n\n\n<p>To fine-tune ChatGPT on your own data, you will need to have the data prepared in a fine-tuning-friendly format which is the <code>jsonl<\/code> file structure. This was shown how to do in our previous headers.<\/p>\n\n\n\n<p>To start the fine-tuning process, make sure to have your OpenAI API key ready as it will be needed to run this process. If you don&#8217;t have one, proceed to your OpenAI profile and click the &#8220;View API keys&#8221; button under the profile dropdown menu.<\/p>\n\n\n\n<p>There, you can press the &#8220;Create new secret key&#8221; button and give it a name. After that, we will export the key to our environment so that it can be used. To do so I write:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>export OPENAI_API_KEY=&quot;&lt;OPENAI_API_KEY&gt;&quot;<\/code><\/pre><\/div>\n\n\n\n<p>To start fine-tuning I do:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>openai api fine_tunes.create -t &lt;TRAIN_FILE_ID_OR_PATH&gt; -m &lt;BASE_MODEL&gt;<\/code><\/pre><\/div>\n\n\n\n<p>The training file will be the file we generated with their helper and the base model will be <code>davinci<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"128\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning-chatgpt.webp\" alt=\"\" class=\"wp-image-22048\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning-chatgpt.webp 881w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning-chatgpt-300x44.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/fine-tuning-chatgpt-768x112.webp 768w\" sizes=\"(max-width: 881px) 100vw, 881px\" \/><\/figure>\n\n\n\n<p>After you&#8217;ve started a fine-tuning job, it may take some time to complete as your job may be queued behind other jobs on their system, and training the model can take minutes or hours depending on the model and dataset size. <\/p>\n\n\n\n<p>If the event stream is interrupted for any reason, you can resume it by running:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>openai api fine_tunes.follow -i &lt;YOUR_FINE_TUNE_JOB_ID&gt;<\/code><\/pre><\/div>\n\n\n\n<p>When the job is done, it should display the name of the fine-tuned model.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"302\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/finetuning-result.webp\" alt=\"\" class=\"wp-image-22049\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/finetuning-result.webp 920w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/finetuning-result-300x98.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/finetuning-result-768x252.webp 768w\" sizes=\"(max-width: 920px) 100vw, 920px\" \/><\/figure>\n\n\n\n<p>I think that you should be able to use our fine-tuned model so that you don&#8217;t need to pay for the fine-tuning costs.<\/p>\n\n\n\n<a name=\"chat-with-warren-buffett-chatgpt\">\n\n\n\n<h2 class=\"wp-block-heading\">How to chat with Warren Buffett using ChatGPT?<\/h2>\n\n\n\n<p>To chat with Warren Buffett using ChatGPT, we can send prompts to our fine-tuned ChatGPT model and observe its results. To send a prompt you write:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import openai\n\nopenai.api_key=&quot;YOUR_KEY_HERE&quot;\n\nopenai.Completion.create(\n    model=&quot;&lt;YOUR_MODEL_HERE&gt;&quot;,\n    prompt=&quot;&lt;YOUR_PROMPT_HERE&gt;&quot;,\n    max_tokens=1000,\n    temperature=0.9,\n    top_p=1,\n    )<\/code><\/pre><\/div>\n\n\n\n<p>Feel free to adjust the number of tokens that you want to be returned. I you want the maximum content length that my model can output which is 2049 you will need to adjust as the prompt also counts toward that cap. Each token costs about $0.00004397. <\/p>\n\n\n\n<p>By adjusting the temperature, you are changing the amount of divergence that ChatGPT can make from what it was fine-tuned on. The lower the number, the more deterministic it will be.<\/p>\n\n\n\n<p>Let&#8217;s try this out by sending over a few prompts and see how it behaves. I&#8217;ll start by taking a sentence from the train data as is, then I&#8217;ll make two more prompts that are more creative.<\/p>\n\n\n\n<p>Prompt 1: &#8220;Income inequality, wealth inequality, you&#8217;ve talked about the earned income tax credit. Is there more to it than that? Should we adjust tax policy? It seems to be going the other way right now.&#8221;<\/p>\n\n\n\n<p>Answer: &#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Well, we should adjust tax policy to get the income inequality to improve, not to deteriorate. And that means making sure that we have a very progressive income tax. A lot of people have been fooled by the fact that the payroll tax, which was originally designed to pay for Social Security and Medicare, has a regressive feature to it, that the first $127,000 of income is not taxed. And then above that, it&#8217;s taxed at a higher rate. And that&#8217;s consistent with the idea that you want to have some funding for Social Security and Medicare, and it doesn&#8217;t burden lower-income people as much as higher-income people. But I would like to see us move to a progressive income tax where the rate did get higher. Today, it turns out it&#8217;s about a third, effectively, as high on a billionaire as it is on somebody making $200,000, because of all the deductions. And we shouldn&#8217;t have a tax system encouraging people to get into the sort of artificial economy, where you move to Bermuda or the Cayman Islands, where you make all your money, but you don&#8217;t live in the United States. &#8230;<\/mark>&#8220;<\/p>\n\n\n\n<p>The full response can be found in the <code>examples<\/code> folder inside our GitHub repository.<\/p>\n\n\n\n<p>Prompt 2: &#8220;Warren, what is your all-time favorite book?&#8221;<\/p>\n\n\n\n<p>Answer: &#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Well, it changes every day. There&#8217;s a couple thousand books in our library. I&#8217;ve read most of them just one time. I don&#8217;t go back and read them again. So they are my favourite book for that day I read them. I&#8217;ve read some of them 20 or 30 times. I&#8217;ve read Ben Graham&#8217;s book, The Intelligent Investor, six times or seven times. But I&#8217;ve read 30 other books that I&#8217;ve read once. So the answer really is that the book that I&#8217;m enjoying at the moment is my favorite book.<\/mark>&#8220;<\/p>\n\n\n\n<p>After this answer, the AI went on to simulate another question being asked.<\/p>\n\n\n\n<p>Prompt 3: &#8220;Hello, Mr. Buffett! I am Igor from AlgoTrading101 and I am interested what are your thoughts about the future of AI and the stock market?&#8221;<\/p>\n\n\n\n<p>Answer: &#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Yeah, on AI and market, you know, I think it&#8217;ll work well. I mean, there\u2019ll be some mistakes made by a machine as wasn&#8217;t made by a human. That is an area where I think will be a significant advance. I actually think it will be more in diagnosis rather than actually prescribing drugs. I think we\u2019ll be more advanced in that. There are two companies that I think will be subject to the fate of AI. One is a company called Aetna that I think is right out there in its death struggle. I mean, life insurance business. I don\u2019t think they can, I don\u2019t think they should try and repurchase their preferred \u2013 now they\u2019re trying to repurchase their preferred. I mean, they can\u2019t make money in the life insurance business. They had 100 million of their own money. I think they\u2019ve spent nine billion trying to keep the preferred from getting their money. And it\u2019s not working. Now, the money is coming due next year where I think they\u2019ll have to have a good deal of the preferred to have to. I mean, they can\u2019t pay it. And they\u2019re charging higher medical costs, which is understandable. It\u2019s human nature. But I think it\u2019s going to be a huge trouble. On the other hand, you\u2019ve got the pharmacy business. And if you have a bad cold and you\u2019re looking for some relief, you\u2019re going to continue to use the people, I think, a lot of extra stuff. But if I have cancer, I would like to see an AI system on the side prescribing what I could have to maximize the chance of living for 10 years or so. And I think you\u2019ll see that in cancer and I think you\u2019ll see it in maybe a lot of other areas. I find \u2013 I saw an IBM story today that the IBM computer beat the humans in another game, three games of the 90s, bridge. Anyway, there are a lot of things that will involve artificial intelligence. And I think of it as something that will be a plus to society. It\u2019ll make mistakes, too, like we make mistakes. But I think the net will be upward. But I don\u2019t think it\u2019s going to change the nature of the market very much. I think it will be a great help in diagnosis, if not prescribing.<\/mark>&#8220;<\/p>\n\n\n\n<a name=\"thoughts-and-ideas\">\n\n\n\n<h2 class=\"wp-block-heading\">My thoughts and ideas<\/h2>\n\n\n\n<p>Based on the answers and examples above, we can call this a success based on the number of data we passed into the model which isn&#8217;t large. By improving upon the diarization and transcription accuracy and quality of the overall prompts, we could make this a lot better.<\/p>\n\n\n\n<p>About 90% of my time was spent exploring different transcription and diarization approaches and obtaining data with them. <\/p>\n\n\n\n<p>What worked well on paper or the first two videos didn&#8217;t work in the third video and vice-versa. There are also many outdated repositories and models out there that can be a time sink.<\/p>\n\n\n\n<p>From my experience, it is always the case that data obtainment and cleaning take the most time while the ML part is a small cog in the overall machinery. This article was a bit mixed as you needed good ML algorithms to obtain the data but you get the idea.<\/p>\n\n\n\n<p>Feel free to explore different transcription and diarization approaches and different parameters for the model completion response. You can find all available parameters <a href=\"https:\/\/platform.openai.com\/docs\/api-reference\/completions\/create\">here<\/a>. Another idea is to try combining people and have the whole panel be completions so that you involve Charlie Munger too.<\/p>\n\n\n\n<a name=\"full-code\">\n\n\n\n<h2 class=\"wp-block-heading\">Full code<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/AlgoTrading101\/AlgoTrading101-Buffet-ChatGPT\">GitHub link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note that this article does not refer to custom GPTs. Using custom GPTs, it is possible to build a Warren Buffett chatbot without code. Learn more about custom GPTs here. Table of contents: How to build a Warren Buffett Chatbot using OpenAI? First, we will collect data on Warren Buffett&#8217;s market knowledge via video interviews. [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":22054,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[3,2],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Build a Warren Buffett Chatbot using OpenAI&#039;s API - AlgoTrading101 Blog<\/title>\n<meta name=\"description\" content=\"We will cover how to use data on Warren Buffett&#039;s market knowledge to fine-tune our own ChatGPT model using OpenAI&#039;s API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build a Warren Buffett Chatbot using OpenAI&#039;s API - AlgoTrading101 Blog\" \/>\n<meta property=\"og:description\" content=\"We will cover how to use data on Warren Buffett&#039;s market knowledge to fine-tune our own ChatGPT model using OpenAI&#039;s API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/\" \/>\n<meta property=\"og:site_name\" content=\"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-27T09:50:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-15T20:01:34+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Igor Radovanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Igor Radovanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Build a Warren Buffett Chatbot using OpenAI's API - AlgoTrading101 Blog","description":"We will cover how to use data on Warren Buffett's market knowledge to fine-tune our own ChatGPT model using OpenAI's API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/","og_locale":"en_US","og_type":"article","og_title":"Build a Warren Buffett Chatbot using OpenAI's API - AlgoTrading101 Blog","og_description":"We will cover how to use data on Warren Buffett's market knowledge to fine-tune our own ChatGPT model using OpenAI's API.","og_url":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/","og_site_name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","article_published_time":"2023-08-27T09:50:22+00:00","article_modified_time":"2023-11-15T20:01:34+00:00","og_image":[{"width":900,"height":675,"url":"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/08\/ChatGPT-Warren-Buffet.webp","type":"image\/webp"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/#article","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae"},"headline":"Build a Warren Buffett Chatbot using OpenAI&#8217;s API","datePublished":"2023-08-27T09:50:22+00:00","dateModified":"2023-11-15T20:01:34+00:00","mainEntityOfPage":{"@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/"},"wordCount":3833,"publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"articleSection":["Programming","Trading"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/","url":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/","name":"Build a Warren Buffett Chatbot using OpenAI's API - AlgoTrading101 Blog","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/#website"},"datePublished":"2023-08-27T09:50:22+00:00","dateModified":"2023-11-15T20:01:34+00:00","description":"We will cover how to use data on Warren Buffett's market knowledge to fine-tune our own ChatGPT model using OpenAI's API.","breadcrumb":{"@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/algotrading101.com\/learn\/warren-buffett-chatbot-chatgpt-openai\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/algotrading101.com\/learn\/"},{"@type":"ListItem","position":2,"name":"Build a Warren Buffett Chatbot using OpenAI&#8217;s API"}]},{"@type":"WebSite","@id":"https:\/\/algotrading101.com\/learn\/#website","url":"https:\/\/algotrading101.com\/learn\/","name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","description":"Authentic Stories about Algorithmic trading, coding and life.","publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/algotrading101.com\/learn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/algotrading101.com\/learn\/#organization","name":"AlgoTrading101","url":"https:\/\/algotrading101.com\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","contentUrl":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","width":1200,"height":627,"caption":"AlgoTrading101"},"image":{"@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae","name":"Igor Radovanovic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","caption":"Igor Radovanovic"},"sameAs":["https:\/\/igorradovanovic.com","https:\/\/www.linkedin.com\/in\/igor-radovanovic-profile"],"url":"https:\/\/algotrading101.com\/learn\/author\/igor\/"}]}},"modified_by":"Lucas Liew","_links":{"self":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21941"}],"collection":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/comments?post=21941"}],"version-history":[{"count":118,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21941\/revisions"}],"predecessor-version":[{"id":22295,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21941\/revisions\/22295"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media\/22054"}],"wp:attachment":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media?parent=21941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/categories?post=21941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/tags?post=21941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}