Hello guys.
Now we are going to continue our new end to end project, uh, Gen AI project.
And here we are going to specifically use grok AI inferencing engine.
Okay.
Now what exactly is grok.
So it is an amazing platform which actually provides you open source models or LLM models like Gamma
Llama three, Mistral.
And you can use all these specific models to probably create an end to end generative AI application.
Now, first of all, you need to understand why grok.
So if I go ahead and click on this particular link and go over here, you need to understand that grok
is a fast AI inferencing engine.
It uses something called as language processing unit.
Right.
So guys, uh, in this entire world, right, specifically in the development of generative AI field,
you'll be seeing many, many companies who are coming up with amazing LLM LM models.
Let it be paid or open source, but that company is going to win, which will be able to provide an
amazing inferencing in a small in, in, in, let's say in some seconds I should be in some milliseconds
I should be able to get the response.
And right now, the research that is specifically happening with respect to the LPO inferencing engine
actually makes it possible.
Okay.
So, uh, an NLP inferencing engine with LPU standing for Language Processing Unit is a hardware and
software platform that develops, uh, delivers exceptional compute speed, quality and energy and efficiency.
Let me just zoom in so that you'll be able to see it much more in a better way.
This new type of end to end processing unit system provides the fastest inference for computational
intensive application, such as AI applications like large language model okay.
And over here it is also given why it is so much faster than GPUs, right?
So LP is designed to overcome the two bottlenecks.
One is compute density and memory bandwidth.
So you can read more about grok over here.
Okay.
And I feel that yes, this is the company that can actually provide an amazing inferencing because I've
been using this.
Okay.
So in this video I will talk about how you can go ahead and create your API in Glock Cloud and how you
can use all these LM models and start creating your project.
So first of all, I will just go to the Glock cloud, and the first thing that I am actually going to
do is that go ahead and create your API key.
So here you also have a playground where you can probably play with all this, uh llama three models
and all.
So if I go ahead and just say hi, I should be able to get the response very much quickly.
And we'll also be measuring the time like how quick it is.
So first thing first we will go ahead and create our API key.
Just click on the API key over here I've created multiple times, but let's say any of the API key that
I want to use, I can go ahead and use it.
Right.
So in order to create it just click on create API key.
I will say this is for my project over here.
So I'll just go ahead and click on project and click on submit.
So please make sure that you copy this API key.
It starts with GSK underscore.
So I'll copy this.
Go to my project over here okay.
And here you can see I've created my fourth folder which is my fourth project right now rag document
Q&A.
I'll go to my dot env file and make sure that I have this key pasted somewhere.
Okay.
Now, if I'm using this particular key, what should be my environment variable that also we need to
know, right?
So I will just go ahead and write grok underscore API underscore key.
Right.
So this is my environment variable over here.
And now it's time that we will go ahead and start writing our code okay.
Now understand, one thing is that we will be using the specific key to access all the LM models that
is available over there as an open source.
Okay.
So let's go ahead and let's start our coding okay.
Now before I go ahead, uh, we need to also make sure that we need to install some of the libraries
that is required uh, required in requirement dot txt.
And if I really want to work with both lang chain and grok.
So like how we have this lang and underscore hugging face lang and dash OpenAI.
Similarly, I will also be using one more library which is called as lang in grok.
Okay, so once I do this, I will go ahead and save this.
And now I'll go back to my app Dot Pi.
First of all let's go ahead and install this entirely.
So I'll go ahead and write CD dot dot.
I'll go back to my parent folder and go ahead and write pip install minus r requirements.txt.
Okay.
So now the installation will entirely happen over here.
So here you can see this particular library of grok will also get installed.
Right.
So we are perfect to go ahead.
And we are getting started with grok okay.
Now uh quickly let's go ahead and import all the important libraries.
And then we are good to go okay.
Okay, now these are some of the libraries that I'm actually going to use.
So first of all I'm going to use uh Streamlit okay.
Then I'm going to use Chad Grok.
So this is what I'm actually want.
So I have go ahead and say from lecture underscore grok import Chad Grok.
And then I'll be using OpenAI embedding.
See uh it is not compulsory that you need to use OpenAI embedding because I know that this will be paid
with respect to an APIs.
So what you can actually do, like how we did it in Olama.
Right.
You can actually use this Olama embeddings.
So if you remember with respect to Olama, when we were discussing over here some or the other way,
or if you go back to your code over here in the, uh, let me just have a look over here in the embedding
techniques, I can just go ahead and use this embedding.
Right.
We can also go ahead and use this.
I'll copy this entirely.
And, you know, try to save some bucks of yours and try to paste it over here.
So I will go ahead and use this.
All of my embedding okay.
For my application.
Now the next thing is that from Langston dot text splitter I'm importing text recursive character text
splitter.
Then from Langston dot change dot combine documents, we are going to import create stuff document chain.
Now this is where it is very much important.
And this is specifically used in drag application.
We'll be discussing more about it why we'll be using it.
Along with this I will go ahead and write from lang chain underscore code dot prompts.
I'm going to import chat prompt template because we need to define our chat prompt template.
And then finally we'll also be using from lang chain or chains.
We'll be using this creative create retrieval chain.
Now, this two, uh, libraries that we have imported, this is really important for any, any, any
rag document, Q&A applications or any Q&A application.
In short, like let's say if there is an external data source and we really need to want to interact
with it, right?
So we will definitely be using this along with this, uh, we are also going to use this vector store.
And then we'll also be using this document loader which is called as py pdf directory loader.
So uh yes this was the basic import that we have done.
Now we are going to probably create an end to end application.
And we'll continue in the next video so that uh, we'll go ahead and do the further discussion.
Like what all things how to import this libraries and all and how to uh, load the environment variable
of grok API.
So yes, uh, this was it.
I'll see you all in the next video.
Thank you.