Build Python LLM apps in minutes Using Chainlit ⚡️
Skills:
LLM Foundations80%
Key Takeaways
Builds a simple LLM app using Chainlit and LangChain to create a ChatGPT-like interface
Full Transcript
hello guys my name is krishnaik and welcome to my YouTube channel so guys another amazing library that I really want to talk about which is called as chain let it is an open source python package which actually helps you to quickly create llm apps you know so large language models obviously we have discussed till now we're related to open AI llm models right and we have also discussed about Lang chain I've also shown you a couple of examples but yes uh let's discuss about this amazing Library which is called as chain lit over here you can basically see it it is an open source python pycus that makes it incredible fast to build and share apps right so I'll just show you this because see in the end of the day you are specifically using an open AI API itself but this kind of packages are making it pretty much easier for you to actually use the llm models and even create your own right and again there is a big number of documentation for this there are amazing callback functions decorators uh you'll be able to see like uh there'll be events like on message on chat start you'll be able to really customize your entire application in a very easy manner but again uh this is just a introduction video to begin with you know uh I am definitely planning to create an entire playlist on open AI uh Lang chain and channel 8 it'll be a detailed one just wait for some days you know I'm planning for that first of all I will complete the series of recording then I'll start uploading it it'll be pretty much amazing for you all right but again try to use this channel it I really liked it uh with respect to the implementation let me show you a couple of examples over here so here you can basically see everything is same you can actually use Lang chain you can actually use open AI you can use prompt template you can use llm chain this is what we specifically use in open AI or we specifically use in Lang chin also right along with this we'll import chain let as CL but before that always make sure that that you install this chain lit right in order to install it all you have to do is that let's say I'm opening my terminal over here because I'll show you a couple of example it's quite amazing couple of examples that we are trying to see over here so if you really want to install it all you have to do is that just go ahead and write pip install chain lit right and once you do this automatically the installation will basically happen and once you're able to install this at the end of the day you just have to use this okay now chain lit has lot of events okay so over here what we are specifically doing I will just explain you the code and this kind of code I have already written in the previous tutorials related to open Ai and Lang chain so here I'm importing chainlet along with this I am using this openai key which you can probably get it from the open AI website itself and then I'm setting up the environment of the open AI API key to open AI key now this is my question that I'm actually creating and this was in a very simple way question is equal to question and the answer let things step by step it will probably first of all provide the response like this and then it will give you the answer okay and here you will be able to see this is nothing but this is The Decorator that we are specifically using CL dot lanchenfactory now this luncheon Factory if you probably seen the documentation over here so if you see in Lang chin here in Lansing post process see over here Lantern factor is there Plug and Play decorator for the Langston Library the decorated live function should initiate a new Lang chain instance it is already initiating a new luncheon instance you don't have to probably create a new instance over there automatically with the help of this particular decorator it will do it one instance per user session is created and cache the per user instance is called every time a new message is received right so as soon as you probably receive a message then again you go ahead and write it automatically it will be able to take care of it you know so this is what is an example over here I will show you more examples as such as we go ahead right now what we are going to do we are going to just initiate this Lang chain Factory always make sure that this all works in a sync manner a sync Banner basically means even though you are sending a request some process is continuously happening in the back end and it will be able to send you a response as soon as possible right and parallel responses also you can probably get over here I have defined a function Factory but on top of it this is the super important thing a decorator right then we are defining the prompt template over here and we are defining the llm chain over here right in a learn chain what I'm giving I'm giving my prompt then I'm initializing open Ai and verbose is equal to true this is it okay automatically because of this particular decorator it will be able to give you the right response let me just show you now and in order to execute it uh the execution like how we specifically use in streamlit library similarly we have to probably use something like this okay let me just show you okay CLS CLS okay chain let see this chain let run this Pi file so what is my Pi file over here so over here you will be able to see my Pi file is nothing but the command for running this particular file see Channel it run and here I will remove this launching.py instead whatever file name I have over here chainlit.py it will take up that and then you can use minus uh minus sign and W okay so this is what is the uh thing that is used the command that is used like how we specifically use streamlit extremely run that particular py file similarly over here chain let run whatever file name is there dot py with W as the additional symbol that is specifically required so once we execute this you will be able to see that now I have not even used any UI but you will be able to get a kind of UI over and by default this information from where you are specifically getting if I probably show you I have a readme file over here okay so if I probably show you this this is the readme file and by default it is taking this specific readme file over there okay if I remove it I think it will not show anything as such okay so but by default let that readme file be over here now if I ask any question okay tell me about deep learning one amazing thing is that you get a good UI visibility over here uh there are a lot of inbuilt decorators which actually make it very very easy for you to learn it even to customize this entire application so here you can basically see step by step everything is basically given and this is the response from the llm chain uh since we have used llm chin now one amazing thing about this is that in Langston also we can integrate with third-party apis Google search API and all okay but uh I tried with chainlet over here and chainlet was able to give us this integration in a very smoother way okay I'll just show you an example why I'm saying this so let's say this is one example that I've used over here here I'm trying to integrate with tools agents also okay so here you'll be able to see I'll be importing open AI llm matching to perform any kind of mathematical operations and providing the response with respect to that that this library is used search serp API wrapper this is basically used because uh for exploring the Google search API suppose if I want to integrate my code with the Google search API and probably get the response over there let's say if I'm first of all asking the open AI if the Open Air does not have any response then it will send this response to the Google search API you know so that I will be able to get the answer from there okay and as you know uh if I consider with respect to charity but it is only trained in 2011. along with this in Langston you also have agents okay so you have like initialization agent and you can specifically use this llm match chain in the form of tool also to validate something and then in Langston you also have chat open a a open AI all these things are there along with this what I'm doing my search API and open key API is present in this constant.poi file I'll be using this on top of it I will be using chain link now you here you can basically see I'm using all these libraries like Lang chain link chain agents chatbot chat models everything is same whatever I've shown you in with respect to the land chain itself but on top of it if I use this chain lit now what is the power it will be showing you right right so I'm using a OS dot environment of open API key and serp API underscore key now this key also you can basically create it is completely for free just go and search for surp API and also create will tell you to make an account over there it will create a Google search API key itself okay and that key is basically required and already a wrapper is created so that it can basically use this API and search for anything in the internet now the Search tool has no async implementation we fall back to sync okay so here you will be able to see I will be using CL dot launch in Factory similarly over here now first is my chat open API AI okay so if there is a response with respect to this why I am using this I'll let you know then second open AI obviously you know how to use this open AI you will just need to initialize the temperature over here and this is basically for my search API wrapper right now see this amazing thing okay I will be using this llm model llm model this this llm model for initializing my llm match shape so llm matching Dot from underscore llm if you probably see this particular code all this is given in a documentation guys but I just want to show you the power over here llm is equal to LM variables is equal to True right so this becomes my tool to validate any mathematical things that I am probably asking this chatbot okay now all these tools I will try to initialize it see one tool that I am using is I'm given the name as search and using the search wrapper dot run that basically means whatever Google search I'll be doing I will probably be doing from here okay and the fallback is quite amazing I see let's consider that my llm one has not given any response okay or it has given that it does not know any kind of response so what will happen this will fall back to this particular response okay and description I have given over here with respect to the current events now the next tool that I am going to initialize is for calculator okay now if I am using calculator I have to use this llm underscore mat underscore chain dot run so that whenever I try to provide any calculation with respect to a mathematical formula or anything this will be responsible this tool will be responsible so I have combined two tools over here in the list and finally we initialize this agent okay this agent will be responsible in executing all these tools so first tool is nothing but this specific tools both these tools are available over here llm1 is my open AI an agent that I am specifically using is something called a chat 0 shot react description the different different agents okay when I probably create a detailed playlist about all these things I'm planning to don't worry about anything this week I already am going to become very active in providing you open AI tutorials lunch and tutorials we will Deep dive everything and we'll also see chain let also and multiple examples okay so finally you will be able to see that instead of using charge zero short react description there is also another agent you can also use it okay but uh most of the tasks will be done by this now let's go and execute this now you will be able to see how amazingly it works okay so first of all let me close this okay the previous project that I was running now I'll run um now I'll run mrkl dot py okay so this is my file name now once I execute this you will be able to see something quite amazing so okay there's an error okay it is Mr okay so I have written m r e just a file name mistake okay now once it is executing you will be able to see I have my this okay let's say I will write what is 28 multiplied by 124 5 okay now see this it will use all the tools that is available over here see it is saying using calculator using llm chain okay so llm chain thought I need to use the calculator tool see that that callback is going to the calculator because obviously 11 chain will not be responsible in calculating things now there is a math llm chain that is there okay uh over here okay now let's say uh what is the recent what is the recent current news so let's see so using search it has done using search okay view the latest news and break in CNN.com so who is giving this particular uh action is search right and as you know the action is search is nothing but it is basically the Google API search right so over here this is nothing but search daughter okay um tell me the recent development in the field of blank chain okay I'm just asking this question because charge if it will not be able to provide us this specific output so it is basically Now using Google search API right I just showed okay I should not had written in the field of language but instead something else okay in the field of L see Langston is a fast rising llm application framework created by Harrison Chase dot JavaScript developer needs to be aware of okay good now just by using this application you are able to use each and everything right so that is the power how quickly you are able to create it and I hope you were able to like this particular tutorial at the end of the day we will try to see that how quickly we are able to build llm application don't worry I will be coming up with a lot of tutorials as I go ahead so yes if you like this particular tutorial please make sure that you hit like subscribe and share with all your friends I'll see you all in the next video have a great day thank you take care bye
Original Description
Check Chainlit documentation: https://docs.chainlit.io/overview
Chainlit is an open-source Python package that makes it incredibly fast to build and share LLM apps. Integrate the Chainlit API in your existing code to spawn a ChatGPT-like interface in minutes!
#chainlit
----------------------------------------------------------------------------------------------------
Join the PWSKILLS Data Science Masters Course
Best Affordable Data Science Course From Pwskills(6-7 Months)
Impact Batch 2.0:- Data-Science-Masters (Full Stack Data Science)
1. Data Science Masters Hindi: http://bit.ly/3TPdrDz (Hindi)
2. Data Science Masters English: https://bit.ly/40gZ9hn (English)
Direct call to our team in case of any queries
+9186600 34247
+919880055539
+918147625763
+918660034247
+918951939425
---------------------------------------------------------------------------------------------------------------
►Data Science Projects:
https://www.youtube.com/watch?v=S_F_c9e2bz4&list=PLZoTAELRMXVPS-dOaVbAux22vzqdgoGhG&pp=iAQB
►Learn In One Tutorials
Statistics in 6 hours: https://www.youtube.com/watch?v=LZzq1zSL1bs&t=9522s&pp=ygUVa3Jpc2ggbmFpayBzdGF0aXN0aWNz
Machine Learning In 6 Hours: https://www.youtube.com/watch?v=JxgmHe2NyeY&t=4733s&pp=ygUba3Jpc2ggbmFpayBtYWNoaW5lIGxlYXJuaW5n
Deep Learning 5 hours : https://www.youtube.com/watch?v=d2kxUVwWWwU&t=1210s&pp=ygUYa3Jpc2ggbmFpayBkZWVwIGxlYXJuaW5n
►Learn In a Week Playlist
Statistics:https://www.youtube.com/watch?v=11unm2hmvOQ&list=PLZoTAELRMXVMgtxAboeAx-D9qbnY94Yay
Machine Learning : https://www.youtube.com/watch?v=z8sxaUw_f-M&list=PLZoTAELRMXVPjaAzURB77Kz0YXxj65tYz
Deep Learning:https://www.youtube.com/watch?v=8arGWdq_KL0&list=PLZoTAELRMXVPiyueAqA_eQnsycC_DSBns
NLP : https://www.youtube.com/watch?v=w3coRFpyddQ&list=PLZoTAELRMXVNNrHSKv36Lr3_156yCo6Nn
►Detailed Playlist:
Stats For Data Science In Hindi : https://www.youtube.com/watch?v=7y3XckjaVOw&list=PLTDARY42LDV6YHSRo669_uDDGmUEmQnDJ&pp=gAQB
Machine Learning In English : h
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Krish Naik · Krish Naik · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Natural Language Processing|Stemming
Krish Naik
Natural Language Processing|BagofWords
Krish Naik
Gaussian distribution or Normal Distribution in statisctics
Krish Naik
Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Krish Naik
Log Normal Distribution in Statistics
Krish Naik
Covariance in Statistics
Krish Naik
Confusion matrix, Precision, Recall| Data Science Interview questions
Krish Naik
Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Krish Naik
Implementing a Spam classifier in python| Natural Language Processing
Krish Naik
Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Krish Naik
Face Recognition using open CV and VGG 16 Transfer Learning
Krish Naik
Pedestrian Detection using OpenCV from Videos
Krish Naik
Face and Eye Detection from Videos using HAAR Cascade Classifier
Krish Naik
Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Krish Naik
OpenCV Installation | OpenCV tutorial
Krish Naik
Face and Eye Detection from Images using HAAR Cascade Classifier
Krish Naik
Car Detection using HAAR Cascade and Opencv from Videos.
Krish Naik
Using OpenFace for Face recognition in Keras
Krish Naik
OpenPose Tutorial with Tensorflow
Krish Naik
Multiple Linear Regression using python and sklearn
Krish Naik
Dimensional Reduction| Principal Component Analysis
Krish Naik
Movie Recommender System using Python
Krish Naik
TPR,FPR,FNR,TNR, Confusion Matrix
Krish Naik
Precision, Recall and F1-Score
Krish Naik
Artificial Neural Network for Customer's Exit Prediction from Bank
Krish Naik
GridSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
RandomizedSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
K Nearest Neighbor classification with Intuition and practical solution
Krish Naik
K Means Clustering Intuition
Krish Naik
Create custom Alexa Skill- Lambda function- Part2
Krish Naik
Hierarchical Clustering intuition
Krish Naik
Implement Transfer Learning with a generic Code Template
Krish Naik
Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Krish Naik
Unlock Your Application With Your Face using OpenCV
Krish Naik
Draw rectangle from webcam and sketch process it on a live feed
Krish Naik
Complete Life Cycle of a Data Science Project
Krish Naik
How we can apply Machine Learning in Finance
Krish Naik
Deep Learning in Medical Science
Krish Naik
How to switch your career to Data Science.
Krish Naik
Linear Regression Mathematical Intuition
Krish Naik
Handle Categorical features using Python
Krish Naik
Machine Learning Algorithm- Which one to choose for your Problem?
Krish Naik
DBSCAN Clustering Easily Explained with Implementation
Krish Naik
Curse of Dimensionality Easily explained| Machine Learning
Krish Naik
Feature Selection Techniques Easily Explained | Machine Learning
Krish Naik
Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Krish Naik
Cross Validation using sklearn and python | Machine Learning
Krish Naik
Handling Missing Data Easily Explained| Machine Learning
Krish Naik
Deploy Machine Learning Model using Flask
Krish Naik
Deployment of Deep Learning Model using Flask
Krish Naik
How to Visualize Multiple Linear Regression in python
Krish Naik
K Nearest Neighbour Easily Explained with Implementation
Krish Naik
Predicting Heart Disease using Machine Learning
Krish Naik
Predicting Lungs Disease using Deep Learning
Krish Naik
Stock Sentiment Analysis using News Headlines
Krish Naik
Random Forest(Bootstrap Aggregation) Easily Explained
Krish Naik
Voting Classifier(Hard Voting and Soft Voting Classifier)
Krish Naik
Credit Card Fraud Detection using Machine Learning from Kaggle
Krish Naik
Hyperparameter Optimization for Xgboost
Krish Naik
Tutorial 45-Handling imbalanced Dataset using python- Part 1
Krish Naik
More on: LLM Foundations
View skill →Related Reads
📰
📰
📰
📰
I Taught an AI to Recognize the Shadows of Four-Dimensional Objects
Medium · Data Science
Changes to LLM pricing: Novita, OpenInference and StreamLake
Dev.to AI
ChatGPT in 2026: Why It’s Still the Most Searched AI Tool on Google (And How to Master It)
Medium · ChatGPT
A Tiny LLM Request Recorder I Use to Reproduce Production Failures
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI