Hello guys!
So welcome to the Langshan series.
And in this video we are going to get started with Langshan and OpenAI.
Uh, here.
This video is super important because some of the important modules that are available in Langshan will
be setting it up like Lang, Smith and Lang serve.
Along with that, uh, you'll be seeing in series of videos, we will be building a sample application,
uh, simple sample application with the help of Lang Jin.
Uh, there we are going to use OpenAI models.
Uh, along with that, if you do not have OpenAI API key, then you can also go ahead and use open source
models that also I'll show you with the help of llama.
Uh, again, the main aim over here is to make sure that what all tools we are going to use in this
entire course, I'm going to probably do that entire setup right now, so that you will be able to follow
all the lectures as we go ahead.
So let me just go ahead and share my screen.
So here, uh, in this video what all things we are going to do.
So first of all we are going to get started with Lang Chain.
And let me just go ahead and right and open I okay.
Uh, in this quick start we'll show how to get uh like we'll see how to get set up with Lang Chain,
Lang Smith and Lang serve.
So we'll be discussing about all these three, uh, modules, important modules that are present in
Lang chain.
Then, uh, use the most basic and common component of lang chain like prompt templates model and output
parser.
Then we are going to build a sample app, a simple application sorry with Lang chain.
And then we are going to trace our entire application with the help of Lang Smith.
Right.
If you really want to do debugging monitoring everything, we will be specifically using Lang Smith.
And then finally, uh, if I want to probably make this entire application in the form of APIs so that
it is production ready, I will be using Lang serve.
So all these things not only in this single video, but in the series of video I'll be doing once we
do it with OpenAI.
I know, like everybody knows that OpenAI provides you API key, and obviously you need to put at least
$5 credits to check out all these things.
The reason why I'm considering OpenAI, because it is important in most of the companies, people are
using it in the form of APIs and all.
So first of all, initially I'll go ahead with OpenAI API And then um, we will also go ahead with open
source models through llama.
Okay.
So uh, initially the first step is getting set up with Lang Chain.
Lang, Smith and Lang serve so quickly.
Uh, let me do one thing.
Let me go back to my browser.
So here is my entire Lang chain page.
So, uh, over here, you'll be able to see in Lang Chain, we have, uh, a library or module which
is called as Lang Langsamt.
Along with this we also have something called as Lang serve.
Okay.
So Lang Chain is a open source framework where you'll be finding lot of modules, lot of libraries,
which will actually help you to develop the JNI application.
So first of all I'll just go ahead and click on Sign up okay.
And once I sign up, you'll be able to see that we will be able to log in into the uh, Lang chain.
Smith, Lang Smith basically like say this Lang Smith why it is used.
So we can just go ahead and understand.
It will be like if you want to make your LM app from prototype to production, we will specifically
use this entire Lang Smith uh, module itself.
So by default, whenever I do the sign up, uh, you have to go ahead and insert your user ID or whatever.
Uh, like name all the details and probably go ahead and sign up with your email ID, uh, in the Lang
Smith.
Also, if I go ahead and sign up, it will probably give me the same, uh, page that I had actually
got.
Okay.
now here you can actually see I've created so many different projects, you know, tutorial one test
lamp.
So over here we'll be able to do the entire monitoring everything as such along with this, uh, if
you go over here and say that I can also upload my own data sets, there is something called as annotation
Q prompts.
You know, uh, if you want to probably do the deployment, I can go ahead and click this and, uh,
you know, land graph API deployment is also there And right now, hosted land serve is coming soon.
If you're interested, you can sign up for the early access.
Let's see till the recording of this particular entire course gets over.
Uh, whether, uh, if I get this particular access, I'll also make the tutorial for them for the same.
Okay, so this is the first step.
Please go ahead and create an account in long chain.
And automatically you will be able to create an account with respect to land.
Smith.
Okay.
Uh, so this is the first step.
Everybody needs to have this.
Okay?
And I will show you that how I will be using this.
I will be monitoring my entire application and everything as such.
Now, the second thing that you really need to add is an API API key.
So just go into the Google search for api, API key.
And uh over here you'll be able to see platform dot Openai.com.
Just click on this okay.
Um, it will tell me to log in.
So I'll just go ahead and log in.
I'll continue with Google.
I hope everybody may have an account in OpenAI.
Right?
Uh, I hope everybody has used ChatGPT at least.
Right.
So here is your entire, uh, API, uh, chat.
Uh, you can probably see this OpenAI, uh, platform.
Okay.
And here you'll be able to see there is something called as API keys.
Uh, you can go ahead and create your API key over here.
Okay.
Uh, but for this, uh, it will not be completely for free because you at least have to put 500 or
$5, not $500, at least $5 to probably check it out.
So here you can see some of the usage that I've actually done in June.
Right.
And right now, uh, the date is 18th June.
I've not used it, but from today I'll be probably using it.
You can also see that I've used for GPT four or GPT four.
So I'll be using this models when I will be developing an end to end application.
Okay.
Uh, if you want to probably go ahead and, uh, upload, uh, put some amount again, you have to go
to the payments.
And uh, here you can see cost, activity.
Everything is basically there.
If I go ahead and click on increase Limit, you'll be able to see that I will also be able to set my
limit based on the requirement that I have.
So if you go to click on Billings, uh, so here you can upload your payment methods.
My right now my credit balance is 2.85.
But uh, if I require more, I will be inserting more 5 to $10 and probably showing you how you can
actually use this OpenAI API key.
Okay, but at the end of the day, you really need to use this because many of the companies are using
it, right.
So there are options of putting up payment methods.
And all right.
So based on that you can actually do it.
But at the end of the day I will be using one API key which I will try to create it over here.
I'll also show you, uh, how to create it and where I'll be creating the entire environment.
Okay, now let me just go back to my project.
So I have actually created each and every thing over here.
Uh, the first thing, uh, that I'm actually going to do is that over here, you'll be able to see
that I've created a lot of folders which you'll be able to understand in requirement dot txt.
I have, uh, put up lang chain.
So lang chain is one of the library that I'm actually going to use.
And since we are going to work with, uh, Jupyter notebook.
So what I have actually done is that I've used Ipykernel.
Okay.
Ipykernel, uh, just enables to attach a kernel to the Jupyter notebook itself.
So this is the first thing that I really need to install along with this.
Uh, there are some more installation that I will be doing, which I will be showing you.
Right.
Uh, the first thing is that, uh, you'll be able to see that.
I'll go ahead and create my dot env file.
Now, this dot env file is super important because with the help of this dot env file, what I am actually
going to do, I'm going to go ahead and create my open API key over here.
Okay.
And I will be assigning the values over here.
Right.
So this will be one key that I'll be using.
The next key will be my Lang chain API key.
Right.
So if I go ahead and do this and probably go ahead and put my Lang chain API key.
Now why the why do we require lang chain API key?
It is very much simple.
Uh, if you probably go to the browser.
Right.
Uh, so let me just show you over here.
So if I go to my, uh, Lang Smith right over here, you'll be able to see if I go ahead and click on
settings.
Right.
I will be requiring one API key because at the end of the day, entire monitoring will be specifically
happening over here.
Right.
Uh, see if I go ahead and see in this election series, you'll be able to see right now there is no
request.
But if I go ahead and see in some tutorial one.
Right.
Okay, let me just go ahead and see from the past last seven days.
Last 30 days okay.
So nothing is here.
So let me do one thing.
Let me just go ahead and test some more.
Right now everything looks blank okay.
But it's okay.
We will see this all time if I go ahead and see.
See over here I had created some request from open AI, and here you'll be able to see.
I'll be able to monitor each and every request and all.
I'll be talking more about it, but just I'm giving you an idea why we specifically require a long chain
API key.
Because, uh, in this in this portal, I am going to record all my, all my monitoring things, debugging
things with respect to the Genie app that I'm actually going to create.
So in order to create the API key just go to the settings over here, click on API key and uh select
or create this API key.
Right now I have already created it.
So if you go ahead and create it you can give any kind of description over here.
Okay.
Let's say that I'm giving here, this will be my test key that I'm actually going to create personal
access token.
I will go ahead and create this API key.
I'll copy this okay I have saved it to a safe place.
Now what I'm actually going to do over here is that I'm going to paste the API key.
Right.
And this API key I'm going to specifically use it over here.
Uh, again uh, I'll not say that.
Please don't please use my API key.
Don't do that.
It will be of no use.
Uh, you can create your API key because it is completely for free.
Okay.
Then coming to the next part.
Right.
So since we are in the dot env file.
So first of all I kept my open I underscore API key as a key.
Then my API key.
Then I will also go ahead and create my Lang chain.
Lang chain project okay, so I will just go ahead and write lang chain project okay.
So this will basically be my Lang chain project.
And let's say this is my Gen I app with with OpenAI.
So this will be my project name that I'm actually going to create it.
Okay.
So I will be requiring this three information to start with.
Okay.
Now you may be thinking, Krish, why I have not yet put up this OpenAI API key.
I would suggest please go ahead and put your own API key.
Okay.
Do not be dependent on mine because I'll keep this hidden.
Otherwise lot of charges will happen on my end.
Okay, so this will be the three API keys that I will be requiring.
Langton.
Underscore API, key Langton project and open AI and uh, open AI underscore API key.
Perfect.
Once this is done now I will go to my requirement dot txt.
Okay.
Now here uh, I'll not go ahead and install Ipykernel because Ipykernel I'll do it only for the Jupyter
notebook.
So I don't have to put that entire thing in the requirement.
Dot txt I will go ahead and write python dot env.
Now why this library is actually required.
It is very much simple.
Whatever things I have written in my dot env file to import all this key value pairs in my Jupyter notebook
or in my.py file, I will be have.
I will have to use this python dot env okay.
Now my requirement dot txt is updated.
So let me just go ahead and open my terminal.
So this is my terminal over here.
Now quickly.
Uh I'm in my V and V environment so quickly let me just go ahead and install all this requirement dot
txt.
Okay.
So lang chain and python dot env.
So here you can see it is successfully installed.
Perfect.
So this is good.
Uh we are ready with it.
And uh you can see that I've also created my API key itself.
Now what I'm actually going to do is that, uh, in the next video, we are going to get started.
And uh, now, uh, the first step is done.
Lang, Chen, Lang, Smith and Lang serve.
Lang serve.
Also, I'll be talking more about it.
Like what kind of code will be writing for this?
You don't require any portal sign up as us only Lang Chen and Lang Smith you basically require.
Okay, now in the next step, we will use the most basic and common components of Lang Chen like prompt
templates, models, and output parser.
So, uh, I hope, uh, you were able to understand this video.
This was it from my side.
I will see you all in the next video.
Thank you.