DeepSeek Essentials: Prompting, APIs, and Build AI Apps | Arclight Learning | Skillshare

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

DeepSeek Essentials: Prompting, APIs, and Build AI Apps

teacher avatar Arclight Learning, Invest in yourself

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      2:26

    • 2.

      DeepSeek vs Leading AI Models

      1:46

    • 3.

      Configuring DeepSeek

      43:00

    • 4.

      Effective Prompting

      8:52

    • 5.

      Effective Prompts

      8:05

    • 6.

      Blog Creation

      11:10

    • 7.

      Debugging

      15:45

    • 8.

      Research and Summarization

      11:00

    • 9.

      COT Prompting

      7:12

    • 10.

      Few Shot Learning

      7:51

    • 11.

      Sales

      9:45

    • 12.

      Complex Problems

      9:16

    • 13.

      DeepSeek API

      17:08

    • 14.

      DeepSeek Twitter Bot

      42:16

    • 15.

      Speardsheet Automation

      23:27

    • 16.

      Fine Tuning Models with Dataset

      44:54

    • 17.

      Market Insights

      13:27

    • 18.

      Competitor Analysis

      11:33

    • 19.

      Powerpoint

      13:09

    • 20.

      Bias and Responsible AI

      8:16

    • 21.

      Transformers

      15:38

    • 22.

      Fine Tune DeepSeek

      5:30

    • 23.

      AWS Lambda

      56:36

    • 24.

      AI Cost

      5:19

    • 25.

      Voice Assistant

      15:06

    • 26.

      Research Summary Assistant

      36:49

    • 27.

      Social Media Bot

      2:27

    • 28.

      AI Recommendation Engine

      5:34

    • 29.

      Emerging Trends

      2:53

    • 30.

      Open Source AI Contribution

      1:45

    • 31.

      AI Careers

      1:50

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

20

Students

--

Projects

About This Class

Unlock the transformative power of DeepSeek AI, one of the most innovative and accessible AI platforms available today. This comprehensive, project-based class takes you from complete beginner to advanced practitioner, equipping you with practical skills to integrate AI into your workflows, apps, and business strategies.

Whether you're new to AI or seeking to level up your expertise, you'll explore DeepSeek step-by-step through engaging demos and real-world applications. Start with the fundamentals: setting up your free DeepSeek account, understanding its core features, and comparing it to other leading models like ChatGPT, Gemini, and Claude. Then, dive into prompt engineering techniques to craft precise, effective queries for optimal results. This is one of the most hands-on, practical Artificial Intelligence classes you’ll find.

Build hands-on projects that bring AI to life, including:

  • Automating tasks with Python and Google Sheets integrations
  • Creating intelligent Twitter bots using DeepSeek's APIs
  • Conducting rapid market research, competitor analysis, and generating executive reports
  • Fine-tuning models with custom datasets for specialized use cases
  • Deploying AI solutions on AWS Lambda for scalable, serverless applications

Along the way, we'll cover ethical AI practices, cost optimization, performance tuning, and advanced concepts like transformer architectures and open-source contributions. No prior coding experience is required; just a free DeepSeek account to follow along with the demos (optional Google Sheets and AWS free-tier accounts for select projects).

By the end of this class, you'll have a portfolio of AI-powered projects and the confidence to apply DeepSeek in professional settings, boosting productivity and innovation. Perfect for developers, entrepreneurs, marketers, and anyone curious about cutting-edge AI tools.

You can find the demo code examples we cover throughout the class attached as a zip file on the class project section if you would like to follow along (DeepSeek Demo Code Files.zip).

Meet Your Teacher

Teacher Profile Image

Arclight Learning

Invest in yourself

Teacher
Level: All Levels

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: Hi, and a warm welcome to the complete Deep CKI class. Whether you're new to AI or looking to level up, I'm thrilled you're here to dive into the exciting world of Deep CKI. Let's get you started on building powerful AI tools. This class is built progressively, starting with Deep Seek setup and prompt engineering, then moving to API integrations and advanced automation. You'll learn essential skills like crafting precise prompts, connecting Deep Seek to Python applications for real tasks, handling data visualization, and incorporating ethics like bias detection, all through interactive demos and real life projects. This class is created for beginners to intermediate learners passionate about AI in business or tech. If you're an entrepreneur, marketer, or data hobbyist, this is for you. You'll need basic Python knowledge, a deep seek API key, and optionally some API experience from tools like X, also known as Twitter and bots. But really, no particular coding skills is required and you'll be able to follow along in the class. And there are no advanced skills required to start. The true value of this class is in transforming you into an AI practitioner who can automate market research, generate actionable reports, and visualize trends. You'll create portfolio pieces that showcase advanced AI usage, giving you a competitive edge in fields like marketing, data analysis, or startups, empowering you to leverage AI ethically and effectively, and, of course, to help grow your career. In this class, you'll tackle an exciting project, building an AI Power market research assistant using Deep Set. You'll automate gathering competitive insights, analyze market trends like electric vehicles, visualize key findings with charts, and produce professional reports, which is a tangible tool you can use or add to your portfolio. I'm so excited for you to unlock the power of Deep Sk AI and create something amazing. Let's get started right away. See you in the first lesson. 2. DeepSeek vs Leading AI Models: Not all AI models are created equal. In this lecture, we'll compare DeepSeek capabilities to ChatGPT, Gemini, and clod across critical factors like accuracy, cost, and specialization. So you can make informed decisions for your projects. Before diving into specs, let's establish what actually matters. Whether you are a developer needing precise code or a marketer generating campaigns, you'll care about these four factors, and we'll see how each model stacks up. While all four models perform well generally, DeepSeek pulls ahead for technical tasks like coding, solving 79% of Python challenges correctly. But for novel writing, clouds your best bet. Speed matters when you're iterating quickly. DeepSeek's lean architecture delivers responses in under 50 milliseconds, crucial for developers debugging in real time or customer support chatbots. Here's where DeepSeek truly shines. It's free for personal use and dramatically cheaper at scale. While others nickel and dime for features, DeepSeek delivers premium capabilities without premium pricing. The best AI depends on your task. Me to debug code, DeepSeek, writing a screenplay, clod. This cheat sheet helps you pick the perfect tool, and often that'll be DeepSeek for its balance of power and value. 3. Configuring DeepSeek: Welcome to the hands on part of your journey. In this lecture, we'll walk through three ways to use Deepsk the user friendly web interface, the powerful API for developers, and local deployment for advanced users. Let's get you set up. Your setup choice depends on your goals. Met quick answers, use the web. Building a custom tool, the API is your friend. Handling sensitive data, go local. Let's explore each option. Don't worry. Most of you only need the web or API. Local setup is optional, but rewarding for tech enthusiasts. Let's start with the simplest method. Follow along as we tackle these steps in the demo. I'll highlight common pitfalls like missing API keys and show you how to avoid them effortlessly. In this demo, we're going to cover two out of the three approaches, so the web interface and the API integration. Now, the web interface is very valuable because it really requires zero coding. It's perfect for writers, students or anyone who needs quick AI help. And in order to use this, it's actually in terms of dependencies and installing things, you don't really need much. You just need an Internet connection. You need a browser such as Google Chrome, Firefox or Microsoft Edge or Safari, and you just need an email account. First thing we want to do is you want to go ahead and navigate to deepsk.com, and then you're presented on this page. This is the main homepage of Deepseek. And there isn't a whole lot of things you can do here, really, it's just about creating an account or logging in or going into the API. So on the top right hand side here, you can change the language to English because by default, it's not in English. So you can click that, but I just want to delay, you know, basically this button on the left hand side that says Deep Seek V three. This is the one you just want to click, and this will take you to the main page for login. And if you already logged in, Um, then it'll just take you straight into your account. And then this one is really just to get the QR code so that you can download it on your phone, the actual app on your phone. So again, this is the only thing you need here. So change that into English if you like, and then click this. And then this will take you to the next page. Then again, all you need is an email address. So you just create an account. It's free. You create an account with your username, which will be the email, and then you just need to assign a password, and then you're done. Have your free deep Sk account. So I've already done that. So when I click on this, it'll just take me to this page here. Now, by default, it's the light theme or system, what it's called. But you can change that to dark theme. It really depends on your preference and what you like. So you can just do that by here by going on the bottom left hand side. There's my profile. You click that. You click on settings, and then you can just change your theme from system to dark or light or just leave it to default, which is system. Whatever, again, is your preference. And just before we actually get into our first prompt, I just wanted to do a quick overview. The user interface is quite simple, and it's really nice. It's very user friendly. And it's, again, very basic, very simple. So there shouldn't be much learning curve. On the left hand side here you go your left navigation bar, and you can expand or collapse the side bar with using this button here. So you can just click. If you don't want to look at your previous chats, then you can just close it, and then you have more real estate on the UI. It's nicer and tidier, or you can just again, open the task bar using the icon. And over here, you'll see if you have already started using Deepsek, you'll see your previous chats. For example, I got three chats here just to show you a sample. And what you can do is you can go to them. You can go to your previous chats and continue the chat or look up information as you like. You can do really a couple of other things. So if you click the Settings icon here, you can rename your chats to something else or you can delete them. So those are really the only features at this point in time. And then, of course, you can start a new chat. So if you click on a new chat, I'll start a new chat and then you're presented with the screen on the center here. And this is where you can just put your prompts in to start getting help from AI and talking to the chatbot for Deepsk. Here, what you can do is there are a couple of options. So there's a button that you can click, which is search. So if you click this button, depending on your inquiry and the thing you're trying to accomplish, this will help Deepsk know that the information you need is on the Internet and it can go and search the web when it's necessary. The other one is called Deep think. This is the reasoning functionality. So right now it's set to the R one. Model, but it basically allows deep sync to know that it needs to think before responding. This is good for anything if you're trying to solve a problem like a logic, whatever logic is involved, logical problem, or if it requires reasoning, any sort of problem solving that you're trying to get it to accomplish. This is helpful. If it's just a basic inquiry, you don't really need to turn these on. Again, it really depends on your prompt and what it is you're trying to get help. Or inquire about. And then lastly here you got your upload button, so you can upload documents or images. It does mention the size here, so you can do maximum 50, and then each can have a maximum file size of 100 megabyte. And this is currently used for text extraction only. So you're able to um simply upload an image or a document, and Deepsek will be able to process the text and then give you a summary, for example. If you have a long report, ten page report, you can get Deep Seek to summarize it for you and give it back to you, like the main important points and insights in five bullet points, for instance. So this is what you can currently do with Deep Seek again, very user friendly interface. So there's not much required in terms of learning. As soon as you create an account, you can just simply jump in, dive right in, and start using it. Now, let's just go ahead and try something. We're going to do our first prompt here. And for the majority of this course, I'm not going to type prompts in. I already have them ready, so I'm just going to copy paste them. That way, you don't have to watch me type. I don't like to waste your time, so you can just simply watch me copy paste them, and you don't have to wait for me to finish until we actually see the results. But feel free to pause the video and follow along because that's the best way to learn throughout the course. I highly encourage you to engage with these prompts and with the course content. So again, feel free to pause the video, put in the same prompts, and then follow along. So over here, we are going to do our first prompt here, which simply says, write a three day itinerary for a trip to Tokyo. So let's go ahead and enter that prompt and let Deep Seek give us the answer. So as you can see, Deep Sek is actually starting to work and now it's starting to, um, give us the itinerary. Now, one thing to know is that Deep Seek is free. Sometimes it's fast, sometimes it's slow. So it really depends on the time of the day, the day, the usage, how many users are on at the same time using it. Sometimes you'll see the output being given to you really fast, sometimes it'll be slower. And sometimes they'll just tell you that the server is busy and it's not able to process your request. So you have to wait a little bit, come back and rerun your query. So just a couple of things to keep in mind as you're using Deep Seek, but I think it's worth it because, again, the application is provided for free. And most of the time, it's fine. So here you can see it did exactly what we asked it to, so it created a three day itinerary and it broke it down into detail. So you got day one, classic Tokyo highlights. So in the morning, these are the places you can visit. In the afternoon, this is where you can visit. And in the evening, these are the places you can visit, same thing for day two, same thing for Day three, and then here's some extra tips. And, of course, you can dig in a little bit deeper with follow up prompts in terms of, like, Okay, what should I eat in day one? What are the good restaurants around the area that you told me to visit? Things like that. But again, this is just a simple first prompt that I just wanted to use to help you get familiar with Deepsek and its user interface. All right. Now let's take a look at the second approach, which is API integration. And the reason this is valuable is because it helps automate tasks like email drafting or data analysis. I just want to let you know, you don't need to be an expert. There's no coding expertise needed in order to accomplish this. In fact, it's quite simple. And if you follow along, you'll see that that is in fact the case. Before we get started, there's a couple of dependencies that we do need to install first. Again, I'm using Windows, but these dependencies will be installed on any other operating system that you're using, and of course, you can feel free to use your preference IDE, if you like, which we'll get in a second. But again, please don't let this be think of this as being too difficult, you'll see that it's quite easy. And yes, it does require some technical technical knowledge, but you'll be able to you'll be fine and you'll be able to follow along. So don't worry, just keep watching the video, and some of the stuff is pretty straightforward. So it's always helpful to have some sort of technical knowledge, of course, which will make things a little bit easier, but it's not required, and it's not really a necessary skill set in order for you to follow along in the course. So I just wanted to set that expectation that please don't be afraid and just follow along in the course and you'll be fine. First thing we want to do is we want to install Python. So the way you can do that is you simply open a browser and you navigate to python.org. And again, I'm using Windows, so you can simply just go to Downloads and depending on your OS, I'm using Windows, so I'm going to get Python 3.13 0.3, which is the version as of the time of this recording. Of course, this is going to change and increment and get higher depending on when you're watching this video. But again, the concept is the same. So I'm going to be downloading this for video. I already have that set up, so I'm not going to do it, but all you have to do is download this run the installation, accept some of the things that are in there, and then after installation, you're done. And the way you can check that everything went successfully is you can simply just open a terminal, which you can do many different ways on Windows. You can either press Windows and the archy together. So press and hold Windows key and then R and then it'll pop up I'll pop up this run command you can put in CMD. So this is one way of doing it. You can right click the desktop and go open in terminal, or you can just simply click the Windows button, type in CMD, and then click Enter and then it'll pop it up for you. So multiple different ways of opening this. But the thing I wanted to show you here is how you can check whether or not Python was successfully installed and it's added to the path. So there's a checkbox during the installation that you need to click that says add to the path. And that will make sure that it is added to your system path and it will be recognizable from different places. So all you have to do is just check the version. So what I'm going to do is I'm going to type in Python version, and you can see that it says Python 3.13 0.3, which is exactly what I download it. So if it says Python not recognized as a command, that means that Python was not installed correctly. So what you want to do is go back, download the installation and try again. So this is Python as a dependency. And the next thing we need is actually going to be an IDE. Now, it really, again, depends on your choice of what you like to use and your preference. I like using Visual Studio code because it's very user friendly, it's light. It handles all types of development, and it's really easy to use. And it's free, of course. So this is from Microsoft. All you have to do is navigate to code.visualstudio.com, and then just click Download for I'm using Windows' be Windows for you. If you're using a different OS, just download the one that's suited for your OS. And once you actually download that, what you can do is you can launch it from your desktop. You can launch it from Start Menu, or you can simply go in your terminal and just type in code. And press Enter, and then it's going to launch Visual Studio code, which is exactly what you see here, and then we'll cover things in details later. But the nice thing is, this is an IDE, but it also includes a terminal. So you can actually not just put your code in here and your files, but you can also launch the terminal and you can run commands here, from the terminal here, not necessarily the Windows terminal. So you have that capability as well within the ID, which is quite nice. One last thing I wanted to mention while we're here in Visual Studio code, the idea is that it would be nice to actually install the Python extension because it helps us with just making things a little bit easier in terms of code syntax when it comes to if you need to change things, format things, you know, linting, if you're familiar with linting or refactoring, and just syntax highlighting with that specific language is really, really helpful. The way you can do that is over here, this is the default explorer for projects. The last icon here is called extensions, which you can also use the keyboard shortcut, as you can see here on the tooltip Control Shift X. But simply if you click on this and in the search box, if you search for Python, you can see that's the language we're going to be using in the course for this demo. So you can see this one is quite popular, 164 million downloads. And if you click on it, it'll tell you exactly what this extension is good for. But it's really we're using it for formatting for the purposes of this course. It's good for debugging it's good for access points for the extension, support for It sense. So if you're making mistakes, it'll kind of tell you or catch it for you, formatting, linking, code navigation, refactoring, and, you know, lots of other features. So quite rich in features, nothing that you need to really be particularly concerned about. Again, we're using it for syntaxing because each language has a different sort of syntax, and also it color codes it for you. So when you're looking at the code, some lines will have different colors, which helps kind of distinguish where you are within the code. Go ahead and simply just click Install, and then that should install the Python extension for you in Visual Studio code. Now that we've installed our dependencies, the next step is to actually get our API keys. So API keys are sort of like passwords. They are used to authenticate, so they are unique to you and your account, and they're used for things like authentication. But also they are used for tracking usage. So how many requests have you made and things like that? So in order to do that, first, we need to go to the API dashboard and set up our API keys by creating one. So the way you can do that in Deep Seek is all you have to do is simply go on the top right hand corner over here, and there's a button called API. And if you click that, it's going to take you to the API dashboard. And over here, the first default page is the usage. So this is a brand new account, so I haven't really used anything. As you can see, the age, top up balance and the monthly expenses and the usage chart here, which again, showing zero because I haven't used anything. Now, in order for us to be able to use Deep Seeks API to integrate it into our code or applications, we're going to have to create an API key. So the way you do that is by going over here and clicking on API keys. And here is where you can actually create an API key to use in your code. And it's really, really simple. All you have to do is press Create, give it a name, click on Create API. And when you click on Create APIKey, so let's go ahead and make one. So let's say Do two, let's go ahead and create one. Over here, this is the only time you're going to see this. After this, it's going to get encrypted. So I recommend you copy this and save it somewhere until you had a chance to paste it into your application or build it into your CI or environment variable or however it is you're planning to use it. So go ahead and copy this, save it somewhere for the time being until you get a chance to actually use it. Because once you click on Done, there's no way to actually see this anymore. If you click on Edit, you can just change the name and the only other action is to delete it. Not a big deal because you can keep creating new API keys and deleting the old ones, but just know that once you create it, that is the only time you're going to see it. Now, now that you know how to create API keys, let's take a look at some documentation in terms of how this is going to be used. So on the bottom left here, you got this navigation bar, and you can see there's a button on the top called Docs. So go ahead and click that, and this is going to take you to the API documentation page. Now, what we can do is in our code, we can actually use the OpenA AI SDK. So over here, it says the Desk API uses an API format compatible with OpenAI. By modifying the config, you can use the OpenAI SDK or software compatible with the Open API to access DeepCk API. So that's something that is sort of convenient. We can use OpenAPI SDK and what that means is just that we simply have to install that dependency and import it into our code base so that we can use the OpenAPI SDK to make calls to Deep Seek. Now, one thing I wanted to show you here is over here on the bottom, you have one called Python, which is what we're going to be using in this demo. So if you click on the Python, it's going to show you a sample code here. And you can see the first common here, it says, Please install OpenSDK first and they give you the command to do that. So you can simply copy paste that into your terminal and run it, and it'll install Open API. SDK. We're not going to do it right now. Just wanted to show you a couple of things before we get started. So over here, you can see that first, you install this dependency, then you can simply just copy paste this code. You can do that by just selecting and doing Control C, Control V, or you can simply just click the Copy to Clipboard button here and it'll do that for you, and then you can paste it in your file. Python file. So over here, you can see that it's going to generate an open API client. Here you can paste in your API key, which we created in the previous step. This is the base URL to which the API calls are going to be made. And this is the response here, and this is basically what we're saying to Deepseek. We're saying hello, and then we're going to print the responses from Deep Seek into our console on the screen, so you can see how Deepsk actually replies. Now, we can actually go ahead and try this out. The problem is, I've tried this out, and unfortunately, Desk does not have a free tier. So in order for you to actually do this, if you try this on your own and you ran the code, you'll get an error message which simply says insufficient funds, and this is because DeSik doesn't provide free API tiers or models for you to experiment. So what you can do is you really have a couple of options. So you can choose another alternative that's free or if you go to the DeepskPlatform here back to the dashboard, you can see that you can click the top up button. And over here, you can actually use these preset amounts or choose a custom one, whatever you like to top up your account, and then you can actually use the Deepsk API through the method that I just showed you. And it's not too bad if you look at it. So it's a $2 option, $5 option, $10 option. These are great because they're very cheap, and it also allows you to experiment and learn before deciding whether this is the right solution for you or not. So $2 or $5 is definitely worth an investment so that you can learn Deep Seek and how to use it in your code. So if you like, you can take this approach. But what I'm going to do is I'm going to show you another alternative that's going to be free, which gives us access to the models and the API for Deepsk in the upcoming section. Now, before we get started, I just wanted to mention that I do understand that this could be a little technical for some people. So if you are just interested in learning, please follow along. It doesn't really require that much coding or technical skills when it comes to following this specific section. And this is more of an advanced topic when it comes to deep Seek. If you're comfortable just using the Deep Seek chat interface, the web interface, please feel free to skip this if you like, and just use the chatbot to put in your prompts and inquiries and get your responses. But if you're interested or if you're familiar with coding, and you're a technical person or just someone who's interested and enthusiastic about learning these type of things, then please feel free to follow along. Again, there's there's no major coding skills required here. As long as you can just watch the video and follow along with the demos, you should be perfectly fine. Now, I wanted to introduce another alternative which is free at this point in time, and this one is called Open Router. So you can simply launch your browser and navigate to openouter.ai. And this is a platform that provides access to many models. It's over 300 models as of right now. And they also provide some free credits. So I mentioned previously, Deepsk does not provide any free credits at this point. So if you're just wanting to not spend any money and still learn, this is a great alternative that you can use to run a few queries and integrate this into your code or application to just learn about some of the ways that you can actually run queries and communicate or integrate Deep seek into your code. So open Router is a good alternative as of the time of this recording. And again, they have lots of models. For some of the models, they offer free access. Very similar approach, you have to create an API key. But first, let's go take a look at the models here. And if you click on models, this usually shows things in a more sort of the most recent to the least, and there's lots of models here that you may not have heard of. So there's lots of lots of different models being published here. So you got the XAIKroqT Mini, you got Nvidia. You got the meta Lima. You got many, many models here, the Google Gemini 2.5 Pro preview, the Deep Seek, Deep Seek V three base. So many, many models here. And if you click on it, it's going to take you to the information page. But what we're going to do is we're going to click on the filter, and we're going to just look for Deep Seek. V three. Then again, there's different variations of deep seek V three. We're going to look for the free one. So over here, if you scroll down, this is the one we're looking for. Deep seek, deep seek V three free. There's also R one, which is the reasoning model. So if you want to check that one as well, you just type in R one and you will find the R one that you want to find the R one that's free. So that's this one over here. Deep seek R one free. So this is, again, you can see the description, the Deep seek R one is here. Performance is on par with OpenAI one, but open sourced and with fully open reasoning tokens. Again, it's equivalent to the 01 of the Open AI model as of right now, and this is available for free. So let's go back to V three. And the one we're looking for is this one over here. So it says Deep Seek Deep seek V three free. So go ahead and click this, and this is going to take you to this page over here. And what you want to do is if you click on there's a bunch of tabs up here, so you want to click on the API, and this is going to take you to this section, which is kind of self explanatory. So you can see there's a created API key. This is exactly the same step as we did in the Deep Seek API dashboard. So you just have to create an API key in this platform with an open router. It also shows you sample codes that you can use in terms of how you can incorporate this free model into your code. So over here, we got the Open Python, Open AI Python, we got Python Alone TypeScript, open AI TypeScript, and CRL. So it is simply just making the API call here using the curl command. This is the one that we're looking for, because as we previously saw, we can incorporate Open AI SDK and install that as an dependency and import that so we can easily talk to Deepsk. So this is the one we're looking for, and this is the code. And we'll go through this in a second. But I just wanted to show you that this is how you get to this place or this is how you can read through documentation in order to find out how you can navigate through this platform and the API doc so that you can figure out the sample code you can use and then later modify this to your liking. One other thing I wanted to mention is before we create the API key, one of the requirements that the Open outer have in place in terms of rules is we have to enable prompt training prompt. So what we have to do is if you click on the top right hand corner, there is a profile icon. If you click on it, there's credits, keys, activities, settings, and sign out. So if you click on settings, this is where you can actually go through different general settings and things like that. But what we want to do is I want to bring your attention over here to the left hand side. We've got settings, credits, API keys, provisioning keys, integration, and privacy. You want to click on privacy and you want to make sure that this option is available, or sorry, it's turned on because by default, this is turned off. What you want to do is if you want to use the free tier, you want to enable this. And this is one of the requirements because this is actually going to control whether to enable providers that can anonymously use your data to improve their model. This is used for again, they are using your data to improve their models. Obviously, we're not going to be putting anything sensitive in here. This is just for learning purposes. So I'm fine turning this on. I'm not putting in any sort of personal information or PII in here. So this is perfectly fine. And this is one of the requirements if you wanted to use this for free. If you use a paid, if you go ahead in the credits and add credits, which is similar to the top up in Deep Seek, then you don't necessarily have to have that on. But if you want to use the free tier, then you're going to have to turn the sun. Otherwise, when you run the coat, you're going to run into errors. So this is just something to keep in mind. Alright, now let's start to incorporate everything into the Python programs if you can write a simple script to talk to Deepsek and get some output using our proms. So what I've done here, I've just simply created a folder called Demo one. What I'm going to do is open the terminal here. You can simply do that by pressing Alt, CMD, and then type in code. Of course, you can open code and navigate to this different ways or just simply open the terminal and then navigate to the same folder. Either way is fine. However you want to do it. This is just a fast and shortcut way of doing this. New type in code space dot, and this is going to launch Visual Studio code in this directory. So it's going to be pointing to this by default. Now, the first thing we want to do is, let's go ahead and create a Python file. So we're going to go to File New file over here. It's going to give us some options, TextFile and Python. I'm going to select Python. Now I'm going to save this file first thing, so I'm going to go Controls. And then here, I'm just going to say deep Seek underscore test dot PY and PY is the Python extension file. So go ahead and save that. Now, we're going to go back to the over here, we're going to go back to the open router. You can see that what we're going to do first, we want to get our code. So let's go ahead in models. We're going to look for deep Sk. V three, and this is the free one that we're looking for. Click on that again, go to API, and then OpenAI Python is the one we're looking for. So go ahead and copy this, and then we're going to go back into Visual Studio and we're going to paste that. And the code here is pretty simple. So let's just walk through it. So this is going to import the OpenAPI SK, and we're going to generate a client to make the API call. So this is simply the base URL, so it's going to make the API call to this base URL. And then this is where you want to put in your API key, which we'll do in a few minutes. This is when we create our API key, we want to paste it in here. And then over here, this is sort of optional, just additional headers if you want to include them into your call, your API call, but we're not going to do that. We'll just leave it and then over here it defines the model. So we're using the Deep Seek chat free, which is the V three, and then over here are the messages. So we've got the role, which is our role as a user, and then you got the content, which is what is the meaning of life. Now, this is equivalent of you putting in the prompt in Deep Seek's chatbot, asking the same question on the web interface. So this is very similar to going to Deepseek and typing what is the meaning of life and chat with it and then get the response back. And the last line is simply just showing us the results or the output of Deep Seek to that question on the screen. Now, next step is, what I'm going to do is on the bottom right hand corner, there is this thing that's sort of like a warning, yellowish, brownish thing that says select interpreter. One thing I'm going to do is I'm going to click that, and this is really asking us what environment do you want to use? Do you want to use the general global recommended setting, or do you want to create a virtual environment? Uh, either way is fine, up to you what you want to choose, but I like to personally use the virtual environment because it keeps the changes localized to that project or that folder that I'm working with. And it doesn't really affect or conflict with anything in the global setting. So I'm just going to click that first, then it asks you which one would you like to do the Conda or V ENV. I'm just going to select the first one, and then it's going to ask for the path. I'm just going to select use this as a reference. So the global one where is the initial binary for Python is, I'm going to do that. And then it tells you that it's going to start creating that environment. And if you go back to your folder, you'll see that it is creating that environment and you'll see a new folder. So we'll see that in a second. So it says the following environment is selected, so that's been created. Now, if you go back here, you can see that it's created this folder called VENV, which is that virtual environment. Next thing we want to do is install the Open AI SDK, and that's very simple. So all you need is the terminal over here. So over here on the bottom, Visual Studio code has it. This is one of the nice things I like about this. It has a built in terminal, so you don't have to create or run additional terminals from windows natively. So this is nice. If you don't see this, all you have to go is to go terminal and go new terminal, and then they'll pop up this one over here in case it's closed for you when you're looking at it by default. Now, let's just get the command here again, super easy. I just want to show you so you know exactly where to go. If you go back to the A Deep Seek API documentation, which I've showed you how to navigate there previously, all you have to do is simply just go click on Python. On the very quick Start guide, your first API call, you just scroll down, you click on Python, and then this is the first line here in the comments. So it says, Please install OpenAI SDK first. All you have to do is simply just copy this, which is simply just Pip install Open AI and then go back to your terminal, paste this and just press Enter to run this command. And this is going to install the Open AI SDK. And as you can see here, it says requirements are already satisfied. It's saying that because I already installed this. And if you don't, you'll see a little bit of a different messaging which says, Okay, successfully installed the OpenAI SDK. Now let's switch back to our browser where we had open Router. Again, by default, we are on DeepCk V three free model, which is this one over here, DeepCchat call and free. And over here, we already copy pasted our code here for Open AI Python. Now, one of the other things we have to do before we can run the code is to create our APIKs because we need to paste it in here so that we can use it. So let's go ahead and click on Create APIC. Again, just as a reminder, you need to turn the privacy setting for prompt training on before you actually do this. So make sure that's already on which I've covered previously. So go ahead and click that, and that's going to take you to the API keys dashboard. This is very, very similar to Deepsix. If you look here, there's some settings. There's credits if you want to add. If you want to add money, you can click on credits and add money and then use the paid version or paid tier. API keys, this is where you can provision your API keys. You can create them, delete them. So this is what we're going to do. So over here, it says, there's two things, two fields, the name and the credit limit optional. So it says if you hover over the information icon, it says, once the credits consumed by the API key, sum to this amount or more, it will no longer work. Leave blank for no limit. So again, it's optional, we'll just leave it. And then over here, what I'm going to do is I'm just going to put in Deep seek test. Sk underscore test, underscore key. So we can create this. And then again, when you create this, this is the only time you're going to see this. And after you close this out, you're not going to be able to see this again. So make sure you copy it and immediately paste it into where you need to paste it. So we're going to go here, and this is where it says under client, it says API key. I'm going to it says, This is open outer APIkey. I'm going to paste that in here. So you can see my API key over here, and then I'm going to save. And now our program is ready for us to. Alright, we're ready to run the program, and this is the last step, and it's very simple. All you have to do is going into the command prompt. I'm just first going to. There's a lot of stuff mentioned here. So you can clear this out by simply either, let me just go ahead and just type in CLS here. And CLS basically means clear screen in Windows, so I'm just going to do that. And the way you can run this is just go ahead and type in Python. And then you can press tab if you like for autocomplete space and then name of the file. So this one is called Deep Seek. But I'm not going to type. You can type the whole thing if you want, so deepskUnderscore, test dot pi. But you can just simply use the smarter method where you just click tab and then it will auto complete the file for you 4. Effective Prompting: Great prompts lead to great results. In this lecture, you learn how to craft clear actionable prompts that unlock Deep Seek's full potential, whether you're writing emails, debugging code or analyzing data. Imagine you're teaching a new team member. You wouldn't say write a blog. You'd explain the topic, audience and length. Deep Seek needs the same clarity. Let's break it down. Need a linked in post, task, write a post. Context for startup founders about AI tools. Format, three short paragraphs with Emojis. That's simple, right? Ever ask Deep Seek for a creative story and got Gibish. Without details like genre or length, it's likely ordering food at a restaurant. Be the chef of your own prompts. Watch how a poorly phrased prompt leads to confusion and how tweaking just a few words gives us exactly what we need. Then you'll try it for yourself. Okay, so the objective of this demo is to turn vague requests into precise actionable prompts. For this demo, the tools we need is just a deep seek web interface and, of course, the free account which you created from a previous lecture that we covered. Now, what you're going to learn in this demo is it's going to teach you how to iterate and not expect perfection on the first try. This demo also shows how small tweaks can save hours of editing. Now, let's start with a bad prompt for our first step. So what I'm going to do is I'm going to copy paste the first prompt in Deep Seek, and this simply says write about solar power. So you can see it's kind of generic. So let's go ahead and run this prompt and see what deeps comes up with. So you can see deepsk is starting to generate some output, and it's trying to explain to the user about solar power. So solar power is a clean renewable energy source and so on. And then it talks about how it works, advantages of solar power, future of solar energy, and so on. So again, very broad, high level, not really targeted. So this is as you can see, because we're giving you the very broad and generic prompt, it's giving us generic and unfocused text in terms of output. So this is what I want you to see is how Deep Seek now defaults to broad explanation. So this tells us that without guidance, it can't really match your intent. So now let's go ahead and add some context. So what we're going to do is revise the prompt and make it more we're going to make it more targeted. We're going to give it context, and we're going to change the tone. I'm going to use the following prompt. And the prompt says, write a 200 word email for solar company CEO to send to investors. Highlight cost savings and sustainability, use a professional tone. So you can see this is a much better prompt because it's quite focused and it's quite targeted. So let's go ahead and run this prompt. There you go. So Deepsek is starting to write the email. As you can see, it starts with the subject, very powerful and a great hook, so it says unlocking value and sustainability through solar innovation. It's not too long, right, compared to the previous one. This is just generic text and explanation. This is more formatted than suitable for email. So here you have your subject. Here you have your placeholder, so you can fill this with the actual information. Again, this is nice because Deepsek is creating that template for you. So you can replace the information with the one that's applicable to you. So for instance, here's a placeholder for company you can remove that and replace it with what is applicable here for your company name or the investor's company name, whoever this is targeted towards. Here, you got the X percent saving, so you can replace that with a number, whatever that may be. Over here, again, you got X. So just keep an eye out for these things in bracket because they're placeholders which you should be replacing with your own information. And of course, again, you got your name, the company, and then the website and so on. And then again, the word count is approximately 200 around 200. So over here, you can see that the context, the result is actually targeted, and it's in the form of an investor ready email. And the context tells Deep Seek the who, the why and how. Now the CEO sounds like a leader, not a textbook, right? So let's go ahead and do one more follow up prompt to refine the format. And what I'm going to the way I'm going to revise this is I'm going to use the following prompt that says, turn the email into five bullet points for PowerPoint slide. So now I want to use this information, right? And I'm going to create a PowerPoint slide. So I'm telling you, summarize this, put it into five bullet points, which is suitable for a PowerPoint presentation slide so that I can share that with my team or whoever the audience of this presentation is. So now Deepsek is actually taking that, and now it's giving you that bullet point that you can use in your presentation. You see it is trying to also make it quite engaging. So it's including emojis as icons. Now it's up to you if you want to use those. But you can see it's given us five bullet points, exactly what we asked it to in the prompt. And you can see significant cost saving and then the explanation, financial incentives, sustainability, scalable and future proof growth opportunities. So now you can actually simply copy paste this, make sure you read it, make sure it's factually correct, and then you can copy, paste it, maybe change the emojis or whatever you want to do, make the necessary edits, and then put it in your powerful you can put it in your PowerPoint slide, excuse me, PowerPoint slide. Now, you can see the results. They're clean and they're scannable bullet points, right? So this is the point of this demo is that formats matter. Bulets help investors scheme. Emails need full sentences. And this way, you can see that Deep Seek can adapt to our needs. Now, while we're here, I wanted to share a couple of troubleshooting steps in case you run into it. Obviously, we didn't run into it here. But let's say, for example, you have a problem where the output is too long, so it didn't really respect the 200 word count over here. So what you can do is you can have a follow up prompt and you can tell it to, for example, keep responses under 200 words. So this is one thing that you can, again, try as a follow up prompt, and then it should take that into effect. And then the other thing is if you notice that the tone is not what you asked it to. So for example, if it's not a professional tone or it doesn't sound like a professional tone or maybe engaging for an investor email, what you can do is if you feel like the tone is off, you can just again, have a follow up prompt that says, use the following tone. So, for example, use a casual tone or use a friendly tone or use a professional tone. And you can use that as the follow up prompt to help you make this rewrite this email according to that tone that you specify to Deep Seek. Keep this cheat sheet handy. Soon, crafting prompts will feel like second nature, and you'll wonder how you ever worked without it. Practice makes permanent. Try the meal planning exercise, share your results, and get ready to level up with advanced strategies next time. 5. Effective Prompts: Welcome to the Art of prompting. In this lecture, you learn how to craft clear, actionable prompts that get you the results you need, whether you're writing emails, analyzing data or brainstorming ideas. Think of DeepSeek as a new team member. You wouldn't say do something marketing related. You'd say draft a 300 word blog about AI trends for small businesses. Clarity is key. Star turns chaos into clarity. For example, as a fitness coach, which is the situation, create a seven day meal plan, which is the task with vegetarian recipes, which is the action to attract busy professionals, which is the result. Try this formula. See the difference. The good prompts tell DeepSeek exactly what you need. No guesswork, no wasted time. Let's transform a week prompt like write a social post into a powerhouse. Watch closely, then you'll try it yourself. Alright, in this next demo, we're going to transform a vague idea into a targeted actionable prompt. And the only tool you need is your DeepSeek account and a browser. So all you need to do is log in, and the DeepSeek web interface is all you need. Now, this demo, it's going to teach you to iteratively refine prompts and not expect perfection immediately. And it shows you how small twoks yield professional grade output. Now, let's start with the first step, and now we're simply just going to write a vague prompt. So here we're going to do a social media post. So I'm going to paste in the following prompt that says, write a social media post. Again, very vague, no focus, no target, doesn't really even say which social media platform. So let's go ahead and run this prompt and see what DeepSeek comes up with. So over here, you can see that it's trying to create a versatile social media post template. So it says, over here, exciting news, there's some placeholders here that you can put in whatever the milestone or achievement is, comment below, and then here some ideas of what you can sort of suggestions and here's some hashtags to maybe make the post go viral on the platform. So again, you can see the results are generic because focused texts, like social media is important. And again, this is not a gray prompt. So without direction, DeepSeek defaults to bland generic responses. So let's go ahead and fix that. Now, what I'm going to do is use a revised prompt that is going to be a lot more targeted and follows the prompt checklist, right? So what I'm going to do is paste in this prompt that says, You're a sustainability coach, write a LinkedIn post for entrepreneurs about reducing office waste. Use a motivational tone and include three practical tips. As you can see, target the subject is clear, the target audience is clear. The social platform media is clear. It's LinkedIn, so the post will be tailored for LinkedIn. And the topic and the subject, again, is very clear about reducing office waste. And then the tone additionally, is very clear. It says, Make it motivational and also share some practical tips that you can use in your LinkedIn post. So let's go ahead and run this and see what LinkedIn comes up with now that we've improved our prompt. Okay. So there you go. Reduce waste, boost impact, three simple shifts for sustainable offices. So very powerful messaging, great hook. It's very attention grabbing, and then you got your three points here, Dingle use everything, go digital set up green stations and things like that. Again, this is a much better pose that you can use as an idea, or you can simply even grab a lot of this stuff or copy pasted because it is tailored for linked in, right? So you can see that the result is audience focused. It's a audience focused pose with actionable advice. And the context that we provided in our revised prompt tells DeepSeek who you are, who you're targeting and what actions to take. Now, let's go ahead and revise again. And this time, we're going to turn this into bullet points and add a call to action for them to download a free guide. So I'm going to use the following prompt to accomplish that. So I'm going to give DeepSeek the instruction that says, turn the tips into bullet points and add a call to action to download a free guide. So now you're guiding them to a download guide, right? You're guiding the users or whoever's viewing the post by placing a call to action and then have them download some free guide, which again, that could lead to other leads. So let's go ahead and run this prompt and see how DeepSeek is going to revise that. So there you go. It's rewriting it, and it is using that in sort of I guess, the most important thing here to pay attention to is the call to action. So it says download my free five step off apace reduction guide. And then here is where the placeholder is so you can put your wherever the download link is to your free guide, you can place that there and they can click on it and then go from there. So you can see the result, it's scannable and it's readable, very friendly, and it's engaging post. It is engaging post with a clear call to action, also known as CTA. So the important thing to take away from this demo is that format matters, and bullets make your posts schemable and call to action drive action. Now, a couple of tips that I have for you here is, in case you feel like the output is too formal, what you can do is simply use a follow up prompt that says use a casual, friendly tone, which is good for social media platforms. Another problem is if you're missing examples and you want to add an example, because the topic here is sustainability, you can go ahead and use a follow up prompt to add an example. So for instance, what you could do is say, include a real world example about recycling paper. Right? So again, this is just something to note in case you see the results from your prompts and you feel like this is missing. You can always add in examples related to your topic by follow up prompt. Here's a prompt checklist. Keep this checklist handy. Soon, you'll craft prompts like a professional without even thinking about it. Practice makes progress. Try the exercise, share your best prompts with your friends or coworkers, and get ready to dive into content creation next. 6. Blog Creation: In this lecture, you'll see how to turn a rough idea into a ready to publish blog post in less time that it takes to brew coffee. No writing experience is required. Whether you're a solo or a freelance blogger or part of a team, blogging builds authority, but starting at a blank page, that's where DeepSeek shines. Let's see how. Forget hours of writing. With DeepSeek, you're the editor, not the typist. We'll start with a vague idea and polish it into a professional post step by step. Even the best AI needs guidance. We'll avoid these traps and create content that actually resonates with your audience. Let's walk through an example where we create a ready to publish blog post using DeepSeek web interface. And the only thing for this you need is in terms of tools, is just a web browser, Internet connection, and a DeepSeek account, and you just need to be logged in through DeepSeeks web interface. Now, for step one, let's start with brainstorming the topic. So just go ahead and click Create New chat. And what I would like you to do is use the following prompt. So what I'm going to do is I'll copy paste that here. And this is going to say, I run a productivity app for remote teams. Help me brainstorm five blog topics about time management. Again, this is just an example for this demonstration purposes, but you can replace with whatever is applicable in your contacts. Now, let's go ahead and run this and see what DVC comes up with. Okay, now we can see the results. It's giving us exactly what we asked for. So five blog topics. And this is good. It's giving us a topic, for example, time blocking versus task batching, how Async work saves time, hidden time wasters in remote work and time tracking for remote teams, productivity or micro management. So these are good topics. Again, they're not the full on blog posts, but they're just the topics. And you can see that it's also giving you a couple of bullet points where it's giving you ideas, right? This is really powerful because you can use AI for ideation. It's giving you ideas in terms of what you can talk about, what you can cover in your blog post to make it engaging and very interesting for your audience and your readers. So explain how remote workers can use this technique. You can say compare that the two methods and provide real world examples and so on. So you can read through this yourself by pausing the video, but, of course, please feel free to follow along as we go through the prompts together. But again, this is important because you can see that it's giving you the results and helping you with the ideas. Now, this one here is you can go ahead and choose a topic, right? Once now you can choose a topic. If you don't like what's here, you can just follow up with another prompt to another follow up prompt saying, I not interested in any of these five, give me another five, right, and it'll generate you five more that are different from these five that I mentioned here. But if you do like this, then you can go ahead to the next step, which is now you have your topic. Why is this important? It's because DeepSeek generates ideas that you might not have considered. Because when you start to write when you want to create a blog or write a blog post, you probably have some ideas, going into it. But sometimes these might be more interesting or some of these ideas you might not have thought of, right? So that's one thing, ideation. The other one is it's actually going to save you time from brainstorming. Right? This is really important. Now, let's say, for example, one of these ideas were that it simply said, you know, I mean, it's not here right now, but let's say, for example, number one was five time blocking hacks for distributed teams, okay? Whatever you can do the exact same thing with any other ones that you see on my screen or the fives that you get on your screen because we're going to get different results. Maybe some of them overlap, but AI generally gives different results, but some of them are going to be similar. So let's say one of them is five time blocking hacks for distributed teams. So what I'm going to do is use a different prompt to actually generate the block. So we passed step one, which is ideation and brainstorming. We got help from DeepSeek. Now we're going to generate the draft for our post. So I'm going to use that the example I mentioned, and I'm going to say via the following prompt, or to DeepSeek to actually create that blog post for me. So write a 1,200 board blog titled a blog titled Five Time Blocking hacks for distributed teams. So here's the audience that I'm defining. Here's the tone, and here's the include, which says SCO keywords, so search engine optimize subheadings and a call to action. So again, I'm giving you very specific instructions for my blog post so that maybe I can direct my readers at the end to a different page or a different product. So let's go ahead and run this and see what DeepSeek comes up with. Again, you don't have to use this one. You can use any other ones you see here. And now, DeepSeek is starting to generate and write the block for you from scratch. So again, it's saving you a ton of time. You don't have to do any of this typing. You don't have to think of any of this stuff. It's actually doing all of this for you. And you can see it's quite nice because it's breaking it down into section. And again, keep an eye out for placeholders because this is what you have to fill out with your own information, like, for example, your name or any other placeholder, look at the context. So here's the title. Here's the introduction. Why time blocking matters. And here's over here, basically the tips that we asked for five. So here's the one. Here's number two. Here's number three. Here's number four. Again, it's giving you some examples of schedule, right? And then here's number five. So this is kind of like the blog post, and then here's a bonus section and then final thoughts. And over here, call to action, pick one hack to tests this week, and then over here, there's some ideas like try our app or book strategy. You can put in a link to your book that could be on another ecommerce website, like Amazon, for instance, and get some leads here, from your blog post. So you can see that it's full draft with Intro, the five hacks and the conclusion, final thoughts. So that's the conclusion. And then you can see the SEO keywords as well here, time blocking for remote teams, best for productivity hacks, Async work scheduling. This is really important. So again, this is all a search engine optimized. So when people go into search engines like Google, they can actually search for these things. I will going to prioritize your blog based on the results and the search if it's search engine optimized, and it's going to rate your page higher. Now, you can go ahead and refine and polish this. You can use a prompt, for example, make the tone more casual and add emojis to subheadings. You can shorten this section, so you can use a prompt that says condense hack number three into three bullet points, right? So whatever you see if you find one of them is really long, you can just target that specific number. So you can say, take number three and condense it into three bullet points, for instance, right? And then you can add, again, in this case, we did, but we can say something like end with a call to action to download our free time blocking template, and then you'll do that. So this is great because it's important to understand that iteration matters. Don't think you're going to get everything perfect the first time. You have to give it follow up prompts. First drafts, it's really important to understand. First drafts are rarely perfect. Almost never. They come up perfect. So small tweaks personalize the content. So again, that's why I mentioned that the three prompts over here after we finished or after DeepSeek finished giving us the blogposts, again, you can adjust the tone by saying, make the tone more casual and add Emojis to subheadings. You can condense the hack into X number of bullet points. You can end with a call to action to download our free time blocking template. These are all follow up prompts that you can put in, plus, of course, anything else that you can come up with for your use case. Um, and it will add those and refine this original draft of the blog post. Now, a couple of things to note is that, again, if you feel like the blog feels generic, then you can add, you can have a follow up prompt where you say, include real examples from, you know, tech startups. That's one example. If you feel like the results are really technical, for your audience, again, depending on who your target audience is for this blog and who your followers are and you feel like this is too technical, for instance, you can say things like, you can use a follow up prompt that says, explain terms like time blocking in simple language, and it's going to do that for you. DeepSeek is going to make that happen for you. You have just automated the hardest part of blogging. Now, focus on prompting your content. DeepSeek handled the heavy lifting. Now it's time to do an experiment. Create a 500 word blog titled Top AI Tools for whatever industry that you're interested in. 7. Debugging: In this lecture, you'll see how DeepSeek acts as your coding mentor, explaining errors, fixing bugs, and even suggesting optimizations. No programming expertise required. Even seasoned developers make mistake. DeepSeek doesn't just fix your code, it teaches you how to avoid similar errors in the future. Let's see how. You're not alone if your code throws errors. Let's take a buggy Python script and watch DeepSeek diagnose and fix it step by step. We'll start with a script that should calculate sales tax but crashes. By the end, you'll know exactly how to troubleshoot your own code. In this demo, we're going to be debugging a very simple Python script, and the objective is to use DeepSeek to fix a buggy script and understand the solution. So what I've done is I've put together a very simple Python script that has purposely included a defect in there, which prevents the code from running and throws an error. And we want to learn how we can use DeepSeek to analyze the code and find a solution so that we can fix our broken code. For this, just in terms of tools and environments, you just need the DeepSeek web interface, but if you like to follow along, and if you don't mind getting a little bit technical, feel free to have Visual Studio code installed and also Python installed, which we covered in one of the earlier lectures in the course. So here, what I've done is I put together a broken code purposely just so I can show you that it's not running in Python. So the first thing we want to do, and by the way, feel free to pause the video and follow along. But if it's too complicated, you can just simply skip this lecture or you can just follow along in the DeepSeek web interface when we ask for solution. So what I have done here is I've created a folder on my Windows machine, and what you can do is just right click and go open in terminal. And here you can simply type in code space dot and then press Enter and this opens Visual Studio code in the current working directory. And first thing we want to do is we want to go ahead and create a new Python file, so I'm going to go file new. I have the extension installed here, so it already detects some of these presets for me. I'm going to select Python file. I'm going to click Save First, and let's just call this salesnderscore text dot pi. And save our file. And what I'm going to do is I'm going to copy paste in the broken code here. So this is just a function that is supposed to calculate the sales tax, and we're going to print the results to the screen. Now, one thing we want to do is we want to go ahead and run this code here. So I'm going to save and over here at the bottom, I have the terminal window, but if you don't have this already, you can bring it up this way. So let's say I close that, in case you don't have this on the bottom, you can go to the terminal menu, click new terminal, and then you have access to this. And once you do this, it stays there until you dismiss the terminal again. So let's go ahead and try and run this code, and you can see already because I have the extension, it's already showing me this in red. So it is already automatically detecting some sort of error, but let's say it wasn't there and we want to go ahead and compile and run the code here. So the way we do that is in the terminal, we're going to type in Python. And again, you don't have to type the whole thing. You can just type Python and then tab it, and then that detects the Python binary and then space the name of the file, which is sales. Again, you can type in the whole file name or you can simply click on tab and it auto completes it for you. So Python space the name of the file and then click and hit Enter. And you can see that the compiler is throwing an error and the error in this case, is very helpful because it's saying that this bracket here, the parenthesis was not closed. So if we did open one for the print function, we just never actually close it. And this is why the code is not able to run. Now, in this case, the thing that's wrong with this code is that it's missing the closing parentheses in the function definition, and DeepSeek will be able to spot this instantly. So let's go ahead and get some help from DeepSeek. In this scenario, again, because we have a good IDE and because we have the Python extension, the error is pretty clear. So you don't really need to use DeepSeek for such a simple issue because it clearly tells you what it is. And if you go ahead and just put in the bracket here and save and run the code again, it works. But imagine that you are using a different ID or maybe you're just dealing with more complicated code. This is just an example for the purposes of this demo. But let's say in real life, you're dealing with a much more complicated code and the error is just too complicated to figure out, and it's just, you know, lines and lines of stack traces and code that you need to sort of dig through in order to understand and identify the root cause of the issue. And this is where the instances we want to use DeepSeek for. So what we're going to do is let's go ahead and pull the web interface, and let me just bring that up. There we go. First thing, we want to put in our prompt. Our prompt is going to say explain why this Python code fails and fix it. Then here I have a placeholder, so I'm going to copy in my broken code here. I'm just going to remove this and then paste in the broken code. Again, don't worry too much about the formatting, indentation, comments, no comments, things like that. DeepSeek is smart enough to be able to figure this out. So go ahead and copy paste this following prompt, and then let's go ahead and have DeepSeek analyze the broken code and see if he can identify the issue. Okay, there we go. So over here, DeepSeek has identified some potential issues. So it starts saying that the Python code you provided is actually correct and should work as expected. So here's potentially it's helping us with some troubleshooting steps that potentially we can explore to see if it's going to help us fix the s. So one is incorrect Python version or environment. So in this case, we are not this is not our issue because I know my Python environment and installation went fine. I have it added to the path, and I've been running Python code, so it's fine. Indentation errors, this is a possibility. But over here, again, it says it could be messed up. So for instance, the return statement is not aligned properly, and the last thing is typo or missing parentheses. So over here, this is actually one of the issues, and this is indeed the root cause of the problem that our code is failing. So it says if you missed a parentheses or made a typo when running the code, it could fail. So for example, and then here is actually where it has the code here, so the print statement at the very end. It's actually putting in it says with missing parentheses. So it's missing that parenthesis over at the end there in our original code, right over here, it's missing the parentheses that we open over here at the print line. And it says this would cause a syntax er. Now, fixed code. It still thinks this is not 100%. This is why AI, you have to fact check everything because the code is not correct, but it thinks it's correct, but it still gave us the solution, right? It still gave us an answer. And remember, these models will improve over time, as well. So a month from now, it might not even say the original solution is correct. So they are constantly training the organizations and companies who build and release these models are constantly training them with new data from users, so it will get smarter over time. Now, it did fix here, and it says, Here's the same code with proper formatting and a more explicit test case. So it's funny because it even created a test case for it, but let's not focus on that. For now, let's just focus on this here. So, you can see that here, it actually put in the parentheses for us, and it says the expected output should be 108. So let's go ahead and let's go ahead and copy this, and then we're going to go back into our visual studio code, let's paste this. Okay. So you can see that now it automatically added this last parentheses, which is the closing bracket for this first one in front of the print function. So let's go ahead and save this. And let's go ahead on the terminal, and then you can simply run the last command by pressing the up archy, and then let's go ahead and press Enter, and you can see that now the code works, and it's displaying us the result, which is one oh eight. You can even see that DeepSeek mentioned that in the comment over here. So this is now the correct response, and this is how you can use DeepSeek to help identify the syntaxer and it provides you the corrected code. You can even write test, use DeepSeek to write test for codes such as this. Okay, now let's go ahead and try different error. So the previous demo included a syntaxer. Let's try a logical error. So for this, I'm going to do a little bit of different example. So let's go ahead again in Visual Studio code. Let's create a new Python file here, and then I'm going to paste actually, let me save this first. So I'm going to add, say, even numbers, Pi let's go ahead and save this and then paste in the following code. So over here, this is our function. So this is what we want to you're trying to what we're trying to accomplish with this code is we want to sum event numbers. So let's go ahead and save this. Let's go in the terminal. And let's clean things up. So I'm going to put CLS, which is clear screen in Windows command prompt or terminal. And let's go ahead and run this file. So Python space, even numbers. Let's go ahead and run this. And you can see that it says, we cannot. The compiler is throwing an error it says cannot assign to expression here. Maybe you meant double equal instead of single equal. So equality versus assignment. So it is giving us some errors, but again, we're not trying to use this to identify root cause of the issues. We're trying to use DeepSeek. So let's go back into DeepSeek and ask for help on this particular. Okay. So now, let's go ahead. I'm just going to create a new chat here and I'm going to create the following prompt that says This code should sum even numbers, but it crashes, fix it and explain it. Then I'm going to insert a new line, and I'm going to paste in the code that we just saw together. So let's go ahead and run this and see what DVC comes up with in terms of troubleshooting steps. Okay, there you go. So DeepSeek was able to identify the issue, and let's wait for it to finish. Okay. So the code crashes because there's a syntaxer if the if condition. So my apologies, this is also a syntaxer not logical. The logic in terms of this is the operators over here, but the equality comparison operator in Python is not equal. Is actually double equal and not equal. The single equal is assignment operator, which is not valid in this context. So assignment is used for assigning values to variables, for instance, and equality is for checks, checking if something equals to something else. So it was able to identify that. This is a high level brief explanation, right? And then here's a more in depth. So it says explanation of the fix. So this is really good because it's helping you learn. It doesn't just give you the output or the answer, the right answer. It's also helping you learn from this. So original error corrected condition, and then the result, and then some additional notes here. Okay. So now you can see that it has fixed the code. So in the initial one, we said if non percentage two equals zero, you can see if non percentage to equal equal zero. So this is the fixed changed equal to equal equal. So it even left a comment here saying exactly what line it changed and what the change was. So now let's go ahead and copy this code, go back into Visual Studio. Let's get rid of all of this, and then paste in the new code, save and then run this again. And there you go. You can see that the execution was successful, and the result of summing all the even numbers, in this case, was six. So you can see that it was pretty helpful in terms of identifying the issue when it came to assignment operator versus the equality check operator. And DeepSeek was able to explain the fix in plain language, and it even gave you some troubleshooting tips in terms of, you know, the steps you need to take and the things to look out for. And, of course, this is not limited just to Python. You can really use any language like C plus plus, C Sharp, JavaScript, anything that you like, you can use DeepSeek to help debug your code. You have just automated the most frustrating part of coding. Now, focus on building cool projects. DeepSeek got your back when things break. Now, it's your turn to experiment. What I would like you to do is debug this code and reflect on your findings and share it with your friends or coworkers. 8. Research and Summarization: In this lecture, you'll see how DeepSeek can analyze lengthy documents, extract key points, and deliver concise summaries, saving you hours of reading. Perfect for students, researchers, and professionals. Imagine condensing a 50 page report into five bullet points without losing the core message. That's the power of DeepSeek. Let's put it into work. Whether you're writing a paper or prepping for a meeting, DeepSeek acts as your research assistant, highlighting what truly matters. We'll take a dense article and transform it into a snackable summary. Watch closely. You'll see you'll use this technique daily. In this demo, we're going to use DeepSeek to summarize a research article. And the objective here is to condense a lengthy article into a structured summary with key takeaways. And for this, you just need DeepSeek web interface. And, of course, an article 0F your choice or just some sample text you can use your own if you like. I'm going to be using one over here. And what we're going to do is let me share this with you first again, I just made this for the purposes of this demo. So here we have an article 0N climate change. And you can see it's quite lengthy. It's about three pages. And if you look at the word count, it's about 732 words. Okay. So it's quite lengthy. And let's say someone who is really busy and they have very limited time. They don't have time to read the whole thing. Let's imagine this was a 50 page article. It doesn't really matter. The thing is you need to know the important bits and pieces of what's happening. So what you can do is you can get help from DeepSeek in order to achieve that. Whenever you're very short on time, or if you simply don't you don't get value from reading the whole thing, and you just want to jump into the key takeaways. So what we can do is we can use the following prompt in DeepSeek that simply says, summarize this article in three bullet points, include key statistics and solutions. Again, this prompt is quite actionable and quite focused because it it's giving DeepSeek exact instruction on how many bullet points and what to include, of course, you can change this to suit your needs based on whatever the circumstance or the use cases. For example, if you wanted to, you could say, give me three bullet points, and the bullet 0.1 should be talking about the problem, the second one, the impact, the third one, the solution. So you can even define it and go deeper and get more granular if you like. Or you can keep it more high level and leave it up to DeepSeek to determine how it's going to break it down for you. So let's go ahead and I'm going to now put in a new line, you don't have to again, DeepSeek is able to interpret those things for you. The new line, new space, comma, stuff like that, not a big worry. I'm going to copy paste this whole article. We're going to go back into DeepSeek and I'm just going to paste it. So now let's go ahead and press Enter and let DeepSeek do its thing to see if it can summarize this, analyze the article, summarize it into three bullet points according to our instruction. Okay, so DeepSeek has finished putting together the results, and as you can see, it has broken it into three bullet points as per request. Got your first one, severe drought risk, the second one here, and then the last one over here. And you can see it also has some sub bullet points with the more details and some stats, which is exactly what we asked in our prompt, which is great. And this is ideally formatted for a presentation because you could simply copy paste these in a presentation or a PowerPoint if you're giving presentation to your team or a group or your audience, whoever they may be. You can see that now it's taken that three page article, and it's broken it down and summarized it. And it's included key details, and it has made them bold in terms of font. So you can see the numbers here are made in bold font, which is good because it stands out as you're scanning. So this is great because, of course, this is shorter compared to what it was before. I broke it into three major categories or bullet points. It includes detailed for each. And the reason this works is that bullet points make the summary scannable and easier to read. And of course, keysts and sources are retained in the summary. So now let's go one step further and refine this for a specific need. So in this case, let's say we want to create 100 word paragraph for our business audience, right? So let's go ahead and use the following prompt that says, convert this summary into 100 word paragraph for business audience, focus on investment opportunities. Very important, right? We are changing the audience here to business. And the theme here is investment. So let's go ahead and run this and see what DeepSeek comes up with. And there you have it. So DeepSeek was able to put together this 100 word summary for a business audience, and it does highlight the investment category that we actually included in our prompt, which is great. And again, this is more targeted for a specific audience, in this case, a business audience. So the one takeaway I would like you to have from this demo is that iteration matters. And the reason why iteration matters is because it tailors the content to your audience. So for example, investors versus students. Also, it adds actionable insights to the summary, for example, ROI examples or return on investment examples and numbers. Now, before we end this demo, just wanted to share a couple of troubleshooting tips in case you run into this when using DeepSeek. So let's say that your summary is actually missing important points. This is where you can use DeepSeek and a follow on prompt to ask it to include, for example, in this context, you can say include data on economic losses from drought. So you want it to be very specific if you're noticing that it's missing the important points. This is why it's really important to actually read through DeepSeek output and what it's giving back to you. After your prompts, just so make sure that it's not just creating stuff up that things do make sense, right? The output does make sense. And this is if you do notice that it does miss some of the important points that should have been there, you can fix that via follow up prompt. Again, such as include data on economic losses from drought. Another problem that you may run into is that you might find some of the words used in the summary might be too technical for your audience. So again, you can use a follow up prompt to say explain terms like and then insert the word that is too technical in simple language. And then it will be DeepSeek will be able to use a different word to explain that to make it easier for your audience to understand the response from DeepSeek. Before we move on, I would like to show you one more approach or strategy that you can leverage to have DeepSeek analyze files and summarize the content for you. In the previous example, we looked at this very lengthy article 0N climate change, and when I gave DeepSeek the prompt, I copy pasted the entire content. Now, we could achieve the same results by actually uploading the file and not copy pasting. So just another way of accomplishing the same thing. What I've done is I've actually saved this file as a Word document with the file extension dot X. And what I'm going to do is I'm going to upload it to DeepSeek, and there are two ways to do it. So first, you can click on here, and you can see that the tool tip tells us this is text extraction only. So you can upload documents or images, and it gives you a limit of maximum 50 files, and each can be hundred megabyte or less each in size. So what we're going to do, you can either use this button or you can simply just drag and drop the files, and that's what I'm going to do. I'm going to drag and drop this file here, and now it's uploading, and the file is demo lengthy article. So now it's finished uploading, and now I'm going to use the same prompt as before. So I'm just simply going to say summarize this article in three bullet points include key statistics and solutions. And this is another way of basically summarizing the same content, just a different meat. So let's go ahead and run this and see what Deep C comes up with. Okay, DeepSeek has finished processing the file as you can see it was able to successfully analyze the files content and be able to follow our instructions from our prompt and summarize the research material in three bullet points, and you can see them being outlined here. Wanted to show you another way of accomplishing the same thing when it comes to getting DeepSeek to help you with analyzing files and content. You have just automated the TDS part of research. Now, spend your time analyzing insights, not hunting for them. All right, I would like you to go through the following exercise. Take any news article that you like, or you come across next, and I would like you to use DeepSeek to summarize this new article into three bullet points. Then I want you to make one refinement using a follow up prompt. 9. COT Prompting: Welcome to Advanced prompt Engineering. In this lecture, you learn how chain of thought or COT prompting forces Deep Seek to reason step by step unlocking higher accuracy for complex tasks like math, logic, and decision making. Let's dive in. Think of COT as asking Deep Seek to think aloud. Instead of guessing, it methodically solves problems, just like a student showing their work on a math test. COT isn't just for accuracy. It's a teaching tool. Whether you're learning calculus or troubleshooting code, seeing the steps builds your own skills. Use COT when answers require reasoning, not just recall. For simple tasks like write it toe, skip it. But for anything complex, COT is your ally. A good COT prompt is like a recipe. Precise instructions yield better results. Let's see this in action with a real world demo. In this demo, we're going to go through a real life example of solving a logic puzzle with COT. And the objective is to use COT to solve a multi step logic puzzle and analyze the reasoning. So let's go through the problem. The puzzle is Alice has three apples. Bob gives her five more. She uses four to bake a pie. How many apples does Alice have left? Now, if you work through this, you'll see that the answer is four. But if you just give this to Deep Seek, it might not give you any steps. It may not explain things and it may just simply spit out four. And that's without COT. So you want to make sure it actually provides explanation because again, you want to learn from COT, which is an advanced prompt engineering technique. So what we want to do is get it to outline all the steps so that we can work through it and make sure we can analyze it and make sure that the results are correct. And also, if deepsk makes a mistake, which it might, you'll be able to catch that. So in order for us to try solving this with COT, we're going to need to do a prompt like this. So it says, solve step by step, Colin. So this is very important, and then the problem. So Alice has three apples, and then Dot, Bob gives her five more, and then Dot, she uses four for a pie. How many are left. So this is how you can engage in using COT prompting. So let's go ahead and run this prompt and see what Deep C comes up with. Okay, so deepsk is able to break it down into steps by steps so it understands the problem statement, and now it's giving you step by step solutions. So initial number of apples, she had three. Then apples given by Bob is five. So it's saying that total Apples after receiving from Bob is now it's adding and it's explaining exactly each step. So total apples equals Alice's apples plus the one that Bob gave her, which is three plus five equals eight. Then apples used for Pie. That's four. So apples left after making the pie, total apples minus used for Pie, which is eight minus four equals four, and then the final answer is four. Instead of just giving the final answer four, it's actually explaining things step by step. Okay, now let's take a quick look at how to use advanced COT for debugging. So let's say we have a problem, and we're going to include that in our prom to get help from DeepC that says, a student solve this as three plus five equals nine, and then nine minus four equals five. Find the error. Okay? So let's go ahead and run this prompt and see what Deep C comes up with. Okay, so you can see that it was able to detect a problem, and it's saying that three plus five equals nine is not actually correct. So three plus five equals eight. And this is, again, we're referring to the previous example, right? We're referring to that question. Imagine that was a question and some students solved it like this, but now we're trying to get Deep Seek to correct or find a mistake for us. So it says three plus five is actually eight because Alice has three apples and receives five more, so she now has eight. And then the first part was incorrect. Then it says eight minus four equals four, so she uses four to bake a pie, leaving her with four apples. And then it also has a section for identifying the errors. It says the students first step is incorrect. Three plus five does not equal nine. The correct sum is eight. So because of this initial mistake, the rest of the solution is also incorrect. This makes perfect sense, and you're able to run that answer by deep seek and have it identify the issues within the answer that was provided for this puzzle. Why does this matter? It's because COT identifies where mistakes happen, not just the final answer. Now, couple of troubleshooting steps. So let's say you run into a problem where deep seek skips steps. What you can do is you can explicitly ask for numbered steps. So for example, detail each step as step one, step two, et cetera. Another thing that you might notice is if you get overly where both explanations, you can just use a follow up prompt or add this to appendix, your existing prompt and say, keep explanations concise, which is going to give you a more brief answer. You have just upgraded from a calculator to a tutor. With COT, Deep Seek doesn't just answer, it teaches. It's time for a quick experiment. I want you to go through the following exercise and ask Deep Seek to solve. If five machines make five widgets in 5 minutes, how long for 100 machines? Use COT and note down the steps and reflect on the results. 10. Few Shot Learning: In this lecture, you'll learn how to train DeepSeek using examples, turning it into a personalized study assistant that formats answers exactly how you need. No coding is required. Few shot learning is like giving DeepSeek a template. Show it how you want answers structured and it will follow your lead. Perfect for study guides or reports. Humans learn by example. So does AI. With just a few samples, DeepSeek mimics your style, saving you hours of tweaking and reformatting. We'll turn a dense history chapter into bite size study tools. Watch closely. You'll use this for exams, presentations or onboarding documentation. In this demo, we will be creating a study assistant, and the objective here is to train DeepSeek to generate flashcards in your preferred format using three examples. And all you need really for this demo is just the browser and Internet connection, your DeepSeek account, and the DeepSeek web interface. And just some simple content that you can put together yourself very, very quickly. Now the first step for this is we want you to define your format. So spend some time and understand what kind of structure and format you're looking for and what you want your output or results to look like when it comes to the flashcards or creating the final results, which are the set of flashcards. So for example, here's one format. So what I'm going to do here now, this is not a prom at this point. I'm just copy pasting this so you can see this on the screen here. So here's a format. I got a question and then I got an answer. So Q and then an A. Then again, I got another example. I got a question, and I got an answer, and then I got question, and then I got an answer. So this is really what I'm doing here is I'm defining my format and how I want to train DeepSeek. So when I'm asking a question or asking it to do a task for me, it's able to learn from this example and tailor the results to my format that I desire. So that's the first step. You want to define your format by providing by putting together some examples and the structure that you want the results to be in. Next, you want to prompt DeepSeek with these examples. So here, our objective is to create flash cards. So we need a prompt to instruct DeepSeek to do that. Then we actually need the content, which is the text, and then we need examples, which is what we just went through. So here's one example here, and this is what I'm going to do here. I'm going to copy paste the following prompt here, and of course, you can replace this with anything. So the first word is the prompt. Create flashcards from the text below using the same format as the examples. Okay? So here we're saying this is a text. Of course, you can replace this with anything you want. And here's the examples. And now you can put in your examples from step one, which is how we define the format. So I'll just copy paste what I initially had here. So let's go ahead and replace this with the examples that we had. Okay? So again, three parts here, the prompt, the actual content that you want to create flashcards from, and then the examples, which is defining your format in terms of what you want the output to look like. So let's go ahead and run this prompt and see what DPC comes up with. Yeah, there you go. And that's exactly what DeepSeek came up with, which is what we expected, which is great. So three flashcards following our formatting and structure that we trained it with via the examples above. So here's the question. There's three in total. So we got the Q. We got the A. We got the Q, and we got the A, and we got the Q, and we got the A. So this is actually perfect. And, of course, you can do follow up, um modifications to refine this further if you like, depending on the outcome you're looking for. And this works because DeepSeek replicates the Q&A structure and concise style from the example. Now, let's go ahead and use a follow up prompt to refine for complexity. So let's say we're happy with the result, but now we want to add a new section, which is called why it matters to what we already have. So again, because deeps keeps track of the context throughout the same chat, it knows already it has the context. So we need to restart again unless you're restarting a new chat. So if we're continuing the chat in the same chat, then you should be good. So what I'm going to do is in order to accomplish this, I'm going to use the following prompt. So we already have our three flashcards. Now I'm going to say with a follow up prompt to refine this is I'm going to say in my prompt, add why it matters in quotes, section to each flashcard, follow this format. Again, I'm providing examples. So the Q, the A, and then why it matters, and then covering the impact. And again, I'm providing an example to help it learn and train the AI. So what was the allied invasion of Normandy and then why it matters, and then here's the actual content there. So let's go ahead and run this and see what DeepC comes up with. There you go. And now it's started to create the flashcards again. And as you can see, it did add Y Matters, highlighting the actual impact for their particular content. So again, we got three, as we requested. We got the Q, we got the A, and we got the Y matters section. Same thing for the second one and the same thing for the third one. So this is great. And the one takeaway from this is that fusa learning scales with complexity, and you can add layers like dates and significance as needed. Now, before we wrap this up, a couple of troubleshooting tips in case you run into them outside of this course while you're trying things or when you're using DeepSeek. One of them is, let's say, if the flash coords include extra details that you didn't ask for, what you can do is use a follow up prompt to say, keep answers under 15 words to your prompt, and this should help with that in case it's just not if you want to keep it concise and brief. Another problem is if you still notice even after providing example, if you're still noticing formatting inconsistencies, then provide another example to reinforce the structure and better train the AI model. You've just automated personalized learning. Whether you're a student or trainer, DeepSeek adapts to your needs, not the other way around. It's time to go through a quick exercise. I would like you to create three examples for science quiz questions and generate five more using DeepSeek. 11. Sales: In this lecture, you'll turn Deep Seek into a sales coach that simulates tough customer conversations, perfect for rehearsing pitches, handling objections, and refining your persuasion skills. Role playing isn't just for actors. With Deep Seek, you can rehearse sales calls, perfect your elevator pitch or even mimic a skeptical buyer all in your browser. Deep Seek can mimic any persona, a hesitant CFO, a technical buyer, or a budget conscious startup founder. Let's tackle a classic objection. Your price is too high. Well role play and negotiation where the buyer resists pricing. Watch how Deepsk adapts to your responses and learn to turn no into a yes. In this next demo, we will be role playing a price negotiation, and the goal here is to use Deepsk to simulate a buyer questioning your pricing and refine your rebutals. And the only tool you need for this demo, and if you'd like to follow along is the Deepsk web interface. Now, let's set up the role play first. So what we would like to do is get Deepsk to act as a skeptical buyer, and we can use the following initial prompt. So this is what I'm going to put in which says, act as a skeptical buyer for a SAS product. Challenge my pricing with objections. After each of my responses, and this is really important, rate my answer on a scale of one to ten and suggest improvement. So if you're trying to learn and perfect your pitch and practice and get better or perfect at your pitch practice, this is really the way to go and you can use Deeps to help you with that, and this is going to put you ahead of everyone else. So let's go ahead and run this initial prompt and continue from there. Alright, there you go. So here, DeepC generated the first objection. So it says, You pricing is too high compared to competitors. And then it says, after you reply, I'll rate your answer. So it's exactly what we asked for 1-10, and then it's going to suggest improvements. And it already is giving you some examples of what a weak response would be, right? Well, our product is premium and so on. Here's an example of a strong response. I understand pricing is a key factor, while we may not be the cheapest, we offer, X, Y, and Z. So and then it's going to reply. So but let's look at the initial thing. This is just some recommendations that Deepsk provided to us as extra point of reference that we can refer to in terms of what's good and what's not good. But over here, let's go back to the initial objection. So the objection, right now, we're role playing, and Deepsk is acting as a skeptical buyer, and imagine you're in a face to face conversation or on a telephone or email, and the first objection is your pricing is too high compared to other competitors. Okay, now we're going to respond. And again, the response really depends on the context or your use case, right, depending on again, in the sale scenario, depending on what you're trying to sell and depending what the objection is, in this case, we're going to just for the purposes of this demo, we're going to follow up with the following reply. So again, the objection of the customer was your pricing is too high, and let's say we're going to put in the following response to that objection. So we're going to say our tool includes 247 support. So 24 hours a day, seven days a week support and advanced analytics, which competitor lacks, right? So this is a response, or let's say this is how currently before practicing with Deepik this is what your response would have been to that buyer. So let's go ahead, run this and now see how Deepsek is going to analyze this reply and give us some feedback. Okay. So you can see it says Deepsik is actually rating this as seven out of ten, so not bad. It's a good start, and it kind of is breaking it down into different sections. So it's highlighting the strengths, which is it highlights the key differentiators, right, compared to other competitors directly compared to the competitors, so that's good. Here's some improvements we could actually here's some improvements that we can actually make, right? So it says, quantify the value. So we didn't really touch on value. We touched on what the tool has or what the support looks like and the analytics and features, but not what the value is, what type of impact this would have for the customer if we were to buy the software, right? So quantifying the value is important. So now you can rephrase this and it's providing you it's doing the work for you. It's telling you this is what you could use instead in terms framing your response for the buyer to convince them. So 247 support reduces downtime by X. So now you're focusing on value, right? What does it provide in terms of value, and it reduces downtime by X percent. And that's really important because if your software is down, you could be losing many, many, a lot, like thousands or hundreds of thousands or millions of dollars in revenue during that downtime period. And our analytics save Team Y hours per month. So again, it's talking about productivity and value and the social proof, it says many of our customers switch from X to Y because of this. So now, you're talking about, again, the value and testimonials, right? Here's what other people who bought our product, these are the reason for it, right? These are the specific benefits that they're getting when they actually switched from any other competitors. And then ask a question, right? How critical are these features for your team? So now you're engaging the buyer. You're not just giving them responses. You're kind of, like, passing the ball, and now the ball is on their court so that you get them thinking, right? You get them thinking about whether how this software, based on what we just mentioned, how important is reducing downtime for them. And then the analytics and saving their team time, how important is it? How much do in terms of dollar cost, how is that going to affect them, right? And then at the end, here's a full example that is rephrased better and it's better framing after all the improvements that's suggested by Deepstek. So here's a stronger example. It says, I understand cost is a concern. While competitor X may be cheaper, our 24 slash seven support reduces downtime by 30%, saving teams an average of 10 hours per month. So it may end up long term. It may actually be less expensive if you're spending a lot of time on support, right, and paying tech support people, for instance, to handle long calls, right? Dealing with multiple issues. Plus, our advanced analytics help companies like customer Y improve RI by 25%. Would a demo help show the impact for your workflows? So again, much better, good start at the beginning, but much better, sort of like a response and a stronger response which captures value and helps quantify impact. Now, this is great because this works because Deepsk provides actionable critics, not just generic advice. And you can see here that Deepsik has moved on to the next one. So the next objection, and it's just going to continue until you feel like you have enough practice with Deep Sik and you're ready for your pitch. So here, again, next objection, I can get similar features for free with competitor, blah, blah, and then so on. Couple of tips here. If you feel like or if you notice that Deep Seek is breaking character, what you can do is have a prompt that says stay in a role as a skeptical, a buyer. You can add that to your prompt, if you feel like it is breaking character. Another thing is if the feedback you're getting is too vague, in this case, it wasn't? But if you did get a feedback that was vague and wasn't very helpful to you, what you can do is ask for specific examples of better phrasing and phrasing and framing the actual feedback. So these are a couple of troubleshooting tips in case you actually run into them. You have just unlocked a risk free way to master salesmanship. Now you can walk into meetings with unshakable confidence. Now, for this practical exercise, I would like you to roleplay using Deep Seek handling the following objection. I need to consult my team. 12. Complex Problems: In this lecture, you'll see how DeepSeek breaks down intricate math and logic problems into clear manageable steps, transforming confusion into clarity, perfect for students, analysts and puzzle lovers. Multi step problems test how you think, not just what you know. DeepSeek acts as your logic partner, guiding you through each layer of complexity. DeepSeek doesn't just give answers, I teaches problem solving frameworks you can apply to any challenge from math on work to business decisions. This classic puzzle trips up 90% of people. Watch DeepSeek reveal the counterintuitive solution and learn a strategy for a multi step problem. All right, let's walk through a demo where we solve the frog puzzle using DeepSeek. And the objective here is to use DeepSeek to solve this frog problem and explain each step. And the only thing you need is the DeepSeek web interface. Now, let's start with step one, which is the actual problem. And what I'm going to do is outline that using the following prompt. So it says, solve this step solve this step by step. So this is important because in the output, we require each step to be fully outlined by DeepSeek. And this is a classic one. So a frog climbs three feet up, a ten foot wall each day, but slides back two feet each night. How many days does it take to skate? Now, take a moment and try to solve this problem on your own first. If you haven't heard of this classic problem or puzzle, note down your answer and now use DeepSeek to give you the answer and outline step by step. So let's go ahead and run this prompt and see what answer DeepSeek comes up with. Okay, so DeepSeek has started coming up with the answer, and now it's breaking it down step by step here. So let's wait for a few seconds so that it can finish. Okay, so let's review the results from DeepSeek, and you can see it's provided a lot of steps, which is good because this is a logic problem, so it's always good to have as much detailed information as you can for reference and for learning purposes. So we won't go through everything, but you can see that the DeepSeek has already broken down things into each section. It's walking you through its logic and thought process, which is really important for learning purposes and how you want to tackle problems on your own. So again, it's doing some understanding the problems. So starting with this with the calculations here and the assumptions it's made. And then it walks you through day by day here. So day one day two all the way to day eight. Um, again, it's going through the verification of calculations of validations, common misconceptions, and at the end here we'll just again, scroll down here to the final answer, which is eight days. Now, this is a classic problem because most people think because the frog goes up, the way they think about this is the frog goes up three feet, slides back, two feet, that's a net of 1 ft a day. Ten feet, well, it's, you know, takes ten days, right, by just thinking through the problem really quickly. Now, the thing is on day seven, the frog reaches nine feet, and then it slides back three feet, and that's actually, excuse me. On day seven, let me correct what I was saying. On day seven, it starts at six feet and it climbs to nine feet and it slides back too, which is at seven, okay? That's on day seven. On day eight, the frog is starting at seven feet. So when it climbs three feet during the day, it reaches ten feet, which is now the frog is at the top of the well, and now it can actually escape. So as soon as it escapes at the top, there is no slipping back for that night. So the frog scapes on day eight. So this is how DeepSeek can help you solve logical problems and avoid a lot of sort of common mistakes and go through DeepSeek is able to, um, correct your assumption in case you have incorrect assumptions and also provide detailed explanation as to why the answer is what it is. Now, what we want to do is let's use this to our advantage and generalize a strategy like this that DeepSeek has provided for us for other logical problems, right? So what I'm going to do now again, remember, we're in the same chat. DeepSeek has logic in terms of what the context is. So let's do a follow up prom to help us come up with a use DeepSeek to come up with a generalized strategy. So what I'm going to ask it is teach me a universal approach for similar problems. So I'm going to keep this in my notes for future problems similar to this, that I can just jump into my notes and use this for the future. So let's go ahead and run this. See what it comes up with. And really, we're looking for a framework, right? We're looking for DeepSeek to give us a framework and step by step instructions in terms of what we can actually what we can do, right? So again, here it's walking us through the step by step. And wait for to finish. Okay, now, it took a while, but DeepSeek finished providing the answer. So let's scroll to the top here. And yeah, you can see the important thing is here these broken down sections, right? This is a universal approach to really any of these similar type of climbing or sliding. Problems could be like step forward them back, anything anything really close to that, right? So identify key variables, calculate net progress per full day, determine the critical points. So when the escape actually happens or when the challenge is solved. Formula for total days is providing you some formulas here and describing what the variables actually mean. And then it's saying that now use this formula to apply to the frog problem to see if you can actually get the answer there. And then there's some edge cases. So again, providing some guidance on some edge cases for you to consider. And then here's a general formula for all cases. And then it's even going one step further to give you sort of another example for you to practice with another problems, saying, Okay, given all your learnings up to this point, apply that learning and logic problem solving skills, and the formula that you just provided to the following problem and see if you come up with the answer. In this case, nine days for this snail climbing example. So this is great when it comes to solving logical problems. And again, just a couple of troubleshooting tips for you in case you do run into these things, not saying you will, but in case you did, some tips that you can keep handy. And let's say if you notice that if there's a problem where DeepSeek skips a step, you can simply have a follow up prompt that says number each step and explan sorry. Add what you can do is add a prompt that says number each step and explain transitions. That way, it's forced to think and output its thought process. So there's a less likely chance of it skipping steps. And if it did, it would be easy for you to catch because you would say, Oh, you skip step number four. Here's another problem that you could potentially run into, which is answer actually conflicts with the formula. And in this case, you can ask through a follow up prom that something like resolve the discrepancy between the formula and the example. You have just learned to dissect complexity like a professional. Apply this to everything from pseudoco to financial planning. DeepSeek your logic coach. Now it's time for you to experiment by going through the following practical example. I want you to solve this problem using DeepSeek. A snail climbs four feet a day up a 15 foot pole but slides 1 ft every night. How many days to reach the top? 13. DeepSeek API: Welcome to the world of API integration. In this lecture, you'll learn how to authenticate with Deepsek API and run your first script. Even if you're new to coding, let's turn ideas into applications. The API lets you embed Deepsek directly into your apps. Imagine analyzing customer feedback in real time or automating report generation. This is how it starts. Don't worry. We'll walk through each step. If you never quote it before, this demo is perfect. Is your perfect starting point. Think of your API key like a house key. You'll add it to every request, so Deep Seek knows you're allowed in. Never share it with anyone or share it publicly. Well, tackle these steps in the demo. Follow along. You'll have a working script in minutes. Alright, before we get started, I just wanted to mention that for this demo, you don't really need any coding experience, and you can follow along just fine, as we'll be going through things step by step. But if you're uncomfortable with coding or if you just don't need, you don't have a need for API with Deepsk or integration of Deepsks API into other programs or applications, and the web interface is good enough for you. Feel free to skip this. But if you're interested in terms of how the world of API works and how you can connect different platforms and applications to leverage deepsk API, feel free to follow along. Now, we have covered one initial integration of deepsk API in the earlier lectures. So all the dependencies are still the same. You need Python, you need Visual Studio code, so we've covered the installation of those earlier on. We won't go through that for every demo. And we made our first call using the open outer platform, which provides free usage on some of the Deep Seek models like the R one and the V three. Now, again, all of that has been captured already in the earlier lecture. So if you haven't seen it, feel free to go back and take a look. And in order to make an API call, again, I wanted to bring your attention to the Deep Seek platform. You can launch this documentation here by simply going to Deep Seek, and then on the left hand side, there is a doc folder, and then this will basically take you to this page. Now, over here, I have there's a quick guide. So the first API call, what you want to do is click on Python here, and over here, it kind of walks you through the enabling or installing my apologies, installing the Open AAI SDK and then using that to make your first API call to Deep Seek. Now, again, in the earlier lecture, we used the open Router platform, and we covered that. Now in this lecture or in this demo, I would like you to show you the actual integration with the actual deepsk API, because in order to get access to DeeskAPI directly, you do require it is a paid tier. There's no free tier, but it's actually very, very cheap. So I'll show you what I've done is I'm going to, if you go back to the platform, and if you look at my dashboard, I've only loaded $2 worth of money in here, which is not much, and it's perfect for learning. And for learning purposes, $2 is really nothing, and feel free to, you know, spend $1 or two or $5 just for learning purposes and getting your hands dirty in terms of using the Deep Seek API and having a direct access so that you don't have to go through other platforms like open Router or others. And the way you do this is you going into top up, put in you can pay with different methods, and then you can set your presets or just do a custom one. You can do $2, $5, $10. These are the preset ones, or you can just simply click on Custom. I've just done $2 for the purposes of this course and walking you through the actual application. Now, back to this, this is one way to actually doing your first API integration. This is the code that leverages DeepCk API, but also the OpenAI SDK. What I want to do is show you a different approach, which is simply using a Python request library, which is perfect for making API calls. So first thing we want to do is I've created a folder here, and what we want to do is we want to open Visual Studio code here, so I'm just going to simply open terminal in this folder, and then I'm going to type in code space and then dot. This opens Visual Studio code in the current directory. Alright, first things first, I'm just going to dismiss this welcome screen over here, and I'm going to create a new file here by going to File, New file. And because I have the Python extension installing Visual Studio code, it already gives me this option, which is nice and convenient, I'm going to select this. And I'm going to paste in the following code, which we'll go through in a second. But one thing I wanted to bring your attention to is this API key over here. So this is specific to me and my account, of course, and this is fine because I'm sharing it with you for learning purposes. It's not going to exist after this recording because API keys are just for you and your applications, you should never share them with anybody. So they're kind of secret to authenticate, but they also monitor your usage of the API as well. And just in case you haven't seen the earlier lecture, it's really easy to actually set that up, and you can simply go over here into the deepsk platform, and you can click on API keys. And by the way, the way you get over here is if you go to the Deepsk initial like the main website, deepsek.com, you can just on the top right hand corner, there's a button called API. You click that and I'll bring you over here. And then over here, you can edit or really edit the name because once you create the API key, you only can see at once, and that's it. And then you can delete, edit the name, and then you can revoke it, which is the same as delete, and then you can create new keys, which I have already done for the purposes of this exercise, and I've pasted my API key over here. Now, moving on over here, you can see, let's quickly go through this. So import requests, this is importing a library in Python called request, and this library helps us make API calls. It's just that simple. Over here is our API key. Here's the request URL, which we need as a baseline. And then over here we have some headers. So we're using our API key as a barrier token. We are sending this as a JSON. Here's the payload. So this is where we can define what models we can use. So over here, we're using the Deepsk hat, which is the free model available from Deep Seek. Prompt is going to be, again, a very simple prompt because this is a simple test application, just like Hello World type thing. So write a short story about a futuristic city. Now, temperature, this is an interesting one. So you can set this, and I wanted to, again, refer back to the documentation and if you go back to this page here, this was your first API call, and then there's model and pricing. But the third one from the top here is called temperature parameter, and it tells you exactly what it is. So the default value is one, and it's we recommend users to set the temperature according to their use case listed below. And it's using it's telling you exactly which ones for which. So it says if you're doing anything coding or math, then set the temperature to zero, data cleaning, data analysis, set it to one, general conversation 1.3, translation 1.3, creative writing and poetry, 1.5. Now, you can argue this could be a general conversation or it's creative writing because, again, we're trying to write a story about a future six City. Let's just pretend this is a general conversation, and then we can change that to 1.3. You don't have to. You can really play around with this and set it to whatever you like. But in this case, let's do 1.3. And then tokens over here, this is also an interesting concept over here because tokens are sort of like the usage and the limit that it is applied when you're making calls to the API. So tokens are segments of texts that AI models actually use to process language. So for example, a token can be a word. In this case, futuristic is a word, so this will use one token. It could be a part of a Word. So for example, if you have the word unbelievable, this one will use two tokens because there's the and then there's the believable. And then also like a punctuation mark or space. These counted separately. These all each counted separately. Now, Max token, how does that affect your story? So basically, what it is. You can think of it as each token as a word, in this case. So Max token says do not exceed 100 words. Now, it's not exactly a one to one mapping. As I mentioned, some board like unbelievable use actually too, but this is a rough sort of like guidelines. So if you want a longer story, you would adjust your Max token to say 500. If you want a shorter story, you can set your token to 50. In this case, for the purposes of this example, we are setting our token to 100. Again, just an example. Then here actually this is where we want this is the response that we get back from the API call, so we're signing it to a variable called response, and this is where we make the post call. If you're familiar with APIs, a post call is when you make a call and get a response back from a point. So here we have our API request URL. We have our payload, and then we have our headers. And then this is just some IL statement to handle any errors. So we get the call if the post call goes successful to the deepsk API, it's simply going to print out the response. And if there's an error, it's going to print out the error code and the associated error text that's within the body of that error object. Alright. Now, let's go ahead and save this file, and I'm going to save this again, anything you want here for name. So I'm going to do DeepskUnderscore test dot py, File Extension for Python. Go ahead and save this. There's a couple of things we need to do before we run this. So we got to install some dependencies. So this library request, let's install that. And let's go ahead and click on New terminal, and the command for creating or installing this dependency is PIP. Install requests. Go ahead and run that. Over here, you get this message. Do you want to create basically an environment that's just local to these things? I'm going to say, this is always recommended, and I'm going to use the baseline for the global setting to create that environment, and over here, you'll see that it is creating an environment just for this project. So the changes are local and it doesn't mess around with anything else. All right, the environment is created successfully, and we've installed the request library. By the way, in case you want to use a library for asynchronous request, you could use the HTTPX. So you could simply do that by calling PIP, install HTTPX. In this case, you're not going to do it because we're just going to use the request library. So let's go ahead and back space out of that. And yeah, we're pretty much ready. So we have our API key. Our account is topped up, and we have some balance there that we can use to make calls to Deep Seeks API. So really the next step is just simply running the program. Before I do that, though, I'm just going to do CLS because that clears the screen so we can see better and let's go ahead and run that. So Python, again, you can type the first few letters and then hit space or sorry, tab to complete it. And then we're going to go again space and then start to type in a few letters of the file name, and then I'm just going to tab and then that's going to Auto Complete. And if there's multiple files, you just keep hitting Tab on your keyboard, and it will find it, and then you can press Enter. So let's go ahead and run that and see what it comes up with. Okay, awesome. So it took a few seconds, but you can see that now we got the response back from the API call, and there's some parameters here. You could format this a little bit nicer, but I'm just not going to do that. You can copy paces in editors or something that you can view a JSON because usually the API calls, the response is in the form of a JSON, so you can format it and color code it in some other editors, which is completely fine. You can even do that in code if you wanted to. Over here it's readable enough. So we got the ID back. We got the choice, which is the text. So this is important. This is actually the output of Deepsek. So imagine you went in the web interface and you typed this prompt here, write a short story about futuristic city. And this is what Deepsek would have given you. So it's given you the city is powered by mysterious energy sources and so on. So you can read through this. And again, we've given it the token, we said, Don't exceed 100 token. So if you look at over here, it says completion token, 100, so it did use 100 tokens for that particular one. And then there was the 11 tokens for the prompt. So basically, the total number of tokens used here is 111. But for the story itself, it didn't go over 100. And yeah, there's no errors here or anything. So otherwise, you would have seen a different response here. You would have seen this print statement here with here. So everything has gone fine. You've connected using your API key to the Deep seek interface, and you've done you just completed your first interaction through a Python library, which is called requests. One last thing I wanted to mention is regarding the pricing, the deepsks API pricing is based on the number of tokens processed, typically, they're very cheap. So that's why I only put $2 in this account for the purposes of this demo and future demos because some of the input tokens, it's $0.07 per million tokens. So that's a lot of usage, right? And of course, it's not a set fixed, and sometimes DPC offers off peak discounts between several hours throughout the day, where the prices could be somewhere 50-70% lower. So if you use them during those times, you probably get a cheaper price. So again, but the point here I'm trying to outline is $2 that we put in here in this account is going to get us very, very far, and you don't really need to put anything more than $1 or two just for learning and practice purposes. And I highly recommend you do that because you're directly interacting with Deepseeks API, you're not going through other third party platforms. Not to say there's anything wrong with that, but if you want to learn advanced topics on Deepseek and interact with the API directly, this is a really good way of doing that. You've just unlocked programmatic access to Deepseek. In this next lecture, we'll build a chat bot, and this lesson will be your foundation. Now it's time for a practical exercise. So for this experiment, I want you to modify the script to ask Deep Seek for a joke. 14. DeepSeek Twitter Bot: In this next demo, you'll build a Twitter bot that generates trending topic summaries and auto posts them using Deep Seeks API and a few lines of Python. No prior bot building experience is required. Imagine waking up to scheduled posts analyzing overnight trends. With Deep Seek, your butt works while you sleep. We'll use Twitter's API to post and Deep seeks to generate content. Don't worry. I'll walk you through every setup step. Let's break this down. First, we'll get access keys and anything required to authorize and authenticate to gain access to the API, and then we'll write some code and get the Python script ready. Are you ready to automate? Let's dive right into it. Alright, in this time over, we're going to build a really cool application. And what that is is a bot that's going to use Deep Seeks API to generate a tweet or the content for a tweet on trending topics, and it's going to automatically post that tweet to your Twitter account or X account. Twitter X is now the new name and Twitter is the formal name. First of all, before we get started, a couple of things we need. So the first one is a Deep Sk account with some money already loaded, which we covered, and also a deepskAPIkey, which we covered how to get that in previous lectures. So we have all that set up. But the next thing you need is X developer account. So again, X is the new name for what was formerly known as Twitter. And we need to make a developer account on X so that we can have access to Xs APIs so that when we generate the content of our Tweet, we can use the APIs to post Tweet into our account through the API calls. Now, in order to attain that, it's actually very easy and they have a free tier. So what you want to do is you want to navigate to developer dot.com. And when you arrive here, you can see that they have multiple tiers here. Again, for the purposes of this demo, we're going to just be using the free one because it's more than enough in terms of what we need to get things done. So if you just scroll down here, you'll see they have different tiers, free basic Pro and Enterprise as the time of this recording. And if you click on Get Started on the free column here, then I'll take you to the next page, and then you can go ahead and follow the instructions to create a new free account. And again, really, all you need is your email address and a password. And then you will be taken to the page after registration to your main homepage. And again, I already have an account, so we're not going to go through this, but it's pretty easy and straightforward. When you start a process, if you do run into this screen over here, what you want to do is choosing between a basic and P. After you went through the steps, you want to come over here and click on signup for free account, and then you want to choose the basic, make sure it's on the Basic tab and then click on Sign Up for free account. And that should help create your free account on X. Now, when you go through the account creation process and you click Get started, this should take you to the main dashboard. And again, I already have an account. I'm already logged in, so you can see that it's loading my dashboard tier for me, and it's presenting the different tiers of plan. So we got Pro, we got Basic, and we got free. So I'm just using free. It's got one environment for my apps. We have some access to XS V two API. Some of the premium APIs on version two, they do require paid subscription. But again, we don't need it, then we can work around it to get our butt up and running. Also, if you're really interested in the different types of plans and what their features are, you can just scroll down here and there's a features table, and you can see everything in a side by side comparison. So the pro versus basic versus free, it gives you all the APIs for V two and also all the requests and their limitations and restrictions. So for example, if you wanted to delete the to eat with a free plan, you can make 17 requests every 24 hours per user. And with pro limit is 50, so it's a lot higher, as you can see. So you can go through this and see what the options are and what the availabilities are for the APIs and understand the restrictions. Again, we're going to be sticking with the free limit and the free developer account plan for this demo. Alright, now that we have our developer account all set up, let's go ahead and start writing some code and create a project to start coding for our bot and get things started. So for this bot, we're going to keep things relatively simple. Our project's going to contain two files. One is going to be the main code for the bot itself, and the other file is going to be an environment file where we keep our tokens and secrets. So first, let's go ahead in your directory, any directory that you like, you can start Visual Studio code. You don't have to do it this way. You can start Visual Studio code and save your files to a desired directory. I like to do it this way because I already have my directories created, so I'm just going to start the command prompt here, type in code space period, and this will launch Visual Studio code in the current active directory. So I'm going to go ahead and exit out of this. And the first thing we want to do is create a dot Environment file. And let's go ahead to do that. So we're going to go New File. We're going to type in dot N and then createnwfle dot NV here. Let's go ahead and click that. And then it's going to open the save box here, and we're going to say dot ENV. Okay, that's the extension for the or environment file. So let's go ahead and create. And this is our dot ENV file or also known as Environment file, and this is where we typically keep our settings in terms of configuration or our secrets and tokens. So I'm going to pasta SN and don't worry about this right now. We'll walk through it. But essentially, we need three things in here. One is our Deep Sk API key. The other one is our X client ID and X client secret, and we'll come back to these things. I already have my values populated here and assigned to these variables, but don't worry. We'll talk about this a little bit later. So let's go ahead and save this. And now let's go ahead and create a new file, and this is going to be our main bot. So we're going to go ahead and click on File New File, we're going to select Python because we got the Python extension. And what I'm going to do is I'm going to follow or copy paste the following code for our bot, and I will include this and it'll be attached to the lecture. So don't worry, you can just follow along if you like. It's a little bit lengthy, but it's not that complicated. So again, we'll go through it. So I'm going to paste this in, and I'm going to save this file. And then here we're going to call this X Underscore Deep Seek underscore boot.py. That's the extension for Python file, and now we have the main code for our main application for our bot or Twitter bot. All right, before we dive into the code, there is a couple of things we need to set up on our X developer account so that we can gain access and be able to authenticate to the X APIs for posting tweets. Now, one disclaimer is that as we're going through these settings and the code, please note that these are the current configurations and the way things look. On the web interface as the time of this recording, things could change. Twitter can change their API. They can deprecate old APIs. They can create new APIs, new versions of the APIs and their settings and stuff on the UI. So but at the end of the day, it's really the concept remains the same. So you just have to tweak and search around a little bit to find access to these things. And if you ever have difficulties dealing with this, you can get help from AI. So for example, you can as deep Seek, you can ask HAGBT. You can ask Gemini or Cloud. So you can ask other AI tools for help if you're ever stuck with any of these settings or anything in the code. So now, this is how things look as of today. So what you can do is after you created your account successfully, you can just click what we discussed in the last lecture and that'll take you to the development page or you can simply go to developer.twitter.com, and that will take you to the development portal. Now you can see the interface is quite simple and it's nice, very user friendly. Over here, because we are in the free account, we have this one application and one project. It already gives us project app. And just one other thing I wanted to mention is, please don't share the things that we're covering here with other people like, you know, the access token, the client ID, things like that, the API keys, because these are all secret and you should be the only one who knows these things. So don't share these things with others. Now, in our case or in my case, I created this is a test account. I only created this account for the purposes of this course, and it's not going to exist. So this is something after the course. So again, it's okay for me to share this with you because this is for educational and learning purposes only. But when you're actually creating projects and applications, please know that these are sensitive information and do not share access keys and tokens and any other authentication means with anyone else. All right. So now let's dive in here. So here it shows us the monthly post cap usage. So right now, we're pretty good for now. Well, just jump into the important things here. There's a couple of things that you need to set up before we jump into the code. So over here, we got the project app. This is the ID. There's a couple of buttons here. So let's go ahead and first, click on app settings. So click on that. And over here, it'll take you over here, which will show you the app ID, the description, which I created. Again, just something temporary. And on the bottom here, we got the user authentication setting. This is where we need to go. And please note that on the top, we got two tabs here. We got settings, we got keys and tokens. We want to be on the settings. And if you want to change keys and tokens, then go ahead and click this. It will take you over here. We'll come back to this page. In a second, but for now, we'll start with settings first. So go ahead and click Settings. If it's not already selected, come down here to user authentication settings and then click on Edit. When you click on Edit, your default settings might be set to something different than what you see on the screen. So it could be just read, for example, right, or it could be read and write. By default, mind was just read. In order for us to be able to post tweets to our Twitter account, we want to make sure that this is set to read and write. So either this option or this option, which gives you full access. So read and write and direct message, and there's a description of what this all means. Okay? So this is what you can set it to. The type of app, you can select web application or automated app or bot. In our case, it is a bot, so it's perfect. Now, this one here, the app Info, this is the callback URL or the redirect RL. And I would like you to ask to pause the video for 1 second and actually type this in because this is really important. This is going to help us work around some of the limitations we have with the free API compared to the premium API. This way, we can get our project up and running for free. So I've already troubleshooted this many different times, and this is what actually works for the free account. So please pause the video, put this in the callback URI. And then for the bottom here, some of these things are required. But, for example, you can just put something temporary in here. So you can put in example htPs example.com. This one is optional. These are the required fields that I filled in. So organizational URL, again, don't have an organization at this point. This is just a test demo. So I just put in example.com and example.com. You need to fill these out. Otherwise, it will not let you save, so you will not see the save button being enabled unless you put these things. So this is the most important one, and then you also need to fill these in order for it to let you save because the ones you see here that are filled out are required fields. They're not optional. You have to fill them out. But these things aren't that important. The most important one is this one here. So once you've done that, go ahead and click Save. Once you click Save and we have these new setting saved up in the app Info section, you can scroll back up. You can click the Back button or just simply click on Developer portal. Again, go back here, free, get started, and this will take us back to where we were. Click on dashboard. And again, we're back to where we were. So again, if you click on the app settings, it's going to take us here. This is where we were. But now we've already saved the setting, so we don't need to do that again. It's already saved. So if I go edit, you can see that this is saved, this is saved and all my information is saved. So now this time I'm going to click back, and we're on this page now. The next thing you want to do is on the top here, remember we have two tabs, settings and keys and tokens. You want to click on Keys and tokens. And it's important to do this afterwards because first, you need to change the permissions to read and write and then create your secrets and the tokens that you need. Now here are some sections here. So consumer key. This is your API key and API key secret. This is authentication token. So this will do I will give you the Bar token for API calls, and then here's the access token and secret for the access tokens. And over here, they're already generated, and if you want, you can click on Revoke or regenerate, and it will generate them for you. If you're using these, please know that whenever you're regenerating, for the very first time, you can see the whole thing. So I would recommend copying and pasting that somewhere so that you don't forget because once you dismiss the dialogue box after creation, you will never be able to see it again. In any case, what we're going to be using is we're actually going to be using the OS two for authentication purposes of this spot. So what we need is the client ID and client secret. The client ID is not going to change. It's going to remain the same, and it's not that big of a secret. This is the important one. The client secret is really important. And this is if you hover over the the information icon, you'll see the tool tip that says, Think of your client secret as the password that allows you to use AT as authentication method. So we need to authenticate and let Twitter know that we want to access the API. We do have an account, so we are an existing user on the platform, and we want to access the API to generate or post a tweet to our account. So once you change the setting, go over here and then click on Regenerate and then this will give you this will give you a new client secret which you want to save. Okay? So you got your client ID. You want to make sure you save this. You click on Regenerate after changing your settings to ensure you have read and write access, you regenerate this and you save it, and then you have your DeepCKPI key from before. So now you have three values that you're saving, which will come back in the code. Okay, now that you have those three values, what I would like you to do is go into B in Visual Studio code and going into the dot file, and I would like you to paste in your values. So for me, this was my Deep Seek API key, and I do have some budget or I do have some balance there, so I can make calls to the Deep Seek API using this API key. And these two are from the X developer account that we just covered. So the client ID goes here, and this one doesn't change, and you put in the new regenerated client secret over here. Again, please don't share these especially this one and this one. Don't share that with anyone. These are secret and unique to your account. So you don't want to give other people access to these things. So I want you to go ahead and paste in these three values and don't forget to save this file after you put in the values. So you can go to Flesaf or Controls or Commands depending on whether you're using Mac or Windows. Alright. Now, let's dive into the code for our butt. And this is where everything comes together. It's a little bit lengthy, and we won't go through every single line here. Again, you can use AI to interpret some of these things and help teach you some of this if you're brand new to coding or you have no prior coding experience, but we'll go through some of these sections that are really important here. So this is where we importing the library, and these are needed in order for us to do certain things. So for example, request is a Python library that allows us to make API calls easily. We got schedule. This is another library that allows us to automate the scheduling of the job. In this case, let's say, if you wanted to automate posting it to it once every 2 hours, you could do that using this very easily because these have some of these classes have their own functions that you can just leverage without writing the code yourself. And then you got the Open AI. So Deep Seek is compatible with OpenAI SDK, and it's a really easy way to use that. So we're going to do that. And then dotn and load N, this is simply for us to be able to read off of a dot N file. So everything that we had here, we're going to be retrieving these values in our main code by using the dot NV library. And again, over here, you can see that we'll go through the first one here, so you can see Deep Seek API key. So right now, we have a variable, right, called Deep Seek API key, and we're trying to assign a value to this variable. And the way we do that is we get the value from the dot N file. So essentially, we're taking what we're doing is we're taking this value and reading it off that file and then assigning it to this. So this is s dot get N and then it's going to read that, right? This already knows that it should look for in the root directory. I should look for a dot N file and then open that file and then look for this key, right? So if you go back, this is a key attribute pair. So this is your key and this is your value. Sorry, um, key value pair. That's what I meant to say. So this is your key, this is your value. And then over here, we're taking that value and assigning it to this variable in our main file. Same thing here with X client ID and client secret. And this way, as you can see, this helps us not hard code the actual values in the main file, so it's not visible. And usually what happens in the pipeline, if you're actually running this in a CICD pipeline, those things would come from the environment variables in the pipeline and it won't be actually hard coded in a text file like we are. This is our local environment. So this is why it's currently set up that way. So this is our redirect URI. So this is where I asked you to change that in the settings of the X developer account. And this is important because it allows us to work around some of the limitations we have and authorize and authenticate to access the X developer API. And then here we are using the Open API SDK. We're loading our Deep Seek API key, and this is our base URL for Deep Seek that we will be making a call to. Here's some scopes here for read and write, and here just some authorization, URLs, and then this is the 02 that we can make a call to and get authorized. So we can skip some of this stuff. Again, this is a lot of this is around access token and authorization. Here we're making the call to get that. And then, okay, so over here, we have a function to get trending topics. Now, there's many different ways to do that. Actually, you can use X actually provides ways to get the trending topics, but some of those are paid and premium for premium users. So there's different ways of doing this. What you can do is you can just hardcode the topics that you're interested and you want to post about, which is what I've done here. This is the approach you see on the screen. You could also do something creative, like you can build a scraper using free libraries that scrapes Twitter and looks for trending topic. That's another one. But again, that's just more code that we want to avoid for the purposes of this tumbo. So I went with the most simple option, which is just hard coding some interesting and trending topics here as of right now. So just as you can see, you can see AI revolution, DC KI space, lounge, climate change, and things like that. And then, yeah, we actually go into a function that generates a tweet. Now, this is important because we are splitting it into two steps. One is, we want to generate the content of the Tweet. Then we want to take the content and make API call to X developer account to post the Tweet, the content of that tweet to our account. So over here, this is the function that generates the tweet. And here you can see this is the prompt, right? So imagine you're at This is where we leverage Deep Seek and Deep Seek API. So imagine you're on the web interface for Deep Seek, and you're just typing this prompt as a user and you get an answer back. This is essentially what we're doing. So create a short, catchy and fun to eat about this trending topic, and then the topic will come from any of these. It will be randomly selected from any of this when the program is running. So this is the prompt we're going to give Deep Seek through API, through an API call, and this is the model we're using. It's a free model, again, deepskhat. And then in here, you can see we're telling Deepseek how we wanted to act. So you are a creative social media manager who writes viral Tweets. And then us as a user, this is the prompt the content of the prompt that we're going to pass it. Okay? So this is going to make a call to the DepekKPI and it's going to give us the response, and then we're going to simply restore that into a variable called Tweet here. Yeah, so this is how we generate the content of the tweet by calling Deep Seeks API and passing in a prompt and then getting a response back. The next one, the next function here, the next section is we take that content from the previous step and we want to post it to our Tutor account through API. So here we have the Tweet content, right? And this is where we simply have the access. We've obtained access from previous functions. This is our URL that we want to post to. And here's our authentication with the access token, and this is the payload, so tweet content, which was what was generated from the previous one, and this is where we simply make the Postcall which is going to create that tweet in our developer account or our Twitter account, I should. And there's some error handling here. So if it's successful, it's going to post that in the console. So we'll see the actual tweet that was posted, and if it was an error, it'll throw the error message to us, and then we have to start troubleshooting. The next section here, this is simply where we want to run the job, and this is where we randomly select the topic. Again, just some printing to the console in terms of, like, this is what the topic is, this is what the tweet is going to be, and so on. And going down here, you can see that this is the main execution. So we have a simple main, and this is where we execute. And, again, this is simply where we can define some of the things like, you know, how often you want, because this is a bot, and it's going to automatically in an automated way, post Twitter according on, you know, some cadence, right? In this case, you can see how this is going to run is immediately it's going to when you run the Python program, it's going to run the program and make a tweet post. And after that, it's going to post again automatically according to some cadence. Now, right now, this is set to one post every hour, and there's a 60 seconds of delay just to make sure that we're not really hitting that rate limit and restrictions because the account, your account, if you spam through many API calls in a very short period of time, it's going to ban your account, so you want to avoid that. So you want to make sure you respect all the limits which was mentioned, I walked you through that and where you can find that in the documentation on the developer's portal account. And you can go through those, and you want to make sure you're respecting that so your account is in good standing, and it doesn't get banned. Now in here, what we're saying is it's going to run every hour. Of course, you can change this to whatever you like. You can do like five every second. But this is currently what this is set to. So what I'm going to do, again, for the purposes of this demo, I'm going to change this so I can show you that this is working correctly. When we run the program, it's going to immediately run this job, which is going to create the job function is going to create Tweet post, and then I'm going to do that again 5 seconds, and then we should see a second tweet post in our account after 5 seconds. This Wil true means this program will run forever because it's a bot and it's automatically going to post whatever it is on the topic every whatever cadence, X hours or X days or seconds, whatever we said here in the program until we stop it. So this is what WL true means. It will run forever until we stop it. So for the purposes here, I'm just going to change this to five and I'm going to change the hours to seconds, and then I'll just change this to 1 second for the wait. Let's go ahead and save this, and now we should be ready to run the program. Okay, so now we're pretty much ready to get started in terms of running your program. First thing we want to do is install some dependencies. So make sure you have saved everything here. And after all your changes. So what we want to do is we want to go to terminal, click on Create terminal, and we want to install some of the dependencies that we're going to be using here. So all of these things that you see on the top, we want to make sure that the ones that require the installation, we actually install them as dependencies. So I'm going to use the following command which says PIP install. Open AI, that's the SDK, requests. This is the library for making API calls easily through Python. Schedule is the one for automating simply having access to functions that can help us determine the cadence of how often and frequent we want to run the post. So over here, you can see this is where schedule is being used, and then python dot, Th helps us read off the dot values from the keys in the inside the dot N file. So let's go ahead and press Enter to run this. Now, over here, we're going to create an environment for this, just so that to keep things local, this is going to start creating an environment creating a VM in our main project directory. So let's give that a second. Okay, so all the dependencies seem to be installed correctly. And you can see here we've created this environment here, which is.ve and V to keep changes local, which is a great way to not mess around with anything global or any other global settings. Now, before we run the program, I just wanted to quickly show you something over here. So when you create your Twitter account, you have X, you have to create your Twitter account, and then you have to create your developer X account. So over here, I'm logged into both, but this is my Twitter account. So you can see here I'm on the main page. I'm going to reload here. You can see that I don't have any posts. So right now, again, this is a temporary account for the purposes of this course. This is not my Twitter account. So over here, you can see that we are on the post tab. So there's posts, replies, highlights, articles, and so on. We're on the post tab and you can see there's nothing posted here. So the way we're going to test that the program works correctly is make sure that we do get the right messages in the console as part of troubleshooting, but also we want to check our account and make sure the post is indeed created on our Twitter account. So this is how we're going to know that the program is functioning correctly. Last step remaining is now we just simply have to run our main program or the Python file. And that's really easy to do. So the way you can do that is in the terminal. You can type in Python and then click Tab to Autocomplete space, and then the name of the Python file. X, underscore and then tab and this will automatically pick up the full name of the Python file and then click on or press Enter. Okay, over here, now, this is the whole redirect thing for us to work around. So what you're going to see here is you're going to get this. You want to click Authorized app. In case you have pop up the pop up blocker, you want to make sure that you allow pop ups from this URL is very important because it wouldn't show you this it wouldn't show you the next step. Okay? You want to make sure that you keep an eye out for that in case it's not working and allow pop ups. Once you see this screen, you're going to click on authorized app and then it's going to give you this URL. This is why the code was a bit lengthy because we need this code. What you want to do is on the URL here on the top, you'll see something and then you'll see and the and character here, and then code equals. Anything that's after code equal is what you want to grab. So this is the code that we need for authentication. So go ahead and copy this. And then we want to go back into Visual Studio code, and then you can see here there's a message that says paste the authorization code here, and that's what we're going to do. So paste that in. You can simply do that by right clicking your mouse button and then click on Enter. Okay, so we do get some errors, invalid requests. Error description, value pads for authentication code was invalid. Cannot start but without access token. If you see that error, it doesn't necessarily mean the code is wrong. I've double checked the code. The code seems to be correct. Sometimes the issue is from their end. So what you can do is before really changing anything with the code or starting to troubleshoot, just maybe wait a few seconds or a minute or two and then try running the program again because, again, sometimes the issue is on there, and when we are trying to get an access token from the back end side of the development APIs. So first time I ran it, I ran into this issue. Second time I ran it, it worked fine. So what I've done here is I've cleared out and cleared the console of all the errors and logs so we can start fresh here. Again, I haven't changed anything with the code or the application that we have. I just simply going to run the program again. So let's go ahead and do that. So Python and then space, the name of the file, and let's go ahead and press Enter and run this. Now, again, it's going to ask us the same thing authorize app. So I'm going to click Authorized App. It's going to open a new tab. I'm going to take this code, and I'm going to copy it, go back into our terminal, and it says, paste the authorization code here. I'm going to paste it and click Enter. And you see, it says, access token obtained. So it went fine this time, and it says, trending topics selected chat GPT updates. Okay. And over here, it says Tweet posted. So this is the actual message that it posted to our Twitter account. As you can see, 5 seconds later, it picked a new topic. So 2000 for Olympics, I posted a new account, and then 5 seconds later, it's just continuing to do that virtual reality and it's now posted a new one. So at this point, I'm going to press Control C, just to break out of the operation because this is, again, a continuous loop, and it's going to run forever until we break out of it. And again, the frequency is a little bit too high, but I wanted to change it to a lower time frame so you can see this inaction and indeed that it works because normally you wouldn't want to post it to it every 5 seconds, maybe once a day or twice a day. But not every 5 seconds because, again, that could be seen as a spam by the Twitter Twitter Development account and support side, so they may ban your account or temporarily suspended, which is not something you want to happen. So now you see we've created three we see the Tweets, right? We don't know yet if they've been posted to Twitter yet because technically, they should in theory, but we are just seeing this in the console of our program. So the first one was on the HAPT updates. So again, remember, it made a call to Deep C to create a tweet on the latest HAPTUdates. And over here, it says, Tweet posted. So this is the content or the message in the Tweet. So CHAIPT just got an upgrade, and now it's basically smarter, funnier, and way more productive. And then after that 5 seconds later, it created one on the 2024 Olympics. Remember, if you go back here, these are our hard coded areas of interest or topics that we want randomly choose from. And then the last one was virtual reality. So it made the third post about VR. So if we go to our Twitter account, we should be seeing these posts. So let's go ahead and check that out. Okay, I'm going to open up this. Well, let's close out of this tab. Let's close out of this tab. And over here, again, this is our Twitter account. So what I'm going to do is I'm going to refresh the page. And there you go. You can see that indeed, we do have three posts. So this is from most recent to least recent. So you can see this is our tweet that it was first made 2 minutes ago. So Chat GPT just got an upgrade, and now it's basically smarter, funnier, and way more productive bestie. You can see it's quite nice because it really includes all aspects of a nice viral tweet, right? It includes content, so the actual text. It includes some Imogi. So in this day, CHAT GBT, there's a picture of a robot. And then it even includes some hashtags that are relevant to the topic, which could help them tweet go viral, potentially, right? And then here's some short catchy and ready to trend, one me to tweak it for a different vibe. Now, this is the part that we don't want in our Tweet. Okay? This is the part that we can go back and we can potentially change it, right? If we wanted to. Again, this is all it's easy change, easily changeable in the code. Over here, Paris 2024, where dreams become gold medals this is about the Olympics, and then the third tweet is about VR. So again, this is all about, you know, the post about virtual reality and things like that. So the important thing is now we are testing or verifying that the program is working fine and the tweets that were generated are using Deepsek API are, in fact, posted to our account using the X developer APIs. So I hope this was helpful, and I hope that you give this a try on your own time and try different things with this spot and potentially try other social media platforms as well. One last interesting thing to note here is that if you look at your Deep Seek account or in this case, my account, if you remember, I loaded this up or topped it up with $2 of balance. And now that we've started to make some API calls, you can see that there is some usage here. You can see on the graph here. And if you hover over this, you can see that there was a API 17 API requests made and if you over this part here, this tells you how many tokens we've used up to this point. 15. Speardsheet Automation: In this lecture, you'll learn how to connect Deep Seek to Google Sheets, automating tasks like sentiment analysis, data cleaning, and report generation. No more copy pasting. Imagine your spreadsheet updating itself with AI insights overnight. Let's make that happen. Don't worry. If this sounds complex, I'll guide you through every step. We'll start with Google Cloud, the gateway to your spreadsheet data. In this demo, we're going to work through a Sentiment Analysis automation guide, and we'll build a program together where we read customer feedback from a Google Sheet, and we get Deepseek to analyze the feedback and based on that, assign a sentiment, such as positive, negative, or neutral, and then we will use the Google's API to write back that sentiment that was retrieved from Deep Seek API to the Google Sheets. So the point here is everything is autonomous, fully automatic, and you don't need to do any manual work. Now, for prerequisites, you need pretty much everything we've covered up to this point. So a Deep Seek account and API key and some balance in there. You need a Google account or a Gmail account. You need a Google Cloud Console, and you need Python installed, and the latest version of Python preferably and Visual Studio code. And you can see here in order to actually test our application, what I've done is I've gone to Google Drive. I've created very simple spreadsheet or Google Sheet, and it really has two columns here. We got customer feedback, and we got another column, which is Column B sentiment. Now, sentiment right now is empty, and that's the point because we want to get Deep Seek to automatically generate the sentiment for us based on this feedback, and then we'll write it back into this sheet using the Google's Sheet API. You can see here I just made up some random data. So imagine you are going on Amazon to buy a product or really any other ecommerce and you want to buy a product and first, you want to review, you want to go through the reviews. And here I got about roughly ten reviews here. Again, this is just made up data. So, for example, I absolutely love this service. The product was broken when it arrived, amazing rains, we'll buy again, and so on. The point is we want to analyze all of these one by one and then determine what the sentiment associated with that feedback is and then write it back to the corresponding row of column B. Okay, so the first thing we want to do is we want to navigate to Google Cloud Console. And again, for this, you just need a Gmail account or a Google account. Now, first time you navigate to this address here, which is console clogogle.com, you may see a wizard taking you through a bunch of terms and conditions and things like that. So just go ahead and follow along the instructions, click Continue or next until you get past that point and your Google Cloud account is created. And then you should be presented by a screen such as this, which is the welcome screen. Next, what you want to do is you want to find the product called APIs and services here. So sometimes it may be already here depending on whether you've recently viewed it or not. Or you can simply just come up here on the search and type in APIs and services. So I'm going to type in APIs, and you can see here the first search result is the one we're looking for. So APIs and services. Go ahead and click that. And over here, you can see that right now the page is empty, and it says to view this page, select a project. Right now we don't have a project, so we're going to basically create one. So let's go ahead and click that. Over here, we have nothing. So let's go ahead and click New Project, and this is where we want to give it a name. And let's call this Sentiment Analysis, automation. And then for organization, you can just leave this blank and just press click on Create. When it finished creating the project, you're presented with a screen such as this. And the next thing you want to do while you're in API and services, you want to click on Library, and this is where we want to look for the Google Sheets API, and we want to enable that. So if you scroll down, again, you can search for it on the top here and type in Google Sheets, or you can simply scroll down and find the one you're looking for. We got APIs for Google Drive, calendar, GML, and so on. So all the Google products are available here for you to gain access through API. And there we go. We actually found Google Sheets API. So go ahead and click that. And when you click this, you can see that there's an option here that says Enable, so go ahead and click Enable, and this should enable the Google Sheets API for our project. Okay, there we go. Next, you want to come over here on the left hand navigation bar, and you want to click on credentials. And on the top here you'll see a button called Create credentials. So what you want to do is click that and then select OAT client ID. So go ahead and select that option. And now you want to click on Configure the Consent screen. So if you click that, it's going to take us here. It says Google OT platform configured yet. So go ahead and get started. And this is where you can put in some of the information here. So for appName, I'm just going to put sentiment Analysis, automation, support user support email. I'm just going to put my own email address. And again, I created this email for the purposes of this demo, so it's just a random Gmail email address. And then what you want to do is click Next, and it's going to take you to audience. This one says internal, external, so we want to make it available to any test user with a Google account. So let's select that. Create next. And we can cancel some of this information and skip, sorry, not cancel. Skip some of this information and just simply click on Create. Contact actually doesn't let us, so let's go ahead and finish this up. So I'm going to put in the same email address again here, next, and then I agree, continue, and now create. So we just put in a couple of information. They're pretty simple stuff. Alright, now that we have the OAT configuration created, what you can do is over here, this left Navbar has changed, as you can see to some other options because we're under the OT platform. And so there's nothing to see here. But if you going into branding, you can see that some of the stuff that we just put in for our application and projects. So the app name is Sentiment Analysis, automation. Here's a text support or user support email that people can contact if we wanted to, here's developer contact information. Again, this is just a test demo email like on I made for the purposes of this demo. And what we want to do is next we want to go ahead in the client, and we want to create a new client, and we want to make this desktop application because a web application is really if you look at the application type, you got the web application, you got the desktop application and some of the native ones for Android and IOS and so on. Web application is simply expecting servers, which is something we don't have. Desktop application simply is it knows that we're trying to run a script. It's telling Google we're trying to run a script locally on our machine. So go ahead and select Desktop App, and then over here, the name Desktop client one is fine. So go ahead and click Create. And over here, this is going to give you some, this is going to give you some information. These are the secret. So the client ID, client secret, these are needed for authentication. And what you want to do is you want to click on Download JSON. So when you click this, it's going to download the JSON file to your computer, which we will later use when we're putting our program together. So click Okay. We've created this one, and now everything is good. Again, you have your information over here. But really we need that file. The file is what's important, which we downloaded. And one last thing is, if you go to Audience, this is also really important because you need to have a test user so that we can actually authenticate and be able to test our application to make sure it's working correctly and be authorized to make those Google API calls. So what I'm going to do is under audience, I'm going to go under this section test users at a user. And here, all you have to do is simply just put in your email, which I'm going to put in my Gmail account and click on Safe. You can put multiple emails if you like. And over here, we created the OOF client, and we should be good to go. In fact, I'm just going to go into client here. Again. One thing I suggest is after creating the test user, if you go back to client, you can see that this is created, and over here, you got the download of client. So if you ever lose that JSON file, you can go ahead and click the sun and it will download it again for you. So very important in case you need it back, or if you need to get access to that JSON file again. Now, this is a very important step. So what I'm going to do is I'm going to move my the client secret file or the JSON file into the folder where I'm going to create my code and application. It's very important because we're going to name this credentials. It's a credentials dot JS on file, and it has to be in the same folder as your Python script. Otherwise, this is not going to work. So again, one thing you can do is because I have this already set up in the code, you can simply rename this to credentials, and over here you can see the type extension is JSON SourceFle. So this is going to include the information about the client and the client secret, which we'll use to authenticate. Next, let's go ahead and get started with our Python program. So what I'm going to do is open Visual Studio code here. And let's go ahead and create a new Python file. And I'm going to name this Sentiment Analysis dot Pi. So let's go ahead and save this. And what I'm going to do is copy the following code here, which again, I'll provide for you so that you can follow along and then we'll step through this throughout the different sections and blocks of the code and explain what they mean. Alright, a couple of things to start with. So if you scroll up all the way to the top here, this is going to be very important. The first one is the deep Seek API key. So we obtained this from previous lectures, and I showed you how to get that. And this is very important because you want to put that value over here for your Deep Seek API key. And over here, everything else is automatically populated, like the Google's API, the authentication for the spreadsheet endpoints and all that stuff. There's one other thing that you need, and that's the spreadsheet ID. So over here, this value, you can obtain this value by going back to your spreadsheet here. So if you go back here, the way you can find that ID is on the top here. So in the URL or the address bar, you see there's a slash D slash, and then at the end, there's a slash edit. So anything in between after the D slash, so starting after that slash and then ending before the slash before the edit, that is your spreadsheet ID. So we want to go ahead and select that. So it's going to be, again, this part here. So after the slash after the D, and then before the slash for the edit. So go ahead and copy that. And then if you go back to our IDE, you can see that this is where you would paste that value. Yours is going to be different than mine. And then here, the feedback range and the sentiment range, I've started the input range, basically the starting point from A two, and then for the sentiment from B two. So again, if you go back to the spreadsheet, you can see that this is column A, A one is actually the header. B one is the header, so I'm basically saying start reading from A two and onwards. That's our range. And then for sentiment, we're saying start writing the sentiment from B two and so forth. So that's what that is saying over here. Now, we won't go through this whole thing because it's a little bit it might be a little bit overwhelming. But again, it's nothing complicated. It's simple. If you're used to coding, if you have coding experience and knowledge, this is very simple. But basically, what this is doing is it's just using most of this is for authentication for Google APIs. And the important part here is this the credentials that JS on This is why it's important to make sure that file is inside the root directory of our project, which it is. And this is basically where it's going to read all the client idea and the client secrets for authentication purposes. Over here, this function is basically reading the feedback. So it's looking at column A, and here's a text that will be printed you'll see this later and then in the console, and then you can see that it's trying to use the ESDK and it's reading the spreadsheet, and then it's going through the ID and it's getting the values for column A, which is basically the feedback that was provided by the customers. Next function is taking that feedback and actually analyzing it. So you can see this function, we're passing it in text, and that text is going to be sort of like an array of all the feedback that we collected from the spreadsheet through Google APIs. So that's a read operation. And now we're taking that we're passing that to Deep Seek. So this is the Deep Seek model. We're using the free model, Deepsk hat. We're telling Deep Seek that the persona, so you are a sentiment analysis AI, return only positive, negative or neutral. And then this is what the prompt is going to be. So the prompt says, analyze the sentiment of this customer feedback, and then we pass in the text. And then we're just going to loop through that until we've gone through all the feedback. And then Deepseks going to analyze it, give us one of the following three values, positive, negative neutral, and then we have our results, and we can actually write that sentiment back in the Google Sheets on column B, which is basically this function here. So this is going to take in the service and the sentiments, and then it's going to use these SDK and the spreadsheets, SDK or classes as methods to actually update column B with the values. And this is again, our main program. This is just going to loop through the feedback and create the sentiments and call those functions and simply just write that and then we'll see some console logs as we run the program. Okay, so I think we are pretty much ready to run this. So make sure you save your file and all the changes. Make sure you've put in the Deep CKPI key value in here and the spreadsheet ID. And let's go ahead and launch a terminal. And, of course, before running the program, we need to install dependencies. So we're going to do that and click Create here to create an environment first. And I believe there was a new line character appended to the end, so it just automatically started running the command without me pressing inner. That's fine. I'll paste it in so that you can see it before we move on. Okay, so the environment is created, and now it's continuing on with installing all the dependencies. I'll pause the video and we'll come back when it's all done. Okay, so the installation of all the dependencies are done, and I just wanted to paste this installation command because there was a new line character appended at the end, and it just quickly started running without you getting a chance to see it. But it's simply PIP install, and then all the dependencies that we need for this go to run so Google Lot, Google Lott Library, Google Oth, HTP Lip two, API, Python client and Open AI. And, of course, I've also included it here in the comment above, so you can see it says, Install required libraries first, and then there's the command to do so. So I'm not going to run it because I already ran this, so I'm going to cancel out of this, and we should be ready to run our program now. All right, so we're ready to run the program. And again, it's very easy. Let's type in Python, and then space, the name of the file, so Sentiment Analysis, and then dash or tab, excuse me, and then press Enter, and this is going to run the program. Now, when you do this, it's going to open a browser tab, which it did for me over here. So let me drag it onto the screen. So you can see now it's asking us to choose an account. I'm going to choose This is for authentication purposes, and it's saying to continue. We need an account for this. And if you remember, we added this as a user test user. So this email is able to access that account. So I'm going to select this And now, it says, Google hasn't verified this app, which is fine because we haven't really published it or anything. So go ahead and click on Continue. And over here, again, it's just asking for the sentiment analysis. It's giving you the information that is trying to access, and you have to explicitly give it consent. So over here, it says, when you allow this access, Sentiment Analysis automation will be able to see, edit, create, and delete all your Google Sheet spreadsheets. So it's just making sure that you understand when you are granted this access or when you're granting this access to this account. So go ahead and click Continue and now it says the authentication flow is completed, you may close this window. So now let's go back to our Visual Studio code and look at the terminal. So you can see here in the console, you can see that program is running and it's starting to analyze the sentiment. So the first one was, I absolutely love this service. So it's going to take that and give it to Deep Seek as a prompt and ask Deepsek to analyze and give us a sentiment. So you can see it says that one was positive. The product was broken when it arrived. That one is negative. Amazing experience. By again, that's positive. It's okay, not great, but not terrible either. That's neutral. And it's just going to continue looping on all the rows in column A to run through all the u rows that actually have values and do the sentiment analysis. And when it actually finishes, it's going to write that to the Google Sheet on column B. So it says sentiment analysis complete and written to the sheet. So now let's actually go ahead and test that. So we're going to go to our sheet, and you can see it's now automatically populated all those values for us here. And again, if you don't see this, feel free to just refresh the page. And when you refresh, you're going to see those values populated if there were no errors as part of running the program or the process. Now, this is a simple demo, but you can see how powerful this can be, because if you had a store that had 100 thousands of sales or 10,000 of sales, you wouldn't and you wanted to understand the customer feedback in order to make improvements to your store or Ecommerce brand or whatever you're trying to sell, and you wanted to gather feedback and make improvements, you need to understand data, and you need to be able to interpret data and make data driven type decisions. So this is going to help you with that, but imagine if this was done by a person manually, and there was 10,000 rows or 50,000 rows because you had 50,000 sales and reviews. This is going to take a very, very long time, and it only took a few seconds for AI to do it for you, and it was all done automatically. So there's really nothing for you to do, and this helps you save your time on things that are more important and high value work type of related type of work. So I hope this demonstrates how powerful the integration of AI into applications like Google Sheet can be. You just learned how to turn static data into a dynamic AI pipeline. Next, imagine auto generating monthly reports or cleaning messy datasets. Deep Seek handles it all. For this next exercise, I would like you to modify this script to summarize feedback in column C with a ten word summary. 16. Fine Tuning Models with Dataset: In this lecture, you'll teach Deep Seek to specialize in your domain, whether it's legal jargon, medical terms or brand voice. No machine learning PhD is required. Fine tuning is like teaching Deep Seek your company's slang or industry acronyms. Suddenly, it writes exactly how you need. No more generic responses. A retail company fine tuned Deep Seek on 500 Path support tickets. Now it resolves 40% more issues without human health. Let's recreate this. Alright, so this next demo is going to be very interesting. And what we're going to do is fine tune Deep Seek for customer support. So the objective here is to train Deep Seek to resolve ecommerce refund requests in your brand's voice. And the way we're going to approach this is we're going to get the Deep Seek base model, one of the base models that are free to use, and we're going to train it using some data, customer data. And we're going to fine tune it to adapt to that customer according to that customer data and adapt to your brand's voice and how you want it to potentially respond to customer request as issues come up. And what we'll do at the end is we're going to compare the results. So we'll run prompts against the base model and we'll run some prompts against the fine tune model, and then you'll be able to visually compare the differences yourself. Let's dive right into it. First thing we're going to do is we're going to create a brand new folder here in your development environment, and this is going to be empty to begin with. And what I'm going to do is I'm going to bring or copy paste these three files here. And don't worry. We'll go through these three files in more detail in a bit. Now, what we're going to do is we're going to open Visual Studio code in this working directory. Okay. Now, over here, just very quickly, we got three files. We got support data dot CSV. This is the data that we're going to use to train our model for our support request that is going to adapt to our brand's voice. And this is just some data that I populated. It's just sample data. You have the train model the Pi. This is the program that's going to train the model, the base model based on the data in the support data CSV. And lastly, we have a program that's going to simply verify by running some comparison between the base model and the train model or the fine tune model, as you'll see. Alright, so in order for us to get started, what we're going to do first is we're going to need to install some dependency. So please follow this in this sequence. This is really important. And before we get started, I just wanted to point out something really important. I highly recommend for this if you're planning to follow along with this demo, I highly recommend having a machine, whether it's a laptop or desktop to have a very decent GPU. Because training AI models are often very expensive. They're going to take a very, very long time, especially if you're running it on CPU. So you'll see I have I would say somewhat of a decent GPU. And even with that, it's going to take a long time. So if you're running this or planning to run this on CPU, it's going to take even longer, and you may have to wait for hours until the process is finished. So again, my recommendation is use a machine or a computer that has a fairly GPU, whether it's an AMD, graphics card or an NVDA. So the first thing we want to do is create a virtual environment. And I've shown you in previous lectures how to do that through this process over here. So if you hover over on the bottom right hand corner, you'll see this thing that says 3.13 0.3 64 bit. And if you click on it, you can click on Cre Virtual Environment and then just follow the instructions, which is exactly what we've done in some of the previous lectures in the past. Now, I'm going to show you a new way by doing that through the command prompt. So let's go ahead and I'm just going to zoom in a little bit so it's easier to see. And let's go ahead and open a new terminal. And let's go ahead and create a new virtual environment for this body of work. And I'm going to paste in the following command. And one thing I should mention as a prerequisite is it's better to use an older version of Python. So currently because not everything and all the dependencies are compatible, the libraries we're going to use in this MemR compatible with the newest version of Python. I've done a lot of testing, and I found that with Python 3.10 or any variation of 3.10, things work very smoothly. So I recommend you do the same. But of course, remember this is as of the time of this recording and things will improve and change over time. So this is why you see me creating a virtual environment with Python ten. So as of right now, I have Python 3.13 installed locally on my machine, and I also have Python 3.10 installed locally on my machine. You can install different versions of Python on your computer simultaneously. I got to make sure that they're all any version you install, you add it to the path in your system variables. That's very, very important. So don't forget that. Otherwise, things are not going to work very smoothly. And you have that option as you're going through the Python installation wizard. Now, over here, this command is simply saying, create a virtual environment using Python version 3.10, and this is the name of our virtual environment, which is deepsk demo environment. So let's go ahead and press Enter and have that create the virtual environment. Now, when you do that, you get this notice on the bottom that says, Do you want to select this workspace selected for the workspace folder? And I'm going to say yes because that's exactly what we're creating this virtual environment for. Now, the next step, once the virtual environment is completed, we need to activate it. And the virtual environment folder will now be created in your development environment, and there's a folder called scripts, and in there, there's a script that's called activate. And what we're going to do is we're simply going to call that so that we can activate this virtual environment. And the command to do that is simply you just have to navigate to that working directory and call Activate. So let's go ahead and run this. You can see over here this is changed in green, and now we are activating the virtual environment and we're in the context of that environment. So anything we install, all the dependencies, everything is localized. Now, one test I would like you to run here just because for myself, for example, I have two versions of Python. I want to make sure that I am using the older one for the purposes of this work and this demo because I know the newer versions are currently not compatible. So I want to be 100% sure that I'm using Python 3.10 and not Python 3.13, just because I have both in salt. You can easily check that by just simply typing Python. Space dash dash version. And as you can see, it's telling me that I am using Python 3.10 0.10, which is exactly what I was aiming for. Next, we want to make sure that we have up to date version of PIP, which is what we use to install our dependencies. Most of the time, this should already be up to date, but I'm just going to run it as just to reassure myself that I'm working with the latest version. So the command for this is Python PIP Install Upgrade PIP. So we're upgrading PIP itself, and this is going to you see over here, it says found the existing installation, which is 2.3 0.1. And now, after successful installation, we have upgraded to PIP 25.1. Next, let's go ahead and install torch and the KUDA library. So these are the dependencies that you need in order for your program to be able to train the model on GPU. So this is very important. And I experimented with different versions of KUDA and I found that this particular version over here, the 128 works the best or 12.8. In the link over here, it shows us 128 CU 128, but this is simply the compute platform of CUDA 12.8. This is, again, very important because I experimented with many different versions, and this seemed to be the one that worked for me. So something to keep in mind, let's go ahead and run this command, which is simply PIP install torch, torch Vision, torch audio, and then here's the URL to also grab the CUDA version 12.8. Let's go ahead and press Enter and get these dependencies started. Now, the installation for this is going to take some time. So I'm not What I'm going to do is in order to save you time, I'm going to pause the video, let this finish, and when it's done, I'll resume the video and we'll come back to this. Right the installation completed successfully, as you can see in the logs here, it pulled in a whole bunch of packages, not just torch, but you got many different ones here like CMPI, Palo, Nump and all these other ones, storage Vision, torch Audio as part of this installation. So next, what we want to do is we want to install bit sand bytes and accelerate libraries, which again, we'll need for training. So let's go ahead and run the following command, which says PIP Install and the name of the two libraries that you can see here on the screen. So let's go ahead and run this. Now, we need to install Transformers dataset and PEF. So again, PIP install the name of those three libraries, transformers datasets and PEF. So let's go ahead and run that. And, of course, last but not least, we need to install the hugging phase hub. So that's simply PIP install Hugging Phase underscore hub, and this is the last dependency we need to install for this program. So let's go ahead and run that. And yeah, we are basically done in terms of the installation of the dependencies we need in order to run the training program. Now, before we run the training program to fine tune the model using your dataset, there's a quick test that I usually do here, and this is to ensure all the installation have gone correctly, and also that the system is able to detect my GPU, because if it doesn't, that means it's going to automatically default to CPU, and that's not what I want happening here because again, it's going to take many, many hours for the training to be done. So the way I do that is by doing a quick test. So let me first do a CLS, which clears the screen, so it's easier to see. First, we need to enter Python mode, and then we just print some stuff into the console log. So let's type in Python, and this is going to enter the Python mode here. If you see the three arrows, that means that you've done this correctly. And what I'm going to do is type in Import torch that's going to take a second to load, and then we're going to print the available CUDA devices that's available, and then we'll see if it's compatible or not. So now that import is done, I'm going to put in the following. So here, I'm saying print, torch dot KUDA is available. So if it detects a GPU on my machine, and of course, the drivers for my NVDA GPU have to be installed and working correctly in order for it to be able to make that detection, but here, if it is detecting it, this first statement is going to come back with either true or false. And in this case, it should come back with true if I've done the installation correctly. And the second one is going to print the name of that device. So let's go ahead and run this and see what we come up with. So you can see the first statement, it returned true, and the next one came back with the name of the GPU. So in this case, NVD G fos RTX 40 70 laptop GPU. This means that it has been able to detect the GPU correctly, and now we can be sure that when we start the training program, it's going to leverage this GPU and not the CPU. And, of course, we've written the code to do that, as well. So now let's exit out of this Python. So the way you can do that is exit, and then opening closing bracket. This is going to take us back to the activated virtual environment, and now we're ready to run our training program. Alright, so now, this is where the exciting part happens, which is kind of boring, as well. So this is where the magic happens, and this is where we're going to start training the data. And we're going to use this program here that we talked about, which we'll later discuss in more detail. We're going to use this and the following support underscore data dot CSV file to basically fine tune this model given all these customer request and the customer support agent response. And over here, we have 101 data point. So it's quite diverse and nice with different datasets and samples here. So it should do a pretty good job in training our model, and at the end, we'll see when we run our verification. So over here, the way we run this program and start the training is simply the name of this Python and then name of this file. So let's go ahead and type in Python. You can tab that to autocomplete and then go space and then type in rain Auto tab and then that will Autocomplete. And if you press Enter, this is when it's going to start the training. And one note here is that even though I have a relatively good GPU. This is going to take pretty long time relatively. And you can see here the program has started. It's detected the number of rows, so we've got 100 to work with. And over here is checking the shorts. And on the bottom right hand corner here, you see this text that says zero out of 65 and 00 question mark. And what this is going to show is that as training progresses, it's going to update those numbers, and what it's going to show you is how much time has elapsed and how much time is remaining. And knowing that this is going to take several hours, what I'm going to do is pause the video here, let this complete, and then we'll resume the video, and we'll start with rest and the verification. So I'll see you soon. All right, so we're back. And as you can see, the training of the model has now completed. And here's some information you can see right off the bat in the console. So it was done 100% completed. It took roughly about 1 hour, 45 minutes to train this model. You see the status here training complete, and it's giving you some information about where the model was saved. In this case, in this directory here, fine underscore tuned underscore model. And you can see that it's telling us that the model was saved successfully. If you want to double check this, you can just open your project directory. You can see that it has created a new folder here called Fin tuned Model, and if you click on it, you'll see the files associated with this. And now for the fun part, the last step is for us to verify the results. And the way we're going to do that is we're going to run some example prompts against the base model and the same prompts against the fine Tune model, which we trained with our support data, and we're going to do a comparison and see if we notice any differences. Now the way we're going to get that accomplished is by this program over here. So on the left hand side, you can see we have a Python script called Verified Train Model. And here I have the code that actually accomplishes this task. So it's simply going to load the models. It's going to run the proms and it's going to show us the result. And again, we'll go through this in a moment. But first, let's run this and see what we get. And the way we simply run this is by just typing Python space and the name of the file. So verify and then just type that, it'll automatically pick the file up. And then let's go ahead and press Enter to run the prompts against these models and see what we come up with. Okay, so we're back and the verification script has finished running, and we're seeing some interesting results here. So let's go through a detailed walk through and take a look at what we're seeing prompt by prompt and compare some of the key differences between the two models. So first, let me make this terminal bigger so it's easier to see, and then let's scroll up all the way to the top here so that we can start from the very first example. Okay. And in our code, we've isolated this prompt by prom. So as you can see, in the console log, you can clearly see where does the first prom starts, and then they're divided by these dividers, equal sign dividers that you see to just make things a little bit more readable and nicer visually. And then you have the base model response, and then you have the fine tune model response. So it's easy to compare the two differences. Now, let's start with the first prompt and go through some of the differences. So the first prompt says, customer refund request, so it says my order was canceled without my permission, and I was still charged. Now if you're looking at the base model, the base model response is, I'm sorry to hear that. You had a negative experience with our service. Please provide me with the following information so I can assist you better. And then it's asking for these things like order ID, payment method, days reason for cancellation and so on. And then it says, after I have the necessary information, I'll contact your payment provider and the merchant to resolve this issue. And then we'll talk about this perplexity number later. But this is the response of the base model. Now let's look at the fine tune model. So you can see the fine tune model is more concise. It says, it sounds like you have encountered the problem with your order. Please provide me with the order number or any other information that may help me to assist you better. So difference here is that the base model launches into a multi bullet semi automated workflow. Such as contacting the payment provider and merchant. And then the fine tune model here, this one is the model stays more succinct and customer centric asking only for the key info first. And this is matching our training examples that emphasized gathering details rather than promising back end actions. Now let's move on to the next prompt here. And prompt number two, this one says customer refund request. They're all refund requests. So it says the app's premium features aren't working, even though I paid for them last week. Now, let's compare the response from the both models. So the base model says, I'm sorry to hear that. Can you please provide me with more information about the issue you're experiencing? This will help me better understand and assist you with your concern, AI assistant, and so on. The fine tune model response is, thank you for reaching out to us regarding the issues with the app's premium features. We appreciate your patience and understanding as we work towards resolving this matter. To ensure that we can address your concern effectively, we kindly request you to provide the following information, and then it's asking for these three things. You have the date, the platform, and the name of the account. And then please send us the whatever. And over here, you can see that the difference in the fine tuned response, you can see that it adapts a more formal brand aligned voice like their customer, and thank you. And it's a structured list of exactly the three data points here that, you know, it matches exactly the one we provided in the training data. Whereas the base model gave a generic open end answer. Now, let's go over the next prom. So here it says, I purchased two software licenses for our team, but one key was invalid and the other hasn't been delivered. So looking at the base model, it says, To resolve the issue, please follow these steps, and then it goes into sort of like all the steps. And then the fine tune model responses, it says, firstly, I apologize for any inconvenience this a may cause so you can see the difference between this, the opening between the base model and the Fne tune model. This is more customer centric and more apologetic and formal. It says we are committed to providing high quality software solutions and ensuring that our customers are satisfied with their purchase. So you can see the difference here is that the base model punts the customer to the seller and defers, whereas your fine tune model stays in house. It apologizes upfront and asks for exactly the fields you trained it on, matching your dataset tone and structure. Now let's take a look at the next prompt, and this one says, Please draft a brief apology email to a customer whose license key was invalid. So the base model starts with the subject line apology for inconvenience. And if you look at the subject line apology for the five ton model, it says apology for invalid license key, right? You can notice the difference right off the bat. The first one says, I hope this email finds you well. I'm writing to apologize for any inconvenience that you have faced due to an issue with your license key and so on. I'll let you read all of this. And then the Fine Tune model says, I hope this email finds you well. I'm writing to apologize for any inconvenience you encounter regarding your whatever the product name is and the license key. Again, go through both of these, but I just wanted to touch on a couple of differences over here between the two, and right off the bat, you can notice that they're both polite apologies. But the Fnetun version, it uses a more specific subject line over here. That refers to the invalid license key. It personalizes the placeholders, like the customer name and product name, right? The ones that you see over here. And it mentions recently discovered, and we have taken steps to ensure this does not happen again. And again, this is reflecting the nuance from our training data. Okay, so the next prom says in one sentence, summarize how we will resolve a missing order item. And the base model says we will promptly replace a missing item with a similar or equivalent one to ensure customer satisfaction. The fine two model says we will replace the missing order item with a similar product from our inventory and notify the customer of the change. And you can see here the difference is just a subtle rewarding. So the fine two version explicitly mentions notify the customer of the change, and it's echoing the multi step resolution style that we trained it on. Let's take a look at the last one and this one, the prom says, list three next steps we will take to process prorated subscription refund. And here's the first two number one and two for the base model and then number one and two for the FinTune model. So please pause the video, read through this. But I'm going to quickly cover the difference, and the differences, the ordering and the focus have shifted. So if you look at the fine tune model here, the fine tune model leads with the calculation step, which is mirroring our training example in the support data CSV file, and then it moves into execution and communication in a more logical sequence. One last thing I wanted to quickly explain while we have the results of the verify script is to touch on why the perplexities didn't change. So if you look at these last two, so for example, this one for the base model is 46.25, and for the fine tune model is 46.25. So same number. And then for the last front, we got 62.12 for the base, and then we got 62.12 for the fine tune model. So let's talk about why they didn't change. And the reason is you're still measuring PPL on the prompt alone, not on the prompt plus the generated continuation. Because the prompt is identical in both cases, you get identical scores. To see the PPL improvements, you would need to score the actual continuations, which is masking out the prompt tokens, and that way you will see the different numbers. Okay, so we're almost at the end. And before we move on to the next topic, I just wanted to spend a little bit time here and walk you through each of these files to give you better context and just walk you through what they contain and what they're doing at a very high level. So we had three files here. We got the support data, CSV. We got the trained model, and we got the Verify trained model. So let's start with the CSV file here and what this means and what it is. So let me just make this. Actually, let me close the terminal, so you have the whole screen. If you're already familiar with CSV, then this is pretty easy, but essentially this is two columns CSV, and you can see the columns here. So we got customer underscore request, and then we got the agent response here on the top. And this one simply contains these two columns, and the customer request over here, this is a single turn user message describing their problem or ask. And the agents respond here is the ideal support agent reply you want your model to learn to generate. Now, why do these pairs matter? Each row that you see here in the CSV, um there tro is one supervised training example. And during the fine tuning process, the model sees the user and then the customer refund request and the request itself. And then it sees the assistant and the agents respond. And then from there, it can learn it learns how to map the requests to the response style, tone, and the content that you've provided. I will include this as part of the lecture, and you can go through the entire CSV row by row just to get a sense of what the content is. And the keypaer values there. And let's go over some of the key characteristics of this dataset. So diversity of scenarios is one. So for example, we have subscription cancellations. We've got refund inquiries, we got missing or damaged orders. We got license key problems, we got unexpected charges, password recess, two of phase setup, and so on. Okay? The other one is the consistent structure. So every agent respond every agent responds follows a polite and structured format, which starts with apology, then acknowledgment, then data gathering or resolution steps. And it bullet lists or numbered items appear when you need multiple pieces of information. Another one is tone and branding. So responses use, I'm sorry or thank you openings. They include placeholders such as bracket customer or order numbers and clear next steps matching your company's support voice. And there's some edge cases and variations. So rows intentionally repeat similar request with different valid answers, teaching the model to pick up synonyms and paraphrases. A few trick examples are also in there, for example, account suspended without warning, paired with unrelated responses, force the model to learn the correct context mapping. The one thing I would like you to take away from this support data sample CSV file throughout the training of the model for this demo is that this file is your ground truth. Good training datasets should be representative and cover all common user issues. They should be consistent and maintain your brand's voice, and they should be varied to include etch cases and paraphrases. Next, let's take a look at the train underscore model Pi. This is this Python script that actually trains our model using the support underscore data CSV file. So let's go through this block by block and see what it's doing. Let's start with over here with the beginning, which is the imports and the configuration. So Pandas and data dataset, these help load your CSV into a hugging phase dataset. Transformers, this is for core tokenizers models and training framework. Bits and Bytes config lets us quantize the base model down to a four bit slashing VRAM requirements. PEFT or PEFT at the parameter efficient fine tuning library, and here we are using La adapters instead of full weight fine tuning. Torch checks for GPU, D type setting, et cetera. So this is what we used to check whether a GPU device is available on the machine that we're training on. And I walked you through a couple of console logs that shows you whether or not the device is available and print the device's name, which is simply the graphic art that you have in your computer or laptop. And then over here below, we are declaring the model name, the data path, and the output directory. So the model name is simply this is where you're using a relatively light model which is LLM seven B hat from Deepsk, and this is the pre trained checkpoint you're going to quantize and wrap. The data path this is simply the path to the training example, which is our CSV file. And the output directory, this is where the fine tune adapter files and tokenizers end up going. And the hyperparameters, these are things like patch size, learning rate, Epoch, max sequence length, et cetera. Next, let's go through the GPU check and data loading, and those are these two blocks over here. So these ensure that UDA capable GPU is present. Quantized and La training still require a GPU. And this is where it reads your CSV into a data frame, then converts it to an HF dataset for Easy Map operations. Now, let's go through the tokenizer setup, which is this block over here. So this is where it loads the models tokenizer. Via remote code, since this is a chat model, it adds a pad token using the EOS underscore token, so batches can be padded, and it sets left side padding, which is standard for casual models as they read text from the right. Next, let's move on to formatting and tokenization, which is the start of this block over here. And this is basically like the format example, it wraps the intro into your chat style tokens so the model can see something like the user and then customer refund requests, and then the assistant and the response. And the tokenize function turns that string into a token ID token IDs, it pads and truncates to 256 tokens, and then it copies input IDs into labels, so the trainer applies the next token casual loss on every token. Now, let's move on to the forbid quantization and model loading, and that's over here this blog. So you can see start of this block, and this is where you can see that the bit and Bytes config instructs hugging face to load the full seven B parameter model in a four bit quantized form, storing only small scale zero parameter in 16 bit. And the device underscore map equals to auto, it distributes layers across CPU and GPU if needed. Now let's go through attaching the Laura and preparing to train, which starts here with the PEF config. And this is the Laura config defines a lightweight adapter. So the R equals the rank, which is the size of the adapter matrices. Laura underscore Alpha is the scaling factor. And in the target underscore modules, this is which way matrices to augment. And then the Get PepT model here raps the frozen quantized base in trainable layers, and only approximately, say one to 2% of the prams actually get updated. Now let's go through the training arguments, and this one is the block over here that you're simply looking at. And the training arguments there for fine tuning hyperparameters and checkpointing settings. And the trainer orchestrates batching gradient steps, logging and saving. So only the La layers update, the base weights stay frozen. And lastly, let's talk about running the training and saving, and that starts with this block over here. So this one, the train function simply launches the fine tuning loop. The model that save underscore pre trained function writes just the adapters files and basically the adapter underscores star dot save tensors and the config into the folder, which is the fine tune model in our upput directory. And the tokenizer dot save underscore preteen function copies any tokenizer artifacts in the same directory for later inference. Now, I just wanted to say some of this if you're not technical, if you are not or if you're not familiar with machine learning concepts, this could seem intimidating, but don't worry, it's really easy to learn. So if you ever just, you know, take a quick, short introductory course to machine learning, a lot of these terminologies makes sense. And if you're already familiar, then you can pretty much dissect this file on your own, and everything will make sense to you. But please focus on the big picture is that this file, along with the other files can be used to train different types of AI models to something specific that matches your use case. In our example, the customer brands voice. Alright, lastly, let's go through the verification script, which is called Verify Underscore train underscore model dot pi. So this is the Python program or script. And let's go through the breakdown of this file step by step and explain each piece throughout this demo. So let's start again with the imports here. So the auto tokenizer and the auto model for Casual ALM, these load both the base and fine tune tokenizer, slash models. The bits and bytes config, we covered this. So this is the same four bit quantization spec used in the training file that you saw earlier. The generation config controls the decoding, which is the sampling parameters. The PEP model, this simply wraps the fourbt base model with your save Laura adapters, and the cross entropy computes the pertkien LM loss for perplexity scoring, which we saw the numbers being the same earlier in our demo. All right. Now let's go through the next one, which is preparing both preparing the models block here. And this is simply preparing the both models. And this is doing what this block is doing is that it loads the tokenizer, so both models use identical encoding. It loads and the Eval mode the base four bit model. It loads and Eval mode the PEFT model, which are the four bit base and your La adapters, and it prints non zero adapter weights. So this is a quick check that your fine tune parameter are simply active. Now let's move on to generation function, which is this block over here. So this one, it uses sampling. As you can see, do underscore sample equals true top underscore P and the temperature arguments. So stylistic and war choice differences can surface using these arguments in sampling, and it also returns the decoded continuation, including both prompt and response, so you can strip out the prompt later. Now, let's talk about this block here, which is the perplexity scoring. So this scores just the prompt under each model. And as we discussed earlier, you can later adapt this to score the generated continuation instead because earlier in the demo, you saw that the numbers are the same as it stands right now. Alright, we're almost there. So the next one is going to be the main demo loop here, so that's starting from this main function here. So let's scroll down a little bit so everything is in picture. Okay, perfect. So this one iterates through a list of test prompts, as you can see over here, these guys here, and including both replication scenarios to verify no regressions and richer prompts to highlight fine tune gains that we got from training. And for each prompt, it prints the plain user text. It generates a sample response for both models. It computes and shows perplexity scoring and the number, and it labels everything clearly so you can see side by side comparisons as we covered in the earlier video. And you saw that when we ran the script using the command Python verify underscore trained underscore model a Pi, which is the name of the Python script, we saw that the adapter parameter counts confirming non zero fine tuned weights. We saw divergent sample outputs between the base and the fine tune model, and we saw the perplexity scores for a quantitative metric of each model's comfort with the content. Now you know how to future proof your workflows. Imagine a legal AI that drafts contracts in your firm's style or a medical AI that explains procedures exactly how your doctors would. The possibilities are endless. Now, I would like you to go through the following exercise and fine tune Deep Seek on ten product reviews. Create a CSV file with some sample data and review the before and after responses. 17. Market Insights: How do you enter a new market with confidence? In this lecture, we'll dissect how Ecofit used DeepSeek to analyze the Asian activewear market, maneuver competitors, and craft a winning launch strategy all in 72 hours. Ecofit needed fast, affordable insights to avoid costly missteps. Enter DeepSeek, their 247 market research analyst. Traditional firms take months. DeepSeek delivered actionable insights in days. Let's peek behind the curtain. DeepSeek didn't just repeat the information without analyzing it or comprehending it. It connected dots humans miss. For example, sustainability matters, but only if priced 15% below global rates. DeepSeek turned uncertainty into a playbook. Now, let's replicate this for your business. In this demo, you're going to learn how to conduct your own market analysis, and the goal here is to use DeepSeek to analyze a mock competitor. So let's say urban gear and extract actionable insights. So first, let's scrape the competitor data. So I'm going to use the following prompt here. And I'm going to say, act as a market research AI, analyze urban gear in Indonesia. And I'm giving it three bullet points here. So these are the things that I am really looking for in terms of insight. So top three customer pain points from reviews, pricing versus sustainability preferences and recommended entry strategies. So let's go ahead and run this and see what Deep C comes up with. Ik has finished putting the results together. So let's quickly go through this and analyze the output. So you can see it's broken it down into the three categories that we asked for. So the first one is top three consumer pain points. And again, this is based on reviews. So it's saying that after analyzing the Indonesian ecommerce and social media reviews for urban brands, this is sort of what it found. Now again, remember this is a mock brand, so it's doing its best to try to find things on social media in the segment of this particular clothing line, if you will, in the market. And you can see here the three that are mentioned here is limited size inclusivity, slow delivery, and high shipping cost and quality inconsistency. So this is great because it's telling you what the pain points are. And as a brand, you can use this to your advantage because you can do better than your competitors in this area. Now let's move into the second one here. So it says pricing versus sustainability preferences. And here's talking about price sensitivity. Dominates. So it's very important how you price your items. It says, Indonesian consumers are highly price driven with a sweet spot between this number and this number. And then it's giving you some competitors that are actually doing pretty good in this area. So local unicorn and Eigo. Sustainability as a secondary factor, so price first, then sustainability. So it says while ecocsciousness is growing, such as thrifting trends on Instagram, most buyers prioritize affordability. So price is the number one factor over here in this segment. Um, it says, however, marketing sustainability can boost brand loyalty. So that's important, too. So opportunity is that it's saying this particular brand, which again, we made up, could introduce a sustainable essentials line, for example, organic cotton T shirts at a slightly premium price while keeping the core product available. Sorry, affordable. Recommended entry strategies. So now, based on those analysis, it's helping us make certain decisions, and it's providing some suggestions on how we could enter this market. And it's saying that Phase one, we could go with digital first direct to consumer with localized influencers. So things like using platforms such as Instagram, Shopee and over here, we can do a KL collaboration, so we can partner with micro influencers who have slightly lower followers but still in a good healthy range. In streetwear. So for example, it's even giving you some of those pages on Instagram that you could potentially reach out to these people and ask for help, and then limited drop. So you can do test demand with small batch releases, which is important because you can test pilot your brand first, see how it succeeds before doing a full launch. Next, we got Phase two, which is leveraging logistics for partnership. So here's making a recommendation to partner with JNE or Ninja Van for discounted shipping rates to compete on delivery speed. Because remember, this was one of the issues that they brought up in terms of the pain points, like the slow if you go back to number one here, you can see slow delivery and high shipping costs. So it's saying that it's making the recommendation that we could partner with some of these organizations for discounted shipping rates. And then you can also offer cash on delivery, COD, still preferred by 60% of Indonesian shoppers. And then, of course, phase three expand with sustainability storytelling. So highlight eco friendly materials or recycling programs only after establishing trust via quality and affordability. And here's your differentiator. So it's saying that your brand could stand up by offering custom sizing options, which was pain point number one or bundling popular items. So we can bundle Ts and shorts at temperon of as an example. So here, it says final tip monitor competitors like Eigo which are affordable and Slofat which are premium sustainable streetwear to identify gaps, and it's even offering for us to do a SWAT analysis, which we'll skip for now, but the results actually look pretty good. Now, let's go ahead one step further and refine this with local contexts. So what I'm going to do is use the following prompt that says adjust for Vietnam, and it says, highlight cultural factors. Again, we're trying to use these prompts and follow up prompts to do market research to analyze the market and the segment for the particular area that we're looking for here. So let's go ahead and run this prompt and then see what Deep C comes up with. Okay, so DeepSeek has finished putting the results together. Now, we won't go through all of this, but I just wanted to show you that if feel free to pause the video and follow along with these prompts. But yeah, I just wanted to show you that DeepSeek was able to sort of run that analysis and make the adjustment for Vietnam. So again, same thing. You can see top three customer pain points, and then now it's adjusting for that specific region or um country. So over here, you got fit and style preferences. Again, again, three categories, the pain points, the pricings, sustainability, and then the recommended entry strategy. So over here, you got the top 310 points. You got the category two, and you got category three. I broke it down into several phases. So leverage Vietnam's youth subcultures, address logistics, trust issue, and then phase three community driven drops. Now, over here, it's also created a table, which is very helpful because it now outlines the key cultural differentiators, and it says Vietnam versus Indonesia. And then you can see, like, for example, fit, it says, these are showing you the significance here. So slim greater than oversight, local pride, greater than global trends, mobile wallets, greater than COD, and then gaming Indie music greater than fashion blockers. And then it says here, again, final tip, un to redesign your hoodie contest on TikTok, invite users to submit Vietnamese inspired graphics and so on. So again, some recommendations here on how to approach this. Alright, so now that we have some content and some context as to how to approach this, and we've done some market research, or I should say, DeepSeek has done some market research for us using a couple of prompts, we've gathered a lot of good information. And now let's say we want to go to the next step, and that's simply putting this information in a report format. So in this step, we're going to generate a report outline. And for this, I'm going to use the following prompt. And again, you can customize this based on your use case and what's applicable to you. So the prompt says, create a one page market entry report for urban gear in Vietnam. And then here, we're saying that includes sections for overview, SWAT, which is basically a strength, weaknesses and things like that, like analysis tool that is used quite often, and then you got pricing, and then you got marketing. So now, this is going to give us a one page report that includes all of the things that we're asking for all the sections that we're asking for here. So let's go ahead and run this and then have DeepSeek generate this report for us. Alright, this is very cool. And DC has finished putting together the report. So you can see the title of the report. It says, market entry strategy, Urban Gear Vietnam, and then Urban Gear expansion team, and then insert the date. So again, this is just a template and a placeholder. So section one, we got the overview, Section two, we got the SWOT analysis, so strength, weaknesses, opportunities, and threats. Then we got pricing strategy, which again goes into some sweet spots between what the price ranges should be. We got our marketing plan, and then we got the next steps and how to proceed. And, of course, you got your, again, some templates and placeholders here depending on who you need to send this report to. And, of course, remember, you can just simply copy paste this into a Microsoft Word or a Word document or anywhere that you're doing documentation. You can put this in an email and send it to your team. You could even use somebody's in the PowerPoint presentation and use the same content in slides to give presentation to your team or whoever it is you're trying to communicate and make decisions based on the provided data. Now, a couple of things that I wanted to mention here in case you notice some of these issues while going through these prompts with DeepSeek. Number one, if you see vague recommendations, what you could do is you can simply fix that by saying something like this, for example, or adding something to your prompt that says, include three databag tactics with ROI, and that's going to get DeepSeek to actually think and think through the responses that it's trying to provide. And then the fact that it has to go through the databag tactics and provide RI examples is going to help the output from DeepSeek to prevent vague recommendations. Now, the other thing is, if you start to see outdated data as part of DeepSeek response, you can use this by enabling the web search mode. So let me get rid of this. And what you can do is you can simply click this button, so search the web when necessary. You can click that, and then you can append something like this to your prompt you can say enable real time data for 2024 trends. And then this is going to help give you the most up to date information because DeepSeek is going to go look at the Internet, scrape the data, and then give you more real time data for the trends that you're looking for for this particular market research. Ecofits success wasn't luck. It was DeepSeeks ability to turn noise into strategy. So now it's your turn to 18. Competitor Analysis: In this lecture, you'll see how Deep Seek dissects competitors' strengths, weaknesses and customer sentiment in seconds, giving you the edge to outmaneuver them. No spreadsheets, no consultants, just pure AI. 99% of businesses analyze competitors, but 73% waste weeks doing it. So let's fix this with AI. So think about it. Why hire interns to scroll through Yelp when Deepsk delivers SWOT analysis over coffee? We'll reverse engineer a competitor's playbook and draft counter strategies faster than they can schedule a team meeting. In this live demo, you're going to learn and see how you can get ahead of your competitors in three steps. And the objective here is to uncover competitor vulnerabilities and craft the counter strategy using Deeps. So step one, let's start by analyzing the competitor reviews. And to do that, I'm going to use the following prompt that says, act as a senior strategist. Analyze ecofit customer reviews from Indonesia. And here, I wanted to categorize the results or output using the three mentioned ways. Top three complaints from the last six months, sentiment score one to ten on pricing and quality and recommend countermoves for urban gear. Now, for the first one, the first two, excuse me, because we are looking for sort of like a more recent data. So in this case, last six months. What you could do is click the search button and then have Deeps actually search for the most up to date result or within that time period, which is six months, six months ago and onwards. So let's go ahead and run this prompt and then see what kind of results Deep C comes back with. And as you can see here, it is searching the web now for those results, and it found 44 results, and now it's in the process of scraping the data, analyzing it, and then formatting the output for us. All right. So Deep Seek has finished putting together the results. So now what we can do is go through these, review them, gather some insights from the data, and then see what decisions we can make to use this to our advantage to get ahead of the competitors. So let's scroll up to the top here. You can see that it started with the top three complaints from the last six months over here. And again, we won't go into great details, feel free to follow along with the same type of prompts or positive video and read through this. But you can see that over here, the top three were slow response and service delays. You got pricing, transparency issues, and then you got inconsistent quality in after sales support. So these are the top three major complaints from customers. One other thing I wanted to point out here while we're you can see that over each of the things that are mentioned here, there's these numbers here. So number four and 13 and on here, number seven and 13 and over here, four and 13. This is the sources on the Internet where Deep Seek found this information from. So if you want to either quote the source or just go and read the article 0R the news or whatever the source of information is, you can do so by simply clicking this and I'll take you to that page directly, and then you can do a more in depth research and read through it in its entirely if you'd like to do so. This is Deep Seek putting the summarized results here. So you do have access to sources where DeepC grab the information from. Now, the second one sentiment score. So this is really nice because it's super high level, and it quickly tells you what it is, right? It's six out of ten for pricing, which is a little bit above average. And then quality is eight out of ten, which is pretty good compared to, you know, this says that the product quality and professionalism is on the high side. So that's really good to know. And again, you get this right off the bat, and it's really easy to quickly go through this. You don't have to dig through thousands and thousands of reviews and feedback yourself. Deeps can do that for you, and Deeps can analyze these datasets and quickly tell you that, yes, this is just six out of ten on the sentiment and eight out of ten on the quality side, which is very powerful. And the last one is recommended countermoves for Irving gear. So here, it's telling you, these are somebody, you know, if you wanted to outperform the competitor in the same market, these are the things that you could do and the steps you could take. So enhanced transparency in pricing. So offer all inclusive pricing models with no hidden fees. You got prioritized speed and reliability. So this is where you can implement real time tracking for service appointments, train local teams for faster turnaround time. You got boost after sales engagement, so launch loyalty program with free maintenance checks. You got localized sustainability messaging, so important to highlight eco friendly materials and so on, and then you got leverage social proof. So partner with micro influencers for authentic reviews and try to get the word out there about your brand. Now, for step two, let's go ahead and dissect competitor marketing. And I'm going to use a following prompt here in order to accomplish that. So I'm going to say analyze ECOfits Instagram posts for Vietnam. So top three content themes, sustainability, family, and so on. The engagement rate benchmarks and weaknesses to exploit. Again, we're trying to get ahead, right? And you can still basically find the gaps so that we could make improvements in those gaps and get ahead of our competitors. And you can leave the search button on here because again, we're trying to scrape this information off the Internet for the latest data. So let's go ahead and run this and see what DVC comes up with. Now, let's go through the results together, and over here, you can see that DVC has given us the top three content themes based on the analyzing the Instagram posts for Vietnam. And first one is fitness transformation and success stories. And again, here it gets into some examples, event driven engagement and community and social responsibility. Over here, we got the data for engagement rate benchmarks, and if you scroll down here, it's suggesting some of the weaknesses that we could exploit for our competitors, limited sustainability focus. So this is where we can do better inconsistent high value content and underutilized influencer partnership. So over here is giving us some of these influencers that we could potentially partner up with and who can help us drive higher trust and have a bigger reach in our niche. And here, it's recommended some counter strategies for competitors. So amplify sustainability. So this is going back to here. Limited sustainability. So this is just a one to one sort of mapping, content diversification, which helps fill the gap for inconsistent, high value content and then micro influence alliances, which is going to tackle this particular gap, which is under utilized influencer partnership. And the key takeaway here is that ECO fits strength in community building, but falter in content, depth and green branding. And then this is where competitors can come in and capitalize by emerging sustainability with influencer driven authenticity. For our last step, what we want to do is get help from Deepsk to craft our counter strategy. So now it's gotten all this data for us. It's formatted. It's given us counter strategies, and now it's time to bring it all together. And here's a prompt that you can use as an example to do this. Again, depending on the data you've gathered and the market research DeepCk has done and what the results were. In this case, I'm just using an example prompt here, but you could switch the content to match exactly what the output from the market research site was. So for now, we can just go ahead and turn off this search because we no longer are looking at this, and Deepsk already has context from the data in this same chat, so we can continue with follow up prompts. And I'm going to use the following prompt to create that counter strategy. So the prompt says, create a three point marketing plan for Urban Gear to beat EcoFit in Vietnam. And we want to focus on content, pricing, and partnership. And as I mentioned, you could really change these to what the actual focus should be or where the gaps are, and depending on the results you got from Deep seek in earlier steps of this demo. So let's go ahead and run this and see what deeps comes up with. And as you can see, Deep Seek is able to put this strategy together. So if you go up here, you can see the marketing plan, it's a three point marketing plan for urban gear to dominate Vietnam's fitness market. And here you have your strategy. So it's giving you these three things to focus on the leverage Vietnam's fitness trends, the eco edge over ecofit and then solve the pain points. You got your tactics here, and then you got pricing being transparency and here to attract mass and premium segments. You got your tactics, and the last one is partnerships, and then you got your tactics for that as well. And then here's what's actually you may see in terms of the expected outcome if you follow the strategy. So your content you might be getting two times higher engagement than the competitor. Your pricing could be, 15% to 20% membership growth given that you follow the pricing model that DeepC helped us with, and then the partnerships, you can see 30% brand recall increase through hyperlocal influencers. And then here's the key differentiator, which is merges affordability with sustainability. And that's what you want your marketing plan and your brand to focus on. You've just learned from this demo how to identify gaps and leverage them to create counter strategies to get ahead of your competitor in a specific segment or market. Now, launch campaigns that hit where they're weakest and you can watch your market share grow. Now, for this exercise, I would like you to analyze a competitor in your niche, create one weakness, and your countermove. 19. Powerpoint: In this lecture, you'll turn messy spreadsheets into boardroom ready PowerPoint outlines, complete with charts, insights, and actionable recommendations. No design skills are required. Your team deserves better than late night aligning bullet points. Let's fix this with automation. We'll take quarter sales data and transform it into a CEO ready presentation in just minutes, so watch closely. Here we have a case study, and this is the souter sales report. We got the raw data, we got our goal, and we got the tools. This isn't just about saving time, it's about turning data into decisions. So let's begin. In this live demo, you're going to learn how to turn data into PowerPoint presentation in just 5 minutes or less. And the objective here is to convert sales data into a structured PowerPoint outline. Now, for the purposes of this demo, I've gone ahead and created a very simple spreadsheet. Again, this is just made up data. I created this. This is just sample populated data. So pretend this is our sales, and imagine this is there is 501,000, 10,000 rows here. But again, for simplicity, I just kept it to three rows. Um, over here, we got North America. So we got the region, North America, Europe and Asia in Column B, we got our product, so we got product A product B and product A again. And then we got revenue for these regions and the product and the corresponding product, and then we got growth versus ir quarter. So you can see in North America, product A, did about 1.2 million in sales, and it's small growth compared to ir quarter. In Europe, product B did 890 k, and that's actually a decrease. So we're seeing, um, decline in growth. And then in Asia, it's, again, a little bit of an incline, which is the most incline over here. And yeah, this is just a simple sales data. You could populate more if you like. But again, for simplicity and convenience, this is what I put together for this demo. Now, let's use this sales data and see if we can leverage Deep Seek to quickly put together a presentation for us without us having to do it ourselves and just save time and increase our productivity and the efficiency of our time. So now, what you can do? There's a couple of ways you can do that. You can simply, again, copy paste this data into Deepsk or you can save the file and then upload the file here through this functionality. Because I only have, again, for convenience and ease, I'm just going to simply I have three rows. I'm just going to copy paste them in here, and this is the data here. And this is again, same data we just looked at. So North America product A date one point, 2 million, so that's 12%. We got Europe product B, 800 minus four, and then Asia product A, we got 950 K, 22% increase. So this is all good. Now, this is our data. So what I'm going to do is now I want to have a prompt that actually uses this data to create a Power Point slide. So I'm going to click here. I'm going to push it down a little bit by holding Shift and clicking Inter, and I'm going to put in the following prompt, which says, create an eight slide PowerPoint outline for a coter sales report, use this data, and now we can paste that data here, which we already have done. I just want to mention you can customize this to what you like. This is already a good actionable prompt, but you could use that. You could alter to whatever your use case is. So for example, if eight is too much, then reduce it. If you need more, then increase it. And over here, we're going to take this out because we've already, um, pay set data here. Now, you could just go ahead and do this. You're keeping things more generic and more high level and you are relying on Deep Seek to create this presentation for you to the best of its ability. If you want to give it a little bit more structure and have more control or you want to format it very specific way, you could do that, of course. And let's do that actually. Let's do that over here, and what I'm going to do is I'm going to append the following after the pase data. So let me just create some new lines here and I'm going to add in the following structure. So I'm telling you, I'm basically instructing Deepsek and saying, follow this structure and format. So I asked it to do eight slides. Now I'm telling you exactly what each slide should be as opposed to having relied on Deep C to do the best of its ability to create this presentation for me. I wouldn't know ahead of time what goes in each slide. Here, I know because I'm asking you to follow this exact format. So the first one is the title, which is going to be the highlights. Then second one is executive summary, three key takeaways, regional performance, product breakdown, risks and challenges, opportunities, recommendations, and then slide number eight, next steps. Remember, we're giving it very limited information, right? We're just giving it a couple of numbers, and that's it. So Deepsek may not be able to. The more information you give it, the better analysis and PowerPoint slides you're going to get. But, you know, if you're talking about risks and challenges, Deepsks going to do its best, but it might not give you exactly what you're looking for, right? Or saying with opportunities because there's external factors that are going to internal and external factors that are affecting sales, depending on which region you're in, for example. So again, the more data you can provide here, the better output you're going to get. But again, simplicity will keep things like this, and then let's just observe what DeeP C comes up with. And one last thing, I want to say that you can define the tone here. So I'm going to say tone is going to be professional and data driven. And then I'm going to say include chart suggestions like bar chart, pie chart, line chart so that we can add some visualizations to our presentation. Let's go ahead and run this and see what deeps comes up with. Right. Looking at the results, it actually looks pretty promising and not bad for just a few seconds of us waiting for Deep Seek to simply create the slides for us from just a simple prompt like we have here. It's simple, yet elegant and actionable and a great structure to this prompt here, and we're being very, very specific. So feel free to save this and use it as a template for future presentations, if you like. Now, here's the results, so you can see it's followed exactly what we asked it to. So we got this slide, one, which is title, and it's telling us the title of this, the subtitle, and so on. But you can see, of course, there are some placeholders, so it's not like you can just copy paces and use it exactly as it is. You got to make some changes here. Deepsix doing to help you get more efficient and increase your productivity and gives you some ideas. But of course, you have to still do some work to get this in a ready format. And you can see here you just have to fill out some of these placeholders. For visual, it's suggesting that you include a clean professional background with your company logo. Slide two executive summary. So three key takeaways, it's saying that we're seeing strong growth in Asia, 22% driven by product A, North America outperforms with product A with 12%, and then it says Europe faces decline -4% for product B requiring analysis. And again, it's showing you can create some visuals here with minimalistic icons like up error or down arrow or decline. Slide three, we got regional performance. Slide four, we got product breakdown, Slide five, we got risk and challenges. And again, it's going to be very simple because we haven't really given it any more information other than the sales data itself, but it is doing its best to come up with some of the areas of concerns. So it says that potential market saturation or competitive pressure, of course, it may be for other reasons, but you would know your use case better than Deep seek. So again, the more data you provided, the better the response and its output is going to be. Opportunities, recommendations, and, of course, next steps. And then here, tone consistency, it says, use neutral colors. This is for sort of like just some advice on the presentation, some tips and best practices. It says, label charts clearly. So for example, percentage change year over year, and then data source footnotes for credibility. Now at this point, Deep Seek does not as you see in the options here, unlike ChaGBT doesn't have or I should say, other AIs. At the time of this recording, it does not have the ability to generate images, but that shouldn't stop you because it can still give you sort of the instruction on how to generate these images. So what you can do is you can actually ask it for some chart recommendations, right? So what you can say is you can ask it. Let's assume we're using Google slides here for our Power Point, right? So let's say we can use the following prompt and say step by step to build chart in Google Slide. So you can say, provide me with step by step instructions to build charts in Google Slide given the sales data, right? And here you can determine whether you want to do pie charts or line charts. So in this case, I'm going to say, let's say line chart. So let's go ahead and run this. It's not going to be able to again, give us the actual image of the chart, but it can give us instructions on how to go about creating this chart, given our sales data. So it says, insert the chart, go to Insert Chart line, and then here's the information that you can put in from the sales data, and then here's some customization for your chart and here how you can update annotation, which is optional, and then the final output. And yes, you can see here like this image is trying to provide something, but it's broken. But the important thing is you actually have the steps on how to do that, and that is all captured here. So you can still leverage Deep seek for the instruction, which should be very quick for you to go into Google Slide, follow the instructions, and create the chart yourself using the sales data. Now, before we move on from this demo, just a couple of troubleshooting tips in case you run into these while working with Deepsek on this particular use case. So let's say if the slides are too text heavy, what you can do is simply use something like the following and add it to your prompt, and you can say something like use five bullet points max per slide with visuals. So this is going to help you fix that issue. The other thing is, let's say the tone is just too casual, and you want this for senior leadership or c. So in this case, you could add something like this to your prompt and say, use formal business language suited best for sea level executives. So this is another way you can restructure and specify the tone you want to be used for the content of your presentation slides. You have just learned how to automate the TDS 20% of reporting to focus on strategic 80%. Next time, your slides write themselves while you analyze the data. Now for the next exercise, I want you to convert the customer survey data into a five slide PPT outline. Now, it's up to you whether you want to use real data from some place on the Internet or if you want to just make up some sample data like I did in the previous demo and use that yourself. 20. Bias and Responsible AI: AI isn't neutral. It mirrors our data and choices. In this lecture, you'll learn how to audit deep Seek outputs for bias, combat misinformation and deploy AI ethically, because good business is responsible business. Ethical failures aren't just a PR disaster. They erode trust, invite regulation, and hurt real people. Let's ensure your AI initiatives avoid these pitfalls. Bias isn't always intentional. A medical AI trained on Western data might misdiagnose agent patients. Vigilance is key here. In 2023, a fake AI generated image of an explosion near the Pentagon crashed stock markets. Your AI could be next. Deep C isn't perfect, but its architecture rejects explicitly harmful requests. Yet subtle biases, that's your job to catch. All right, in this next demo, we're going to be auditing for bias and misinformation. So the goal here is to test Deep Seeks responses and implement ethical safeguards. So for the first one, let's go through a couple of examples. First example, let's see if we can detect gender bias in hiring. So what I would like you to do is simply put a very simple prompt here. So, for example, generate ten software engineer job descriptions. So I want you to run this, and let's see what Deepsk comes up with. And while it's working on this, if you're following along with this demo, I want you to sort of go through these ten different software engineer jobs and see go make your checklist for yourself, like audit checklist, if you will. So I want you to go through all of this, read through it. And then count the masculine coded words. So for example, competitive or dominant versus neutral terms. Okay? You can also check if requirements such as ten plus years examples are disproportionally exclude women. So another thing to look for. And then what other tool that you can use is a gender decoder. So I have that over here. If you simply navigate to this address or URL, it loads this here, and then you can paste your um text, and this is a very simple tool for finding subtle bias in job ads. So it was made purposely for this, and it's not perfect, but just something that you can try just to see if you can detect biases. And I want you to go through all of this and sort of make that go through the data, see what you can find here. And that should speak to sort of the bias that's in the training data for Deep seek. Um, and one thing you can do, for example, to help with this is you can adjust your prompt to a certain extent. So if the training data, it's really important to understand this. Deep Seek generates responses and learns from the training data. If the training data is biased, there's not much you can do from urine, then the training data itself has to be fixed, okay? But sometimes you may get results even with the right training data, you may not get the right results, and this is where you can actually revise your proms. So for example, in this case, you could say something like the following where it says, use gender neutral language and flexible experience ranges. Assuming you notice in the previous ten job descriptions, you noticed these things are actually an issue and gaps that haven't been covered. Now, let's go through something a little bit different. And here we want to fact check AI hallucinations. So sometimes AI tools like JATGPT, DPC, Gemini, and so on, give, like, really weird results. And this is referred to hallucinations where, like, things that are non existent or incorrect facts and information are being provided. And this is something you can also check yourself and something to keep an eye out when you're going through the data. This is why copy pasting deep Seeks output is not recommended. You always have to fact check anything that's presented by AI and generated by AI. So here, let's do something like the following as an example. So we can ask Deepsk to provide statistics on COVID 19 vaccination rates in Africa. So when you run this, you can and again, here, you can hit the search button to get the data if you like. So when you run this, let's see what DVC comes up with. But potentially what you could do is as part of the verification process, you can cross check with who, which is the World Health Organization. You can cross check the results with whose latest reports, so you can actually go to their website, download it and cross reference that report, which is the actual results versus Deep Seeks response to make sure things line up and they're correct. You can note discrepancies across different percentages, and then you can sort of add some guardrails in your prom, such as you could say something such as site, sources from who after 2023. And this forces and reiterates the fact that Deepsak should go and look for the latest data. Let's do one more example. And here we want to mitigate cultural biases. So let's use a simple prompt that says, write a marketing email for skincare products in Nigeria. Now, if you run this prompt, I want you to go through the results, but something I want you to keep an eye out is bias check. So here's some things or questions to ask yourself. Does it assume light skin is ideal? Are local ingredients or concerns addressed, such as humidity. And this is where you can actually adjust the prompt to get better, less biased results to something like focus on diverse skin tones and climate specific benefits if you see that those things are being surfaced and sort of like the gaps that you're noticing in the responses. Now, here's some troubleshooting tips in case they do come up, and I'm not saying they will, but if you notice these things in the response, some ethical issues. So for example, let's say Deep Seek generates harmful stereotypes, which again, I'm not saying it will, but if you notice that you could sort of use moderation APIs to block toxic output depending on what happens. And the other thing is, let's say, for example, another scenario is where users exploit AI for misinformation, and this is where you can add disclaimers, such as verify with trusted sources and log suspicious queries. Ethical AI isn't a one time fix. It's a culture. Build it into your workflows or risk building harm. Now it's your turn to experiment. And for this exercise, I would like you to audit this AI generated loan approval criteria for bias and suggest three fixes. 21. Transformers: In this lecture, we're going to cover transformers, which are the brains behind AI. Transformers revolutionize AI, powering everything from ChaEPT to deep seek to gemini. In this lecture, you'll learn how they work without complex math. By the end, you'll see why this architecture is a secret sauce of modern AI. All AI models read like toddlers, one word at a time. Transformers read like PhDs, connecting ideas across pages. So let's peek underneath the hood. Imagine editing a document with teammates. One highlights key points, which are the attention, another drafts, which is the encoder, and a third polishes, which is the decoder. Transformers work similarly, but at lightning speed. Transformers get smarter, not slower with more data. That's why Deep C can debug code and write poems. It's got layers on layers of context aware neurons. Think of parameters as brain cells and layers as brain regions. Deeps isn't just big, it's organized with specialized layers for coding, math and creative tasks. Okay, so for this demo, we're going to take a look at visualizing attention. And the objective here is to see how transformers focus on keywords using a simplified example. Now, for the input, we're going to use the following sample text, which is the cat sat on the mat because it was tired. And here, what we're really looking for is the attention for the word it, and we want to see how the highest scores for cat and the MT are going to look like. And what we want to see as well, is the transformer and see if it's able to look at its interpretation and see if the model correctly links the word I to CAT and not to the word Matt, which shows us the contextual understanding. So first thing we want to do is, let's go ahead and create our project. So I'm going to open Visual Studio code in my folder, and let's go ahead and create a new Python file. And I'm going to save this and name this attention underscore demo dot p. Okay, let's go ahead and save this. And I'm going to paste the following code, and don't worry I will provide this and we'll go through this in a second. And what we're going to do is we're going to install the dependencies. We're going to run the program, and we're going to take a look at the results. But before we do that, I'd like to spend a few minutes looking at this code and walk it through block by block and explain what the code is actually doing. Alright, first, let's start with the imports over here. So we have torch, and this is Pi torch's core library for tensor operations and model execution. Next, we have the bird tokenizer and bird model, and this is from the hugging faces Transformers and it handles bird tokenization and loads the pre trained bird model. And then we got the MPPlot library, and this is the standard plotting library in Python. It's used here to draw a simple bar chart of attention scores. Now, let's move over to the input here. And this line over here, this is simply the input sentence, and it stores the example sentence whose attention patterns we want to inspect. Now, let's move on to loading the model and the tokenizer. So over here, this line, this is when you look at the pre trained birth based case, this simply downloads or it loads from the cache, depending whether you've downloaded this previously or not. It downloads or loads from the cache, the birth base cased weights and vocabulary. If you look at the output, attention equal true, this tells the model to return attention matrices for every layer and head alongside the usual last hidden states. And the last line here, model dot Eval, this switches the model to inference mode and it disables dropout. All right, let's move on to this block of code over here. So looking at the inputs, the tokenizer method over here, this splits the sentence into word piece tokens, maps them to IDs, and returns Pi torch tensors shaped. Now, looking at the torch graph over here, this method, this wraps the forward pass to avoid building a computation graph, which basically saves memory since we won't back propagate. Looking at the model here, this simply runs birth and it produces the last hidden state, which technically is not used here. And for the attentions, it's a topple of length 12, one per layer. Each of the shape patch, heads equal 12 sequence and sequence. And over here, for the attention, this is where we extract attentions for later analysis. Right, let's move on to this block of code here. And over here, the function convert IDs to tokens. This turns numeric token IDs back into string tokens. And over here for the index, the one that you see here, is this finds the position of the tokens it, cat and mat in the token sequence. Now, looking at this block of code over here, what it does is it initializes a record best to track which layer and head gives the highest attention from it to CAT. And then it loops through each layer's attention tensor, then each head with that layer. And over here, the head attention with the it IDX and IDX, it extracts the scalar attention weight from the word it position to the CAT position. So the it position is the query, and the CAT position is the key here. And then it updates best whenever we find a larger score. Okay, over here looking at this block, this simply picks out the two D attention matrix for our chosen layer and head, and then it converts it into a numPi array for easy indexing. Now, we need to this is where we actually prepare and plot the comparison scores. So looking at this block, this builds a small list of two scores. So the first one is attention from it to cat and the second one is attention from it to the word Mt. And then it plots them side by side in a bar chart, labeling axis and giving a title that notes the layer and head, adding one to convert from zero base to human friendly numbering. And the last block over here, this is simply where it writes the two attention weights to the console formatted to two decimal places for quick numeric comparison. Now, bringing it all together, the goal of this Python script and demo is to see which word, in this case, the word cat versus Matt, the pronoun it attends to the most, and in which heads and layers, this is most salient. And the pipeline simply looks like this. First, we load the sentence two, we tokenize and model forward pass. Three, we inspect attention tensors, four, we identify the strongest, so it to cat, and then the it to cat link, and then five, we compare the it to mat in the same head, and then we visualize and print the results. Alright, now that we have covered what the code is doing, let's actually go ahead and run it, and let's take a look at the results together. So first step we want to do is let's go ahead and open a new terminal over here. And before we install any dependencies as part of good practice, let's go ahead and create a virtual environment, and you can simply do this via the following commands. So Python, and then VN and then this is where you can name it whatever you want for the virtual environment folder. I'm just going to call it VN again. And let's go ahead and run this, and this is going to create that virtual environment. And over here in Visual Studio code, we noticed a new environment has been created. Do you want to select it for your workspace folder? Yes. And this is going to set it up for us automatically, which is nice. Now, the virtual environment has been created. However, note that it's not yet activated. So what we're going to do is activate that new virtual environment that we just created. So you can simply do this in a very easy way. There's a scripts folder, and then inside the scripts folder, there's an activated script that we can run, and we can just do it from here. So go ahead and type in dot slash in the terminal. And then tab. This is going to actually, we're going to go back, and then we want to do dot there we go. So just double tap a couple of times, and this is going to just give you that folder. So I'm using Windows, so it's dotbslash VM, the name of the Virtual Environment. Then type in S scripts, but you don't have to type the whole thing. You can just tab it and then type in Activate and then go ahead and press Enter, and this is going to run that batch file, and then it's going to activate your environment. And again, if you want to see before you get started, if you want to see what version of Python you're using, you can just simply type in Python, go back and then do that version. H dash version, and then this is going to show you the version of Python. This over here, this green is denoting that our virtual environment is actually activated and we're within that context. Anything we do is within the context of that virtual environment. So let's go ahead and actually install our dependencies. Now, if you look at the imports over here, we've got torch, we got transformers and we got the MAD plotlibrary. We got to install the dependencies for those, and the command to do that is PIP Install torch transformers and the MAT Plot library. Let's go ahead and run this. Now, this installation is going to take some time, so I'm going to pause the video and once it's done, we'll come back. So see you in a second. The installation has finished successfully, and now let's go ahead and run this Python script. And technically, what this should do if everything goes according to plan, is that it should download the bird model on the first run and then compute the attentions, pop up a bar chart, and then print the two attention scores in the terminal once we close the Barhart. So first thing, let's make sure our script is safe with the latest changes. And we simply in the same terminal, we can run the command, Python, and then space, and then the name of the file, which is attention. Again, you don't have to type the whole thing. Tab it and it will auto complete it for you and then press Enter, and this should now start running our program. Again, this may take some time, depending whether this is the first time you're actually running if it is, then it will download the bird models. For me, it's not. So it's loading it from cache. And as you can see over here, it pops up this visualization, this bar chart. And this is exactly from the top here, this Matt plot library. This is the library that helps us visualize this. So over here, you can see that the bar chart is actually doing is actually presenting the results correctly. Because remember, we're looking at the attention of the word it, right? Going back to the original sentence, the cat sat on the mat because it was tired. And we're trying to see if the model understands what the word it is referring to. Is it referring to the word cat or is it referring to the word mat? And you can see over here, the score for CAT is pretty high, and the score format is pretty low, telling us that it's understanding, the model is understanding what the word is referring to. So it shows contextual understanding. And over here, you can see visually it's about 80% on this side, and it's a little bit over zero. So it's between 0.1, very low and one thing you can do is if you want to see the numerical numbers, because we are also logging this to the results into console log, if you close this, you'll be able to see the attention scores inside the console logs over here. As soon as you close, you see attention from it. The word cat has 83% and the word mat has 1%. So you can see it definitely was able to understand that the word it was referring to the word cat because the attention score for this is a lot higher than the word MT. You don't need to build transformers, leverage them. Knowing they focus on CAT over Mat helps you debug and improve AI outputs. Now, for this practical exercise, what I would like you to do is run the demo with a sentence of your choice. Reflect on which words the model focused on and why. 22. Fine Tune DeepSeek: In this lecture, you'll transform Deep seek into a domain expert, whether for medical diagnosis, legal contracts or game dialogue. No PhD is required. Generic AI is like a general practitioner. Fin tuning it makes it a neurosurgeon, precise, reliable, and hyper focused on your needs. We're going to use a medical FAQ use case today, but the principles apply to any domain. So let's prep our dataset. Now, for this lecture, we're not going to go through the entire demo here because this is very similar to the demo that we did earlier in the course where we trained our chatbot on support data. Instead, I wanted to present this and create an opportunity for you to go back and practice this and apply it to a different domain. So here, our domain is going to be a medical FAQ fine tuning practice. So for step one, we need a dataset. So what you need to do is prepare your dataset with some sample data. Now again, you can name your file anything you like. Here's an example. You can name your CSV file medical underscore fqs dot CSV. And this is going to be your data file that you're going to use to train and fine tune your AI model. Now, you can manually create this, and over here you can see that I have some sample data. We have two columns, prompt and response, and we have a few rows with, again, some sample populated data. Now, the more data you have, the better it is to train your model. The more accurate it's going to be, the more precise it's going to be and the better it's going to learn the contacts. So my recommendation is generate at least 50 to 100 rows in the CSV file, the more the better. However, generating this manually could be very time consuming. Of course, you can do it. But given the amount of value and RI you're going to get, I highly recommend that you use an AI tool such as Deepsk or Chat GPT to create this dataset. So, for example, you can give it a prompt, give it the context, and then give it the prompt to create a CSV file for you. With this many rows and this many rows, and it will create some sample data for you, which then you can copy paste directly into your CSV. And that would take a few seconds versus doing it yourself could take several hours. Now, once we have our CSV file, we want to move to step two. And step two is simply upload that CSV and train your model. And this is exactly the same steps and processes as we went through in our previous demo, where we use support data in the CSV file to train the model that will be used for a chatbot to handle support requests. And step three, this is where after the training is completed, this is where we want to compare the results from the base model versus the fine tune model. So, of course, you can use any prompt that you like that is relevant to the domain that you are testing this with. Here, again, we're using a medical FAQ. So this is one sample prompt that I used, and this basically says, what's the treatment for sprained ankle? Of course, if you use this exact same prompt, the output you're going to get is most likely going to be different than what I got. So over here, I'm just sharing this just as an example. When I use this prompt, I got the base models output to be this, what you see here, and then I also posted the fine tune model output for the same prompt. And you can clearly see this one is more precise and it has more information. And if you compare these to the base model output versus the Fine Tune, you can see some key improvements in the Fine Tune model. For instance, the specific timing and dosage advice and the clear escalation step after 72 hours. It's really important to focus on quality over quantity. So think of your dataset as a textbook for deep Sk. Clear examples equal faster learning. After you complete this demo, you just built a medical expert AI for pennies. Imagine doing this for your niche. For example, legal boots, HR assistants, game NPCs, and so on. The future is best book. Once you go through this demo and experiment, I want you to go through the following practical exercise and create a ten example dataset for your niche. Again, the more the better. But here, we're looking at an HR policy FAQ, so the demo was medical. This is HR, so different domain, and then I would like you to self reflect and review your training results once you finish going through this exercise. 23. AWS Lambda: In this lecture, you'll deploy a deep seek powered API endpoint that handles requests automatically with zero servers to manage and payer use pricing. Let's turn your custom model into a scalable service. Lambda is like a robot workforce. They appear when you need them, they work fast, and they vanish when it's done. Perfect for sporadic AI tasks. This setup costs pennies and survives viral traffic. No server overload errors, and it's infinitely scalable. What we'll do is we'll take a simple Python script and we'll make it globally accessible. So watch closely you're going to do this yourself. In this demo, you're going to learn how to set up an AWS account under the free tier. Create and configure a Python based AWS LambdoFunction that uses the Deep Ck API to summarize text and expose it via Amazon API gateway. Now, this process involves several steps. First, we're going to create an AWS account ensuring the free tier eligibility. Then we're going to talk about installing the required local tools such as Python and so on and how to set up the IM roles and permissions. Then we're going to look at writing the Lambda function in Python, then sends text to Deepsk chat API and returns a summary we will learn how to package dependencies such as requests to make APIs in Python into a ZIP deployment package, and we're going to create the Lambda function and attach the necessary IAM roles, and then we're going to configure an HTTP API endpoint using the API gateway to invoke the Lambda. And of course, at the end, we're going to test that endpoint using the u application called Postman that you might be familiar with. Now, this solution leverages the AWS free tier. So I just created an account for the purposes of this demo. You get a lot of requests for the first 12 month for free, so there's no reason for you to spend any money on this at least when you're trying this demo, because the Lambda, you get 1 million requests and 400 gigabyte/second per month for free, and the API gateway, you get 1 million calls per month for 12 months. And that will keep the cost at zero, provided that you stay within that limit. So let's get started and go through the setup. The first thing we want to do is we want to make sure that we have Python setup, and really depends on the time which you are looking at this lecture. So as of the time of this recording, the latest version is Python 3.13, and also AWS only supports up to 3.13 at this point in time. However, in a few months time, both Python and the AWS support for Python will be to a newer version. So just install the latest and what's supported in AWS. As of right now, I have Python 3.13 installed on my computer. Now, you also need an IDE for your coding, and you can use whatever you like. I'm using Visual Studio code. You also need Postman, which is an app free application that you can use to make API calls to a specific endpoint. And of course, we will need to create AWS account and we'll be creating brand new account and we'll be using the free tier. So first, let's proceed with creating the free AWS account, and all you need to do is really just go to Google and type in AWS Free Tier. So AWS free tier over here, and then you can see it's the first one first option here. So free Cloud computing services, AWS Free Tier. If you click on it, you're going to be presented with this page, and then it says AWS Free Tier and then gain free hands on experience with AWS products and services. And then what I would like you to do is click on Create a free account. It's going to ask you some questions, get some information like email, create a password and things like that, the address. It's also going to ask for credit card or a debit card information. However, it will not charge you because this is the free tier. And they're just going to ask you for that information, but they won't be charging you as long as you stay within the limits that are described as part of the terms and conditions for the free tier. And of course, you can take a look at that and all of that information is going to be provided on this page here, under the AWS Free Tier documentation. So go ahead and click on Create Free account and follow the instructions. And when you are presented with the option, you want to use the basic free tier account option. And this is what it looks like. I have already created an account, so I just took a screenshot while I was creating that account to show you. And when you put in your information, it is going to present you with a page similar to this. So there are currently three available plans for the AWS, and there's Basic, there's developer, and there's business. You simply just need to click on Basic support, which is free. And this comes with, you know, new users getting started with AWS. And if you're just learning something, this is perfect. So I would like you to select this click on complete signup. And once everything goes once you finish going through the wizard and all the instructions, yeah, you should see a congratulation method, page, excuse me, congratulation page. And it's saying, thank you for signing up with AWS. And over here, you will see an option that says, go to the AWS Management Console. And when you click on that Console homepage, this is this is the page that you should be presented with or something similar along these lines. And this is the AWS Console Management homepage. And we'll be going through different services starting with this page. Just a couple of things to notice over here, the default regions are already set. So we got US East one, US East two, US West one, USS two, mine was set to US East two. So I just left it there. That's fine for the free tier. And you can just go ahead and use that. And over here, you can see that it is saying that the selected region is US Es too, and that's the current default selection. Now, for our next step, what we want to do is create an IAM user and roll for our Lambda, and our Lambda function is basically where we will be deploying our code that we want to execute and invoke. So before that, though, we need to create the IAM user and the role. So over here, there are several ways you can actually do that. You can click on search and search for IAM, or you can simply click this button over here. These are some of the recently visited. If you have a brand new account, some of these will be empty. And as you go through and view more services this menu gets populated with some of that recent activity. But if it's your first time, again, you can go into search and you can type in IAM here or you can go over here. You can click on security identity and compliance. And over here, you see a bunch of stuff. You see IAM and you see IAM Identity center. What we want to do is click on IAM and this is where you can manage access to AWS resources. So go ahead and click. Now, we are on the default IAM page, and there's several things you can do here, create user groups, user roles, policies, and all this stuff. But we're going to keep it simple, and we're only going to do the minimum setup for what we need for this demo. So right now, first thing we want to do is we want to create a user, and then we want to create a role. So let's go ahead and click on users. And again, depending on whether you have a brand new account or not, these things could differ for you. If it's a brand new account, you won't see anything. If you've already been experimenting with this, you'll see some stuff. Have a couple of tests once here. But regardless, we're going to do this from scratch and create a brand new user. And in order to do that, on the right hand side here, you need to click on Create User. So go ahead and click that, and now you're presented with this specify user detail dialog. Okay, so what I'm going to you can name this anything it's arbitrary. I'm going to name this Lambda. Admin. And over here, this is important because you want to provide the user access to the AWS Management Console. You could do this or you can basically go to the IAM Identity Center and handle things from there. But what I'm going to do is I do want to provide user access for this user to the AWS Management Console. So I'm going to select this. And then over here, it says, there's two options. There's specified user in Identity Center. And you can just do it here. So what I'm going to do is I'm going to choose to do that here. So I want to create an IAM user. And then it says we recommend that you create an IAM users only if you need to enable programmatic access through access keys, surface specific credentials, and so on. So I'm just going to select that, and then this is going to create a user. You can create a custom password for that user because essentially you can login into the AWS Console. And manage using that user. But I'm just going to leave it to auto generated password. Of course, don't share that with anyone. And then it says user must create a new password at the next sign in, and I'm going to uncheck that. So whatever this autogenerated password is going to be, it's going to stay there. And it's not going to once you login for the first time, it's not going to ask you to create a brand new password. So these are the settings, and I'm going to click next. I'm going to leave everything as default here, so I add user to a group. There's copy permissions. There's attached policy directly, so I'm going to leave everything here, and then the permission boundary optional is already check. So again, I'm leaving everything as default. I'm not going to change anything, and I'm going to click next. This is one last step before the creation is just a summary and review of what you're about to create. So again, user name, the password is going to be auto generated, no required password reset at the first login. Tags are optional and permission summary, I haven't really attached anything to these, so I'm going to leave them, and I'm going to click on Create User. And this is going to create our user. And over here, you can see that there's a green toast notification saying the operation was successful and the user was created. These are very important because over here, you can see the console signing URL. So if you're planning to log in with this user into the console, this is the login URL that you can save. This is the username, and then this is the password. So again, you want to write this somewhere or record this somewhere, so you got your username and you got your password. If you click on Show, it will show your password or you can simply click Copy and then save it in sort of a secure password manager. So but do not share this with anybody because anybody who has user name and password can log into your account and make changes. So as of right now, we have successfully created our users. And of course, you can also download this information so that you don't lose it by clicking the download dot CSV file over here. And if you simply click it, that's going to download the credentials, and then you can open that and have access to those at a later date if you like. Next, we need to create the IM roll for the Lambda. So over here, you can click on Return to user list, and right now you can see that our user Lamb Do admin has been created successfully. And if we scroll to the right a little bit, you can see that the console access is enabled. So role, this user has permission. Now, next thing is on the left hand side, you see there is a button called rolls. So let's go ahead and click that. Next on the top right hand side here, there's a button called Create Roll. So what we want to do is we want to click that. And then over here, it's asking you or it's giving you several options like AWS service, sample two, AWS account, web identity, and so on. So we need this for Lambda, and Lambda is AWS service. So we're going to leave it there. And then it's going to ask us for service to choose a service or use case. And in this case, we're going to select Lambda and we're going to click Next. Here is where we need to select a permission for this. And what we want to do is we want to attach the managed policy that's called AWSaMDA basic execution rule, which also allows for things like Cloud watch logging. So over here, there's a long list, but you can simply just search for it, and all you need to do is type in AWS and then Lamda Basic, and then this is the one here, AWS Lambdo Basic execution Role. It's AWS managed, and it says over here, the description provides write permissions to CloudWatch. So go ahead and select this and then click Next. Now we just have to give this role a name. And again, in the role name field, I'm just going to put something. You can put whatever you like. I'm putting Deep seek Lamb Da role for the purposes of this demo. And then here's a default description. You can change this that's more descriptive for your use case and something that when you read makes sense to you. I'm just leaving the default here. And then for the tags, the permissions, it's already attached with the AWS lamb, the basic execution role, which we just did. And then for the tags, I'm going to leave it as is, and I'm not going to add any new tags. And then I'm going to click on Create Role. Okay. So now you can see that over here, we have a green toast notification and it says Roll DeepC Lambda role was created successfully. Next, let's go ahead and write the Lambda function in Python. Here, we will create a Python function named Lamdnderscore function dot pi with an AWS Lambda handler named Lambda handler. And this function simply is going to parse the incoming HGTV request from API Gateway with the JSON body containing text. Next, it's going to send the text to Deep Seeks chat API via the HTTP post, and then it's going to return Deep Seeks summary as JSON response. So what we need to do this part is important, so please pay attention to the project structure and how you need to set this up locally. So first thing I'm going to do is I'm going to create a new folder and I'm going to name this Deep Seek Lambda demo. Next, I'm going to go in the folder, and here I'm going to open Visual Studio code using Command Prompt. And what I'm going to do is I'm going to create a couple of files with this being a root working directory. So the first file is going to be a file, a Python file. So I'm going to name this. Let's click Python. Let's go ahead and save, and I'm going to name this Lam let's say, underscore functions. The Pi. So this is our Lambda function Pi, so let's go ahead and create that. And I'm going to paste the following code, and I will provide this code for you. But essentially, it does what we just described a few seconds ago. And next, what we're going to do is we're going to create a file, just a simple text file called requirements dot TxD. So over here, I'm just going to go file new text file. And let me save this first as requirements dot TXT. And then what we want to put inside this textfile is just request. And this is essentially the request library for Python, which we need to package as a dependency, which is coming up in a few minutes. Alright, so Lamda doesn't really have a concept of third party libraries. So for instance, here we're using the request request library, which is a library in Python that enables us to make API calls or HTTP requests, but we will not be able to install that on the AWS side. So what we need to do is we need to there's several days there's several ways to deploy Lambda. One of them is that you can get things ready and package them as a zip, and then you can upload them and deploy. However, any dependency or third party library needs to be provided previously. And this is exactly what we need to do here because again, Lambda is just a function. It doesn't understand what requests is. So we need to install that dependency first, then package it, zip it, and then we can deploy that in AWS into our Lambda. So right now, the way this our current working directory looks like for our project is this. So let's go ahead and open the terminal. And right now the current working directory is deepsk Lambda Tempo, which is correct. And inside here, we have two files. You can even see that from the Solution Explorer. We have Lambda underscore function dot pi, and we have their requirements dot text. So this is our directory, and inside these directories, there are two files. First thing we want to do is create a folder named package, and this is where PIP will install our dependencies. So you can either go back and do that through Windows and create a new directory, or you can just do it from the Power Shell prompt here. So you can just simply do MKD which is short for directory and then package. Now, this created a new folder over here package, and again, you can see that over here in the Solution Explorer as well. So now, this is our main directory or parent directory. We got two files, and now we got a folder, but this folder currently has nothing in it. You can also check that the directory exists, and you can just confirm that by simply running this PowerShell command, which is G and then dash, and then you can just type in child item or you can just put type the first couple of letters and then tab it, and then you can see it will auto complete it for you. So get child and then if you click that, it'll show you that within this folder here, deepskamd demo, we have three items. We got the package folder or directory, we got the Lambda function, Python file, and we got the requirement dot text. So this is a quick way of just verifying that the action you just performed, in this case, creating a new directory was successful. Now what we need to do is run the PIP install to fetch the pure Python wheel for requests and its dependencies. And the way we're going to do that is via the following command. So PIP install requests minus T and then the folder package. So the PIP Install request tells PIP to fetch the latest request package from the Pi Pi, which is the main repository of the library and then the dt dot slash PackagSAS instructs PIP to install requSt and all of its dependencies into that package directory. And because request and its dependencies are all pure Python, Windows Pip will download and install Windows wheels, but those wheels work on Lambda since there's no compiled C code. So let's go ahead and run this command. And over here, it's asking you if you want to create the Python packages for the virtual environment. So let's go ahead and say, I'm going to select 3.13 0.3, which is the latest, and you can just select Okay, and this is going to create that. All right, so the installation is complete, so you can simply verify the content of the package folder by just doing get child item and then space the package folder. And over here, you should see something similar to this. You got the bin folder, the certifications, and all of these requests and libraries. Next, we want to copy the Lamb Do function Python file into package. And again, if you're uncomfortable with using the PowerShell or command prompt, you can do it through the UI on Windows by just copy basing that file into the directory into package folder. But again, you can just do it here and it's not that difficult. So you can use copy item and then space, and then the name of the file. So in this case, we are Lambda function. And then again, use tab to autocomplete space destination. And then space folder package here. So go ahead and run that. And then what you can do is run that get child item again in the package folder. And now you can see that you see everything that you used to see, but now we have copied the Lambda function Pi in the package folder as well. Alright, now we need to create the ZIP deployment package. So Lambda requires that all files and folders sit at the root of the Zip with no extra parent folder. And in order to achieve that first, we want to right now we're in this directory here, the DeepCKlamda demo, we need to go inside the package directory. So let's go ahead and do change directory package. And now we are inside the package folder. Then here we want to run the power Shells compress archive to zip everything into a ZIP file in the project root. And the way we're going to do that is using this command here. So we got Compress Archive and then Path star destination path, and then the name of the ZIP, which is deployment package dot ZIP. So the path the Dash Path star, this means include all files and directories on their package. Then the destination path and then the name of the ZIP file, this creates the Zip one level up in the Deep Sea lamda demo directory. So let's go ahead and run this, and this is going to take just a few seconds to complete. So now that the compression is done, let's go ahead and quickly verify and go back to the project root and confirm that the zip file exists. So you can simply do that by C dot dot, change directory. And right now we went back one level up. So now we're no longer in the package folder. We're back on the Dec Clam the demo directory. And again, you can just get child item. And here you can see that we have deployment package dot zip and this tells us that the operation was successful. All right, now we have to create our Lambda function. And the way you can do that is simply, again, you can go back to the homepage or you can click on this. And depending on, you know, whether you've viewed it or not, in the past, you can simply just type in Lambda here or you can look at it from the settings menu. But over here, you can just simply type in Lambda, and then on their services, you'll see that there is Lambda service option here. So let's go ahead and click that, and this is going to take us to the homepage for creating Lambdas. First thing we want to do is on the right top hand corner, we want to click on Create function. So go ahead and click that. And here, we're going to have to give it a name. So, for example, I'm just going to name this Deep C Glamda. But you can give it any name that you like. And then for the run time, by default, no JS 22 point x is selected. However, our Lambda is written in Python, so I'm going to select Python 3.13. And again, there are different technologies and libraries that you can use frameworks. I wrote mine in Python. You can write your Lambda in different languages over here. But again, I'm selecting Python 3.13 because that's the version I have currently. And then we have our name. We have our runtime. Next, we have to change the default execution role for our Lambda function. So when you click here, there's several options. But if you remember, previously, we created a role for our Lambda in IAM settings. So over here, you can create a new role with basic Lambda permissions, but I'm going to use an existing role. And if you click that, it provides you with the existing role drop down. And if you click this, you will see the Deep seek Lambda role, which is previously what we created under the role section of AWS services. Go ahead and select that. And then for additional configuration, I'm not touching this. I'm just leaving everything as default for the purposes of this demo. So again, just doing a quick review. So author from scratch for creating our Lambda function, you'll be given a name. The runtime language we're using is Python 3.13. You can leave the architecture as is. And then selecting the existing role that I created previously, which is Deep C lambda role, and then I'm going to go ahead and click Create function. Right, so you can see over here we have a green toast notification saying successfully created the function Deep C lambda. We have a lot of options here. But essentially what we want to do is, again, here's some default, here's some default code. We don't really need this. This is just by default, whatever's here. What we're going to do is we're going to have to upload from our zip file. And the way you do that is you're going to click Upload from and then select the dot zip file. All right, now we have to select the zip file from our local directory. So here, I'm going to go to where we originally created that. So the deeps lambda Demo folder, if you go in here, you can see that we have our deployment dash package, the Zip file. So go ahead and select that, and then you can go ahead and click Save. And this is going to automatically load the Lambda with the source code that we have there. And you can see here that the Lambda function the Pi has now loaded with the correct code that we had originally written as part of our project. After loading the zip file and populating the Lambda function with the proper Python code, what we want to do is select Deploy. We want to deploy this lambda. So let's go ahead and click that. And it seems like that the Lambda by default has already been deployed because it says there are no changes to deploy here. Now, if you look at the code here, you'll see that we also need a deep Seek API deep Seek API key because at the end of the day, what we're trying to do here is we're deploying Lambda, we're deploying an application, which is simply a program that takes in a text and makes a call to Deep Seek, has Deep Seek summarize that text, and then it shows us the results. But in order to do that, we have to actually make the API call to Deep Seek, and the prerequisite for that is we need to have our API key. So this is something that we could put here directly in code, but it's never ever recommended that you hardcode API keys in the code and have those checked into the repository. It's not best practices, and they should always be included as part of things such as environment variable and either in a tool that is properly managed or for secrets, or you can have it in the CI as part of the environment variables. So this is what we need to do next. We need to configure the deep Sk API key as the environment variable. And again, just to recap, we've already covered how to do that in previous lectures, but if you go to Deepsk Deepsks website, on the top right hand corner here, you have API, and if you click that, this is where it's going to show you the usage. You first need to go to top up. You need to put some money there because Deepsek API is not free, unfortunately, but it doesn't cost a lot of money. You can just starts with $2, it's more than enough, and you're not going to use more than a few pennies as part of this demo. But this is how you actually do that. And then if you go to usage, you'll be able to see the requests that are being made. So, for example, if I hover over this, right now, before this demo, there are currently four API requests. And if I go over here, this is showing me the number, how much I've used up to this point, which is less than $0.01. And over here, it shows me the number of tokens used. So in here in total, 430 tokens for the day. But just something for you to keep an eye out and do a before and after comparison, right now, the API request is four, and then once you make several calls, deeps can come back and check to see if the number has increased. And again, if you wanted to create your API keys, you would go to API keys here and you would create a new API key. I already have mine ready to go, so I'm not going to create a new one. Now let's switch back and configure our environment variable under configuration. So over here, there are multiple tabs. We got code test monitor configuration aliases and virgins. We're going to click on configuration. And when you do that on the left navigation bar, you see an option called environment variables. So let's go ahead and select that, and then we're going to click on either Edit here or here, it says no environment variable. So let's go ahead and click Ed then it says add environment variable. The key is going to be deep Syk API key, which is what we saw earlier in the code. And then the value here, this is going to be your actual API key. So you can go ahead and copy paste that over here, which I'm going to do. And again, do not share this value. I'm just using this for the purposes of this demo and I'll be deleting it, so there's no access to that, but you have to paste in your own key over here, and then go ahead and click Safe. The next thing we want to do is we want to test our Lambda to make sure everything is working fine, and we can do that by using the test pattern in the console or by sending an HTTP request through an API gateway. But for now, we'll just use we'll just use the built in test feature here. So on this tab, click on Test, and the way you can use Test is by creating a new event. So here, I'm just going to give it a name called Deep Seek Lamb test event one without any spaces. And we'll leave this as private. Template hello world is fine. And here's an event JS on. So let's go ahead and test this and see what happens. Okay, so the execution went fine. So we got green, we got execution function succeeded. If you look at the details, it says that the status quote was actually 400, which is not found, and the body is throwing an error saying missing text property in the request body. So let's take a look to see what's going on here. This error simply indicates that our Lambda Lambda handler is not finding a text field inside the event body. And in the AWS Lambda consoles test dialog, we have to supply a valid JSON, which is this part over here, and we have to provide a valid JSON object that matches what our Lambda is expecting, specifically an object with a body key whose value is a stringified JSON containing the key text. In order to fix this, you can simply select and replace this code with something like the following. So I'm going to provide a valid body, and in the body, I'm going to make sure that I have the attribute text. And the text itself doesn't really matter. This is just arbitrary. You can put in AWS Lambda lets you run code without provisioning servers. Really, again, this is just testing. We're not we haven't gotten to a point where we actually testing the entire application end to end, which is summarizing through Deepsk. This is just testing the Lambda itself. Over here, this is a very neat feature. You can just click on Format JSON. This is going to make everything correct. Now what you can do is simply click Save, and then you can go ahead and click text again, and this is going to execute the Lambda function again. Now, we fixed the event JSON, but the execution function failed. So if we click on details, this is saying that it says sandbox that time out, and then there's some request ID here, but the error message is task timed out after 3 seconds. So let's take a look and see why this is being caused. Here, our Lambda function is timing out because AWS's Lambda's default timeout is 3 seconds, and the DeepCKPI call often takes longer than that. So to fix this, what we need to do is increase the functions timeout, and this can be done. We could do this anywhere up to 15 minutes, which is a lot longer than what we actually need for the purposes of this exercise. Optionally, you can adjust the memory CPU to reduce execution time. You can also verify the functions behavior via Cloud watch logs to see where it's spending its time. But what we're going to do is we know 3 seconds is too short, so we're just going to increase that by a little bit to something like 15 seconds or 30 seconds just to ensure that we give deep Seek enough time to process our requests and come back with the result. So this is actually really easy to fix. Let's go ahead and on the configuration tab, click on that. And then here is where we need to find the general configuration. Which is the first option here. And then you can see that there's no description. The timeout is zero minute to 3 seconds. And this is where we can click on Edit, and then we want to simply, let's say, we want to change this from 3 seconds to 30 seconds, and this should be more than enough for what we need because I believe ten to 15 seconds should be good enough. This is just a little bit of buffer in case we need it. So let's change it to 30 seconds, and it will time out after 30 seconds and click on SAFE. Okay, we've saved our timeout. You can see that it's now the new time value is 30 seconds. Now what we can do is go back to the test tab and we can just go ahead and run this again, and it's going to run that test event one more time. It's currently executing. And you can see it's definitely taking more than 3 seconds, right? So now it's finished, and over here, you can see the results. So status code is 200, which means it was succeeded. And the summary here, this is saying that AWS Lambda enables serverless code execution, eliminating the need to manage servers, and then here the key points. Serverless no server provisioning code execution. So you can see that it has summarized those into key points. And again, if we go back to the code, you can see this was or actually, if you go to test, you can see that this is not the same. The body and the text we passed to Deepsk was AWS Lambda. Let's you run code without provisioning servers. And if you look here, this is actually summarizing that it's not the same text. Deepsk has processed that prompt, and it's giving us Lambda enables servers less code execution, eliminating the need for servers, and then here the key points. So it is actually working correctly. Alright, now that we verify our Lambda is working correctly, what we need to do now next is to expose the Lambda via API gateway so external clients can invoke it over HTTP. And here, we can test the endpoint using curl or Postman to confirm end ton functionality, and we can also look at the Cloud watch logs for monitoring and debugging. And yeah, let's get started. First step is we want to create an HDDP API in API Gateway. So let's go ahead and open up the API Gateway library. And the way you can do that is type in API Gateway, and this first option here is build deploy and manage APIs. This is what you want to select. First let's begin by clicking on this button here on the top right hand corner, create API. And then over here, it's going to ask you it's going to present you with a couple of options like HTTP API websocket Rest and Rest API private. We're going to select HTTP API and let's click on Build. Next, it's going to ask for a name, and this is where we simply can give it any name. Again, I'm going to name this Deep Seek test API. And then we can leave the IP address type here, integration. We do want to add integration and choose our Lambda here for our function. So simply click on Add Integration. It's going to ask you sort of the service you want to integrate. We're going to select Lambda. Our region is going to be US Es two, which is what we had initially selected here by default. And then here, we're going to select our Lambda that we created earlier. So let's go ahead and over here, you can see that it's called Deep Sea Cam Da. This is the one that we created earlier. So let's go ahead and select that. Everything else can just remain as is and then you can click Next. We do need to add a route, but we're going to do that later, so I'm just going to continue to click on Next. And then everything I'm going to leave as default, click Next. Again, here's a review on Create and then I'm going to click on Create. Okay, so here you can see the Green Toast notification, and it says successfully created the API, which is called DeepC test API. All right, now we're going to create a new route. So over here, you can do it at this step two. Not a problem. You can just says route and then here we can click on Create. For the N, this is where we want to change this to a post call. And then in the path we will put slash summarize. And this is the one that is going to invoke by calling we're going to use Postman to invoke this endpoint and to actually execute our application and make a call to Deepsek. So go ahead and cli 24. AI Cost: If you're not careful, AI can increase your expenses significantly or make you a hero. In this lecture, you learn how top companies slash AI COS by 70% or more while improving performance. So let's turn you into an AI efficiency Ninja. Now, it's important to understand where your money is being spent. Sometimes a simple chat bot might cost you 12,000 a year if it stays unoptimized. So you need to make sure you look into that and you fix the issues in some of the things that we're going to cover in terms of strategy. It's important to understand the API costs, and of course, some of the ones that are shown here are correct as the time of this recording, but of course, cost will change over time, and it really depends on a variety of factors like the model, the API, the number of requests, and so on. And it's always important to be mindful and aware of the expenses. Sometimes they could be hidden, such as provisioning cloud resources, redundant API calls and unused fine tuned models. You need to make sure that you pick the tool that is right for each specific use case. So over here, you can see there are multiple different strategies you can implement to help you with saving. So for example, if you have repetitive queries and requests such as FAQs that are running behind the chatbd and helping customers, you can save up to 60% by caching somebody's responses so you don't have to keep getting charged for the usage of the AI model. Because it's the same question, so the response wouldn't change. So caching is one strategy. You have to make sure that you're using the right model for the right use case. So if you're able to accomplish a simple task with a smaller model, then use that. Don't use a big model, which is going to cost you more. Batching request is also important. So making sure that you're bulk processing as opposed to single processing in sequence, you want to make sure that you can um process requests in parallel that will help you with savings from anywhere between 30% to 50%. And again, of course, the numbers could differ depending on your use case and a variety of different factors. And another one another example could be the Cold Start medications for several applications such as Lambda. It's important to take those into consideration as well. So some of the Fintech startups, for example, they learned how to cut response times from eight second to 0.5 second by chunking loan applications. So it's important to use this technique where it's applicable and make sure you can process in parallel, making sure that you keep your Lambda functions or severalS services. You can keep them warm by running schedule pins, for instance, or whatever feature they have to keep them warm, so you don't have to wait that additional 8 seconds for things to warm up before the request can actually uh, get processed. Because remember, it may take a Lambda up to ten to 15 seconds just to get warmed up and then another five to 10 seconds for the process for the query to get processed or the code to get executed. And then, of course, you can take advantage of quantization, so reduce the model precision for faster inference, again, where it's applicable. So it's important to keep in mind optimization isn't about cheaping out. It's about spending money smart. So I would like you to take these things when you are planning on automating things responsibly. So Smart AI is scalable AI. So make sure you're considering the right size to match the models to the task complexity. Make sure you are taking advantage of caching techniques aggressively wherever you have repetitive static content. And also make sure that you are monitoring the cost versus performance to ensure that you are constantly optimizing wherever you can. Now, go through this exercise, and what I would like you to do here is I want you to audit an existing workflow or AI workflow. You can make one up yourself, or if you have one available, you can use it as an exercise. I want you to go through it and think of three optimization ideas that would lead to savings. 25. Voice Assistant: In this lecture, you'll create a voice assistant that listens, understands, and responds using Deep Seek, just like Siri but customizable for your needs. No prior speech recognition experience required. Imagine dictating emails while cooking or quering data during a commute. Your assistant adapts to your workflows. Here, you'll use speech to text, text to speech, the AI brain, which is Deep Sk API, and the audio via the microphone, and we'll glue these pieces together with a few lines of Python code, and the best part, it's all free. So here's the magic that's happening behind the scenes. First, it'll listen and convert speech to text. Then it will process that text by sending it to deeps for analysis and getting the response back in a format of text again in terms of output. And then we convert that text from Deep Sk'sRsponse to audio and we'll play it on the speakers. In this demo, we will build a very simple yet elegant and cool assistant that will be using Deep Seek to process routine and everyday tasks that it can help us with. We'll begin by installing necessary Python packages in a virtual environment to ensure isolation, and the core script will simply listen to the user via the microphone and convert them to text, and then it will send that text to Deep Seek using an HTTP request. Then Deepsek is going to process that prompt. It's going to convert Deepsek's text response into spoken words using another library and for anything that requires IoT style top commands, for example, controlling smart home devices such as heat, temperature, things like that, it will just be simulating the results because it's not actually hooked up to any of the devices. Okay, so first things, let's create our working directory. So what I'm going to do is I'm just going to create a folder here called Deep Seek Assistant. And let's just go inside the folder, and then I'm going to launch Microsoft Visual Studio code. And then from here, we can continue. Right now we're inside the folder. So first things, let's go ahead and create a virtual environment. So I'm going to go into terminal here, and then I'm going to do that through the command line here. So I'm going to say Python and thenspacM and then VN. And then here where you can name the virtual environment directory. You can anything is arbitrary, I'm just going to name it VN. And then let's go ahead and press Enter, and this is going to create a virtual environment using the latest version of Python you have installed on your computer. Now, and the virtual environment has been created. So next, we need to activate it, and you can simply do that by going into the VM folder, and then there's a folder called scripts. Again, you don't have to type the whole thing. You can just start the first few letters and hit Tab to autocomplete, and then we want to say activate and press Enter. And here, when you see this green text over here in VM, that means that we have successfully activated the virtual environment that we just created. Now, let's start installing our packages and our dependencies that we need. The first thing is speech recognition. So pip install speech recognition, and this is for capturing microphone audio and converting to text. So let's go ahead and press Enter so we can get all the dependencies for this library. Okay, we are all good here. Now, let's move on to the next one, and the next one is going to be Pi Audio. So PIP install Pi Audio. And this is required by speech recognition library that we just installed for microphone input. And this is basically the command for it. And then if you click on Inter, it's going to install it. And as you can see here, it says successfully install Pi Audio and then the version. Next, let's go ahead and install the library that's called Give me 1 second here. Okay, PIP install. And this one's called PIT TSX three, PY TX three, and this one is required for offline text to speech. So let's go ahead and install this. Okay, great. So installation for that is done. And we just need one more library here, and this is the request library. And this is used to actually sending requests via API calls to Deepsk. So let's go ahead and install that as well. And now Request Library has been successfully installed, and we are now finished with setting our local environment and all the dependencies we need in order to move on to create our assistant in Python. Next, let's go ahead and create a new Python file. So while in the folder here, Deepseek assistant, let's go ahead and click New File, Python. And I'm going to save this, and I'm going to name this assistant dot pi. Okay, let's go ahead and save. And what I'm going to do is I'm going to paste the following code here, which I'll provide, and I'm going to save again. And what I've done is I've created comments for each block so that we won't spend a lot of time going through everything. But here you'll see the comment explains exactly what each block is doing. So first, we got our imports. These are the libraries we need for this to work. We have our deep Sk API key. Now, this is not the best way to actually you should never hardcode your API key and secrets and tokens and access keys in the code itself. It should always be reading of environment variables. But over here, what I've done is I've just copy pasted mine in here. This is an example API key, which is no longer active after these demos. I just created this to demonstrate and what I've done. I just for convenience and ease of use for this demo, I've pasted it here. But normally you wouldn't do it using this strategy. The proper way of actually doing this is something like this, where we retrieve the API key using an environment variable. So again, it should never be hard coded. But again, I'm going to leave this line here. I'm going to comment it out so you have the proper way. But for the purposes of this demo only, I'm just going to hardcode my API key so that we can move with the rest. Yeah, please do take some time to go through this code entirely. But as you can see here, we're just receiving the first part, we're just configuring. We got our imports, then we got our configuration to retrieve the API key for DeepC so we can actually make queries to it using API calls. Here we have the chat completion endpoint. This is where the requests will be made to using the request library. And over here, we have our function to listen to the mic and capture audio and convert that to text. And again, this can be all changed or reconfigured as you please. So you'll see some messages in the console log when we run the program, and right now it is configured to time out after 5 seconds. You can change that if you like to whatever number is appropriate for you or you can just leave it running in sort of like a forever loop. And scrolling down, you can see here this is where we actually send the conversation to Deep Seek, and then we are going to return the assistance reply. Next, we got the speak text. So this is once we receive the reply from Deep Seek, we're going to convert the text to speech using the library we installed the Pit TSX three. And this is actually this method here that say text. It's going to read it out loud back to us using one of the default voices that it has. Then here we have the main function, so this is just going to initialize the component and run the interaction loop, and this is just going to you have a wild through here, meaning this is a forever loop and it's just going to run things until you exit out of it. And that's pretty much it. There is some exit conditions here, it says, if you say the word quit or exit, it will exit out of the program, or you can simply again, press Control C or Command C, and then it will also in the console log, it will break the execution. And then here we basically enter the main code, which is main function, which is running all of this here. So that's simply just a very high level of what the code is doing. Now, just to test things out and ensure our assistant is running properly, I'm just going to do a couple of prompts, but please feel free to experiment with this as you like. This specific model also is not connected to the Internet or it cannot. It does not have the ability to search. It's just good for everyday interaction. So please do keep that in mind when you're giving it request. So, for example, if you ask it, what is the weather, it needs to look up that information, but it will tell you that it's not able to search the web. So you would have to use different means of actually doing that. It will, however, give you instructions on how to get the weather. All right, so let's start with a couple of prompts. First thing we want to do is actually run our program, so I'm going to expand this area a little bit more so it's easier for you to see. And we're going to simply run this by typing in Python, and then or Pi that DXC the one works. And then assistant Da Pi. And this is going to start executing the program. Tell me a joke. Here's one for you. Why don't skeletons fight each other? Because they don't have the guts. And if you'd like a smart home twist, why did the smart thermostat break up with the light bulb? Because it needed some space to cool down, grinning face with smiling eyes? Tell me another joke. Here's a classic with a smart home spin. Why did the robot vacuum break up with the mop? Because it said their relationship was too one sided. I was tired of doing all the work. Alternatively, for a non smart home joke, what's brown and sticky? A stick, deciduous tree. Let me know if you want more. I've got current puns for days. High voltage grinning face with smiling eyes. Turn off the lights. Got it. Simulating Smart Home command. Blue Circle asterisk turning off the lights. Enjoy the cozy darkness. Asterisk. Asterisk if this were real, I'd need access to your smart home system. But for now, just imagine the room going pitch black and maybe a ghost whispering who turned out the lights. Asterisk Ghost light bulb. Let me know if you'd like help with real smart home integrations. Smiling face with smiling eyes. All right, I'm going to disrupt the execution by pressing Control C, and over here, you can see that now we're back, exit out of the program. But you could see that it is able to process what we said using our voice, turned it into text, passed it to Deepsk Deep Seek was able to see the prompt, process it, and give us back the results. And then that text result was then turned into voice, which is something that you can hear here. And then you saw the smart device command, I just understands. It's smart enough to understand it's not actually hooked up to anything. So it did tell us that it's just a simulation and it's not really going to turn off the lights. So this is how you can make very simple assistance that can help you with daily tasks and routines. You've just learned how to build the foundation for a Jarvis like assistant. Next, teach it your workflows. This is a low cost, scalable and a private approach to creating your own assistant for your everyday needs. Now, for the next exercise, I would like you to build the assistant but also experiment with different commands and analyze the results to see how it can fit your everyday routine tasks. 26. Research Summary Assistant: In this lecture, you're going to learn how to build a tool that digests dense academic papers, extracts summaries, and even generates citation, saving you weeks of manual reading. This is perfect for students, researchers, and analysts. Think about the time sink, how much time you're going to spend on reading and not analyzing. Think about the amount of research papers and studies that are being published daily, and think about the human error where missing key findings in long test is a huge probability. AI won't replace researchers. It will save them from drowning in files, articles, and PDFs. We're not going to use any fancy software, just common Python libraries to read, analyze, and extract information and format them to our needs, using free tools and deep seeks brain power. Let's go through the steps. First, we're going to extract the text from the PDF, and it doesn't matter how long the PDF is and how many pages there are in terms of content. Then we're going to take that text, and we're going to summarize it and identify key contributions, methods, and gaps, and then we're going to auto generate citations in MLA format. So here you can see that there's a pipeline, and let's turn this theoretical pipeline into a working tool. So watch closely. In this demo, you're going to learn how to create a Python script that uses Deep Seek to summarize a PDF and extract citations. The script will first load and extract from a PDF file, then it'll send the extracted text to Deepsek via its open AI compatible API to generate a summary, along with citation information, and then it'll display or save the results. Now, of course, what you can do is copy paste the content of any PDF file and use deepsks web interface to copy paste and get the results there. And if that works great. However, you do have to realize that some of these things are if you have very long PDF files, it will reach the maximum token size, so you would have to do this in chunks. And the other way is that I want to show you how to accomplish this programmatically so that you don't have to always rely on the web interface, and then you can tweak the code to better suit your needs. So here we have a PDF file. And again, this is just a research paper that was published, and it's available online. So the title is Lama two, and this is the Open Foundation and fine tune chat models. The important thing is, this is a research paper, but also it's very long. As you can see, it's 77 pages, and this is perfect because you don't have to go through the entire 77 pages and understand every little detail. You could just get Deep Seek to summarize this for you and then also give you the citations by analyzing and extracting that from the text. G, let's get started. And first thing we want to do is create your directory. And here I will be providing the PDF file, but I already placed it into our new folder that is going to be a root folder for our working directory where our project will be. And remember, later, we have to pass in the path for this file so that it can analyze the content. So we have the folder. We place the PDF file in here. Again, it doesn't have to be this PDF file. It could really be anything you like. So let's go ahead and launch Visual Studio code. Okay, great. So now, first thing we want to do is you can see that we have our PDF file in the current directory. Let's go ahead and create a new file. And this one is going to be a Python file, and I'm going to zoom in just a little bit more. And this one we're going to call PDF underscore summarizer dot pi. Okay. And then we're going to paste in this code, and again, don't worry. We'll go through this. Let's go ahead and save this. And this is going to be our PDF summarizer program, the Python script that's going to do the job for us. And then one other thing that we need to do is we need to create an environment variable because we're going to again, hard coding API keys into the application is never a good thing, and it should never be checked into the code repository. It should always be set up as environment variable. And here, what we're going to do is instead of hardcode the key here, we're going to just create a dot N file, and then using this library here, the dot N, we're going to use that to read from an external file. But that could typically come from the environment variable that you set in your CI pipeline. So in this case, let's go ahead and create a new file. And the way we do that is we're going to go file new text file. I'm going to paste in my API key. Again, this is a sample API key that I'm using for the purposes of this demo, but please do not share your API key with anybody. So the key is this, and then the value of the API key is that. So you want to follow this exact format, and then you want to go ahead and save. And then this one has to be named exactly this way. It's going to have to be dot EN V. You should not name it anything else, otherwise it will not be able to process, and then we're going to save this as all files, so dot ENV is the extension, so it's going to recognize that. So right now, we have three files. We have the dot ENV. We have the PDF file, and then we have the PDF summarizer dot Python script, which is our main program. Before we start running the program, first, we need to install some dependencies. So let's go ahead and do that. Let's start a new terminal. Going to expand this a little bit so you can see better. Before installing, though, we want to create a virtual environment. So let's go ahead and do that. Python and then minus M VN and now the name of the folder where you want everything to go in. In this case, I'm just going to call that VN again. Doesn't have to be VN. Could really be anything it's just arbitrary name. So let's go ahead and do that. Right now, it's going to ask you, do you want to select this as your workspace? Yes. And then now it's going to create the virtual environment for us and set up our local project. All right, so it's finished. And now the next step is we want to activate it, and there's a script folder with a file called Activate. So let's go ahead and go VN. To paste over here and focus the cursor there, VM, and then scripts and then activate. Let's go ahead and do that. And then now you can see the screen icon with the Powershell, it's now activated. So now we are ready to install our dependency. And in order to do that, this is what we're going to do, and this is the command we're going to run. So pip install. We need OpenAI, Pi PDF to python dot and TikToken. So press Enter and let's have those installed. Now, this is going to take a while, so I'm going to pause the video and then we'll come back when it's done. All right, all of the installation has completed successfully, and now we're just ready to run the program. But before doing that, let's quickly go through the code and see what it is doing block by block. Now, on a high level, what this script will do is first, it'll extract all the texts from the PDF. It will then tokenize and chunk the text. So each piece is less than 57,344 tokens, and this is going to leave room for an eight K token summary. Then it's going to call Deep Sear one, which is the reasoning model of Deep Sk on each chunk requesting up to eight k tokens of output per chunk. This ensures that we don't hit the limit and our program won't crash. We're going to concatenate the per chunk summaries and citations. And the last step is we're going to print the combined result to console and save it to summary text file in the working directory. Alright, now let's spend some time and go through the code in a little bit more detail and we'll cover it each block by block, and we'll spend a little bit more time to go through this to understand exactly what each block is doing. So let's start with the imports. Now, the Import OS, the purpose for this is it provides access to environment variables, file paths, and other OS functions, and the standard Python library uses for fetching os dot gg N function and interacting with the file system. The import arc parse is the purpose is to parse command line argument so that the PDF path can be provided by the user. And you'll see later on when we are about to run this program, we'll have to execute the command Python and the name of this file, which is PDF summarizer. But we have to pass in an argument, and the argument in this scenario is going to be the absolute path of the PDF file, which I'll show you how to obtain later. And this one here, the RVS module RCPars module automatically generates the help usage messages and handles invalid arguments. Now, looking at the from.net Import load.net, the purpose here is loads the key value pair from the dot N file which we created, and this was into it loads the key value pair from the dot N file into the environment variable at runtime. Python dot lets you keep secrets like API keys out of the source code by reading at N file. Now, the Import Pi PDF two, the purpose for this is it reads and extracts text from PDF file. So there's a library that does the work for you, so you don't have to write the code to do that, and it is a Python library for working with PDF documents, supporting text extraction and other operations. Now, looking at Import OpenAI, this provides the OpenAI compatible SDK to communicate with DeepsIx API. The OpenAI Python library is used to call chat completions on Deepsk R one, which is the reasoning model by setting the base URL to TPs api.deepsk.com. And lastly, we have TikTok Import TikTokenT is basically this encodes raw text into token IDs so you can count tokens and split text into appropriately sized chunks so you don't go over the Max threshold. And TikToken is a fast byte pair encoding, which is also short for BPE. A tokenizer compatible with Open AI models, and it's ideal for precise token counting. Now let's go through the next block here, and this is where we load the API key. So what it does is it searches for a file name.in the current working directory or parent directories. And this is helpful because it prevents hardcoding your API key. Instead, you put the key value pair there. So in this case, Deep Seek underscore API underscore key equals the value of your key in the file alongside your script. And by default, the Python dot N does not override the existing environment variables. It is used to manage secrets locally. And the OS Get line here is retrieves the value of the key, in this case, DeepsekUnscore, API underscore key from the OS environment. And this is Deep Seeks API key is required to authenticate your request to the base URL, which was HTTPs coolinlashpi.deepsk.com that we covered earlier. And over here, you also have the value error. So this is just some basic error handling, and what it does is it halts the execution with a clear error message if the key is missing or is unable to resolve that, and this is helpful because it helps you catch configuration mistakes early rather than sending a request without any credentials. All right. Now let's move on to the next block, which is extracting texts from the PDF file. Now, here, looking at the WidopenPDF path BSF, this what it does is it opens a PDF file in binary read mode, and the reason for this is PDFs are binary files, and the library P Pi PDF two dot PDF Reader method, expects a binary file object. Now looking at this, reader equals the reader equals Pi PDF reader F as an argument. This instantiates a PDF reader object that can access each page, and this object provides a list, which is the reader dot pages, each of which can be used to extract text. And PDF reader from Pi PDF two returns a list of page object with an extract text method. Then we loop through here. You see the four loop. What this is doing is it iterates over each page index, calls extract text method, and concatenates non null strings. And the reason for this is some pages may have images or no text. So the extract text method might return none or just an empty string ensures you don't append none. And the extract text method returns a string of all text on that page or none if it's empty or it's image only. And then the return text here, this one is what it does, it returns a giant string containing all page text separated by new lines. Okay, let's move on to the next block here, which is the tokenization and chunking here. So this could be a little bit tough to wrap your hair up, but we're going to go through it, and after some practice, it's going to be much easier to understand. So and feel free to, you know, perform some more research into this and play around with the code to get more familiar. You can also use Deep seek to analyze this code for you and tell you or explain it to you or any other tool like Gemini or HAGBT if you're having a hard time understanding this or going through it after this lecture. Now, over here, what we're doing going through these slowly over here, that line is, for example, all the token IDs equal tokenizer dot code text here. This is what it does is it converts the entire long text into a list of token IDs using Tik Token library we installed as a dependency. And the reason for this is because you need to know exactly how many tokens you're sending to Deep Sk R one model, so you don't exceed the 65,536 tokens because that is the limit that it has that you cannot surpass. And then going through the chunking loop, which is simply starts from here, like start IDX zero, and then we go through the Wile loop. What this is doing is the MAX input to underscore tokens is set to 57,340. Four. And this is simply the way we calculated this is the max, which is 65,536 -8,192, ensuring that when we request an eight K token output, the sum, which is input plus the output is equal or less than the max, which is 65,536 tokens. And the overlap of the 200 tokens, this helps preserve continuity for the citations that might straddle chunk boundaries. Now, let's look at the back of logic which helps avoid splitting mid sentence. So here, what this is doing is, if you go through this block here, this is simply if you're not at the final chunk, it checks up to 1,000 token backward to find the white space or punctuation, so you don't cut off mid sentence or mid word. And the reason for this is to ensure that chunk boundaries don't break sentences in half, which could make summaries incoherent. Now looking at the tokenizer, do um tokenizer dot decode chunk IDs over here, this line. This is what it's doing is converting this subset of token IDs back into plain text for that chunk. And this is because Deep C car one expects raw text input, not token IDs. And then the return chunks line here, it's a list of text strings, each less than or equal to 57,344 tokens with roughly approximately about 200 tokens overlapping between adjacent chunks. Okay. Let's keep going into the code. So this section here, Section four summarizing and extracting citations per chunk. So here you can see the summarize and basically what this is doing, like the system message, what this is doing is that instructs the model's role. Here you are an academic assistant. It sets the context that you expect a summary plus a list of citations, including page number. And by providing this, you are providing a clear system prompt. You guide Deep Seeks R one model to format its output in two distinct sections, summary and citation. And Deep Seeks R one, which is the reason a model is invoked via the Open AISDK by setting the base URL as hdbsapi.deepsk.com. Now, looking at the user message, this is what it does is it delivers the actual chunk of PDF text to the model followed by the specific request. And this ensures the model sees exactly what it needs to analyze and extract from. Now, looking at this line here, the client Open AI. This is instantiates a client for Deepsk API using the environment variable Deep Seek API key, and the client will send the chat completion request to the endpoint by doing a post call to the endpoint that you see here with slash Completion. So this is our base URL here. And this is the base URL, so you will get shat slash completions, and it will be making a post call to that. Now, looking at this line here, the response equals client hat completions that create, these are the arguments. So you see there are several arguments here. So the model is basically model equals model. This is the Deep seek reasoner, which is deepskRO. The messages, this is the system prom plus the user chunk. The max token is 8192, which we covered earlier, and this is a request up to eight K tokens of completion, and the temperature being zero, this is deterministic output, so no randomization. We don't want any randomization. And we said it this way because we want to ensure the model uses no more than eight K tokens in its reply, living room. So the input plus the output is less than 65,536 tokens. And then looking at the last line here, return response, is this extracts the string content of the first and only completion choice. And we do this because that content holds both the summary and the citation for this specific chunk. Okay, let's move on to the main function, and this simply here, we'll start here. So parser equals arc parse. This one instantiates an argument parser that will automatically generate sort of the help and parse positional arguments. And the arc parse simplifies command line interfaces by defining required arguments, auto generating usage messages, and validating inputs. Now, the parser dot add argument, this one declares that the script expects exactly one positional argument, which is in this case, the PDF path, which is a string path to the PDF file that we had in our directory that I showed you earlier. Now, without this, the script would not know which PDF to process. And then moving on to args parser. This one here is parses the actual command line argument and stores them in the args dot PDFFAt. If the user omits the PDFat or typed an invalid flag, the arc parse prints an error or help and it exists a program. Now let's go to loading the API key over here. This tries to load the API key. As you can see, there's sort of try an exception, try catch exception. This one here, it calls the function from the earlier section to load and verify deep Sk API key. And if this fails, for example, if the key is missing, the script prints an error and returns early. Okay, moving on to extracting the PDF files. So over here, what we're doing is this line notifies you which PDF is being processed. So again, just some console logging, and this is helpful for debugging or, you know, long PDFs. And then, so you know it's working and it's not actually failing behind the scenes. The full text here, this calls a function from the earlier section to get a single large string containing all page text. And then the conditional here with the if statement, this checks if the extracted text is empty. So for example, if you have a PDF that's image only, if so, it prints, no text found, and then it returns. Now, defining the deep seek model here, this block over here. So this is where we define the token limits. So for example, the first one over here, this one, it's the deep deep Sk R one maximum total, so input plus output number of tokens, which is 65,536. We got the Max output tokens. We want deep Seek to generate at most eight K tokens of summary and citation. And the Deep Sik R one maximum generation length is 32,768 tokens, but we request only eight K to leave room for the input. Moving on to the max input tokens, this is simply the calculation for this is 65,536 -8,192, which equates to 57,344 tokens. Why do we do this? Because it guarantees that the length of the input tokens plus the length of the output tokens is less than or equal to the max, which is 65,536, preventing bad request error such as maximum context length has been reached. Looking at the overlap token, this simply says each chunk shares 200 tokens with the next chunk to preserve overlapping sentences and citations. Now, moving on to the tokenizer, this one here simply it returns a tech token encoding object aligned with GPT four turbos tokenization. Although the DeepCcarb is not exactly GBT four, they share an open AI compatible tokenizer, and this ensures consistent token counting with Deepsks API. Now, here, we're going to split this into chunks. And what this is doing, this is going to return a tick token encoding object. And sorry, actually this is logging. Excuse me. This is actually logging the chunking that's about to happen. So it's just a console log. And then the text chunk here, this portion, this one splits the entire PDF text into manageable chunks based on the earlier sections logic we covered. And this is a list of strings, each less than or equal to 57,344 tokens with roughly about 200 tokens of overlap. And then the print F here, the total chunks, this logs, how many chunks will be processed. It's useful to confirm you didn't accidentally create 100 plus small chunks when fewer larger chunks were expected. Okay, so let's move on here. And looking at this, this is simply looking at all summaries. This initializes an empty list to hold each chunks summary plus citation block. And then we move into the prints. This is just a console log, notifies you that the per chunk summarization is starting, which may take some time. Then we will move on to the four loop, and this is basically iterates over each chunk with a human friendly index starting at one. And then it also logs or the print out here, this is showing you the progress. So for example, summarizing chunk two out of five or one out of five, so you know how far along the process it is. And then the chunk result here, this calls a function from the earlier section sending the chunks text to deeps R one for summary and citation extraction. And this is simply what is returned is a string containing both the summary and the list of citation, including page references if Deep Seek identifies them. Now, moving on to the divider, this creates a visual boundary, so it's 80 equals signs between each chunk's output so that when concatenated, you can easily locate where one Chung's result end. Then all summaries, this stores each hunk's response plus the divider. And then the exception handling here, this is catches API errors such as rate limits, network issues, things like that, and prints which chunks failed, and then it exits the program. Alright, we're almost there, please bear with me. So looking at this last block here, combining all the chunks. So the final output, this line, it joins all chunk blocks into one big string, separated by each chunk's divider. Then the print one, the print lines here, this logs that the final combined output is about to be shown. And then the final output, this is simply prints the entire concatenated summary plus the citations to you and the console. With the open here, this one simply writes the combined output to a file. This is optional. We just did it, so we have sort of artifact at the end, and this writes the combined output to a file named summary and citation chunk dot TxD in the working directory and enables later review or sharing of the results without having to scroll through the console, which could be a little bit annoying. And then moving on to this last print line, this confirms where the file was saved. And then over here, looking at this block here, this simply ensures that the main is called when the script is run. So as soon as it's run, it enters the main program or the main function, which runs the rest of the code. So this is called when the script is run directly and not when it's imported by another module. And this is just standard Python idiom for script entry points. Alright, the last step is now we just have to simply run this program and look at the results, and we can do that in the terminal. Now, when we run the program, if you remember, we have to pass the file path to this PDF file to the program as an argument. So one thing we need to do is first, we need to figure out what that is. So now, if you hover over this, it shows you the full absolute path, okay? So that's one way, but it's annoying to type it. Uh, the other way is if you go to your directory, and if you simply right click the file, you can go copy as path. And what this does is you can go back here and I'm just going to paste it so you can see. So it puts the entire path in codes, which is perfect, exactly what you need. And then the other one is you can just use sort of like command in Tower Shell, which is resolve path. So just type in resolve and then tab that. So not the first one, the second one. Here we got resolved path, command, and then just go space and then the name of the PDF file. So in this case, 23 oh seven, I'm going to type in 23 oh and then tab. It autocompletes the filing, press Enter, and then it gives you the path, and now you can just copy paste it. So many different ways of doing the same thing, do what's best works for you. And yeah, we're ready to run the program. Alright, so all we have to do is simply type in Python for running the program. So Python, a tab, space, the name of the file. So this is a PDF summarizer. So type in and then tab it to auto complete and then space, and this is where we need to paste in the path of the file in our PDF. So again, the command Python to execute the file, the file or our Python script that we want to execute. And then as an argument, we're passing in the absolute path of the PDF file we wanted to analyze and summarize and grab extract the citations. That's it. All you need to do is press Enter and let this run. Now, as we covered in the code, it's going to start showing you some text so that you understand what phase of the process it's in. It says total chunks created two, processing each chunk with deep C car one, and then it's currently summarizing Chunk one. Then it's going to move on to Chunk two and then it'll be done. But this process is going to take a few minutes. So what I'm going to do is pause the video when it's done, I'll come back and we can take a look at it together. Okay, so the whole process took roughly about 2 minutes, but as you can see that it's been processed, no errors have been thrown. And yeah, we can quickly take a look together. There was a total of two chunks. And over here, you can see the results are in the console log, which we'll quickly look at. So you got the combined summary and citations. So it's broken into two sections. So and again, this is broken by chunks, right? So you got concise summary for the first chunk and then it's giving you the summary with sort of the bullet points. And then going down here, you got the list of citations that it was able to extract from the file. Then you can go through this, and then we are going to it has a note as well. Page numbers correspond to the PDF's internal pagination. So giving you some examples there. And then looking at Chunk two here, you got the concise summary, and then you got the list of citations for that. And then, again, it's kind of printing it for you in a nice table format. And here you can see the results in the console. And again, what's done optionally, what we've done is we've saved that to a textfile with this name. So if you go back to your directory, you should see that text file here, which is the summary and citations shank dot TXC. And when you open the file, you will see the exact same information that is presented to you over here in the console. You just learned how to build a simple Python script that can help you with speed, precision, and scalability. And you learned how to automate the tedus 80% of research. So now you can focus on groundbreaking insights and not formatting citations. For this next practical exercise, I would like you to summarize a PDF from your field and note down a few key findings. 27. Social Media Bot: In this lecture, we will cover the idea of building a bot that generates engaging posts, suggests hash tags, and even auto publishers, freeing up to 10 hours or more per week, and no you do not require a marketing degree. Being in charge of social media and managing posts can be time consuming and challenging at times. It can lead to gaps and inconsistencies that could hurt your brand and engagement if errors are made. You can also miss out on potential opportunities to take your brand's voice viral in the community. Deep Seek acts as your creative director, copywriter, and scheduler all in one. You can start simple and start by generating posts. Then you can scale to Auto publishing once you get more comfortable and more familiar with the code and once you've built your baseline. You can use Deep Seek for analysis, brands, voice, market trends, and tone. You can then use different libraries to schedule your posts and then publish them to social media platforms such as X and Twitter using their API. We will not be going through the code as we did a very similar exercise earlier in the course, where we built a Python script to automatically post two together. The blueprint for this exercise will be almost exactly the same, and it would depend on the social media platforms you're trying to engage on and they're available public APIs, such as Facebook or Instagram. But the ideas and concepts remain the same. Now, I want you to turn this flow chart into code. Once you complete the exercise successfully, you will have learned how to ce a social media manager for $0 salary. And it will help you with consistency, engagement, and scale, freeing up your time so that you can focus on more high value work. Now, once you build the bot and have your established baseline, I would like you to go through a follow up exercise and generate a week of tweets for your niche. 28. AI Recommendation Engine: In this lecture, we will go through a conceptual exercise where you'll build a recommendation engine that suggests products based on user behavior, helping you increase average order value. Now, it's something very important to understand the upsell secrets, and I'm not sure if you know, but 35% of Amazon's revenue comes from recommendations. User retention is very important because it creates personalized suggestions, reducing the bounce rate, and it gives you a competitive edge because small stores can mimic enterprise tools. Your competitors are already doing this. Now you will, too, with just Python and DeepC. You can start with mock data, then plug into real stores. You can choose your adventure based on your comfort levels. Clarity over complexity is very important consideration that every ecommerce store needs to make. Specifically helps avoid vague requests like write something about AI. Contact explains your audience, tone, and purpose and action. You can use verbs like write, summarize, or compare. Now, let's turn this flow into code and watch closely how deep Seek can spot patterns that humans could potentially miss. We'll build a simple recommendation engine using Deepsek and Python demonstrating how to go from raw purchase data to personalized product suggestions in just a few lines of code. We'll cover preparing sample data, writing the code recommendation script, exploring deployment options like Shopify integration and email campaigns, and finally, discuss how to optimize your prompts with AB testing to improve performance over time. For demo, we'll use a simple CSV file called purchase underscore history dot CSV with columns for user ID, product name, price, and category. Here are five rows of sample data representing different users purchases. This will be the context we feed into DeepC to generate meaningful product recommendations. Of course, you'll use real time data from your store to populate the CSV, and most likely it will be more than just five rows. This is for demonstration purposes only, and the sample data you see here on the screen are all fake data and made up for the purposes of this exercise. I recommend dot Pi script begins by loading the CSV purchase history into memory, then builds a prompt listing all items a specific user had bought. Next, we instantiate a Deep client, send our prompt asking for three new product suggestions, and print out the recommendations returned by the model. This workflow moves data from CSV to Python into Deepsek and back out as Taylor recommendations, illustrating a straightforward LLM integration pattern. By crafting a clear prompt, based on this purchase history, recommend three products, we guide the model's output, length, and focus, demonstrating the power of prompt engineering. Once a recommendation engine is up and running locally, you can deploy it as a microservice connected to Shopify via its Admin API to fetch real customer data. Alternatively, integrate recommendations into automated email campaigns using Sengrid or Mailchimp to deliver personalized product suggestions directly to users inboxes. To optimize performance, split your user base into groups A and B and serve them with different prompt variants, tracking click through and conversion rates to identify the most effective phrasing. Key metrics like CTR, conversion rate, and average revenue per user will guide prompt refinements enabling you to iteratively improve recommendation quality. Looking ahead, you can replace our sample CSV with a production database, cache popular recommendations for faster responses and enrich your engine with collaborative filtering or browsing behavior data. Remember to automate your AB testing cycles and retrain prompts regularly as new purchase data arrives to keep recommendations fresh and relevant. You've just learned how to build a revenue driving machine. AV test generally shows most users can see up to a 20% spend increase. Try it and see what yours will be. Next, I would like you to generate recommendations for any user history using any sample data that you like. 29. Emerging Trends: In this section, we explore emerging AI trends such as agentic systems, programmable hardware and evolving data marketplaces to understand where deepsk and similar platforms are headed. We then cover how to contribute effectively to open source AI projects by following community guidelines, best practices, and collaborative workflows. Finally, we discuss strategies for AI professionals to stay competitive through technical upscaling, adaptability, and active networking within the AI community. Agentic AI systems go beyond fixed rule automation to autonomously set and achieve objectives adapting in real time as conditions change. In practice, we see them in intelligent agents that can manage end to end workflows, like scheduling, email triage or even automated trading without human prompts. The agentic AI market has already reached nearly $31 billion in 224 and is on track for high double digit growth over the next few years, underscoring the transformative potential of these autonomous systems. As AI algorithms grow more complex, fixed function chips struggle to keep pace. Programmable AI hardware built around modular super cells linked via a network on chip enables rapid reconfiguration to match evolving model architectures. This approach pioneered by R&D leaders like IMEC promises significantly improved energy efficiency, often doubling or quintupling performance per watt compared to traditional GPUs. Moreover, advanced SOC designs are bringing powerful AI inference to edge devices such as IOT sensors and variables, reducing latency and preserving bandwidth. Beyond publicly scraped texts, a new economy is emerging around proprietary data, everything from specialized medical scans to internal corporate logs, licensed through APIs or subscription marketplaces. Simultaneously, synthetic data generation where AI models create realistic but artificial records addresses privacy and bias concerns, proving invaluable in use cases like autonomous vehicle simulation and fairness auditing. As these markets grow, evolving privacy regulations like GDPR and CCPA will determine how data can be shared, licensed and used in AI development. 30. Open Source AI Contribution: Start by browsing platforms like Git Hub's trending page or the Hugging Face Model Hub for projects tagged with DevSek or similar AI frameworks. Prioritize repositories showing frequent commits, active issue discussions, and maintainers who engage with contributors. Always check the project's license commonly MIT or Apache two point oh to confirm you can legally contribute and use any derivative code without restriction. Before writing any code, clone the repository and read its contributing DMD file carefully. This document outlines the project's style guides, branching model often Git flow and testing requirements. When submitting a pull request, include a sync description of your changes, linked to any related issues, and attach relevant unit or integration tests. Remember that open source collaboration thrives on respectful communication, ask questions and issue threads and remain receptive to feedback from project maintainers. Sustainable contribution goes beyond code. Assist with issue triaging by labeling on confirming bugs, enhancing the project's overall health. Strengthen documentation with clear tutorials, updated API references, or illustrative notebooks. This helps both developers and end users. And finally, consider mentoring newcomers through community forums or scheduled calls. Teaching others is one of the most impactful ways to reinforce your own expertise and learning and foster a vibrant project community. 31. AI Careers: To stay ahead, dive into multimodal AI, combining text, images, and audio and explore reinforcement learning agents guided by language fronts. Bolster your resume with recognized certifications such as hugging faces, transformer courses or intensive prompt engineering workshops. Equally important is building a public portfolio. Consider publishing a demo chat pod that leverages Deep Seek for dynamic content recommendations, showcasing both technical skill and creativity. Technical prowess alone isn't enough. Cultivate a habit of lifelong learning by scheduling weekly deep dives into new research papers and hands on experiments with emerging frameworks. Hone your communication skills so you can articulate AI benefits and risks to business leaders, accelerating organizational buying. Adopt an agile mindset. Prototype quickly, learn from failures and pivot based on real world metrics to maintain momentum. Expand your network by participating in flagship conferences like neuro IPS or AI Dev Days and don't overlook local MLAI meetups. These settings are perfect for forging lasting professional relationships. Online platforms such as LinkedIn, REDIts Machine Learning Forum, and dedicated AI focused Discord servers offer daily interaction with peers and experts. Engage in mentorship, both as a mentee to learn from veterans and as a mentor to junior practitioners to reinforce your knowledge and contribute to the AI community's growth.