HOW TO USE PERPLEXITY AND pplx-api WITH & WithOUT LLAMAINDEX πŸš€

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back in this video let's go through perplexity how the video will proceed is first I will explain you what perplexity is and what are the different functionalities of this particular website or let's say that they are also introducing the API I will walk you through that in brief and then I will show you how you can integrate the perplexity API with llama index in Google collab I will walk you through this particular notebook and once towards the end you can also create a simple interface with gradio which uh is what you are seeing on the screen Let's Get It Started okay first thing first you might be wondering what is perplexity if you haven't used it before I have already created two videos before about perplexity it is like a Google search but llm integrated into it let's say in that way for detail information please refer to these two videos I have already uploaded in YouTube but on a high level let me show you how it looks like without loging right it has three different things one is what you are seeing on the screen this is what you can just go ahead and ask things you don't need to even log in into the into the website and here there are many functionality as I said you please refer to my videos but there are some of the cool things here by default it searches across the entire internet with llm enabled inside it and next one there are academics you can just customize what you want and there is even this writing mode which I find it really interesting that it uh generate text or chat without searching the way meaning that it will use the default llm that it is being trained on for just to give you a glimpse here I can just say here is Sam Altman fired from open a so this is the question I it says as of my knowledge update in September 2021 this is not fired right because it just went through that particular model but now let me go into new thread and let me copy the question let me go here and I can go to all now if I go here and ask the same question what it is going to do now is using the same model but then now it has the internet assist it says yes he has been fired from open by the way this is just November 19 so he there is a rumor that he he's again going to come back but and anyway we don't know if he will be back or not as of today but there is drama going on around open Ai and we don't know what things will happen in the future but yeah this is how you can use now let me close this actually and now this is the one that I have already upgraded to the pro version but you can you don't need to upgrade to pro version if you don't want to use the advanced functionalities what does pro version include if you go to this Pro icon here more co-pilot and it might be also confusing that you might think this co-pilot is similar to GitHub co-pilot but it's not this co-pilot is how it will guide you in in searching things let's say and then there is unlimited file upload powerful AI models meaning that upgrade to Cloud 2 or gp4 for more accurate answers so you can call 300 plus uh request per day and there is API assist as I said you this is what I'm going to show you later unlock our fast API for open Source language model you can play around with open source model directly from the API so yeah these are all the things which you get from the pro version but if you are not in the pro version also if you are logged in then you can have access to the co-pilot as well as your threads meaning that a conversation will be saved here refer to my videos a videos for more indepth things but now after I upgrade this if I go to this settings here you can see that this is my my account let's say settings and you can even have the AI profile meaning that you can say okay I am something and just answer this it's kind of a person tell the AI about yourself to get personalized answers you can even go here and save this it will be personalized to you but in the settings as I said you before also if you scroll a little bit down so you can choose different models so you can if you want to use gp4 just choose the gp4 and then your answers will be from gp4 model and this is the API that I'm going to talk you by the way I'm showing you this because I'm going to delete this once I create the video and how do you know that you are using gb4 that might be one good question if I now select here gp4 let me go here and now okay what is lexity AI right it will answer us what is perplexity AI so it is this this this kind of things but when it answer for us by the way it already provides the references that I missed to show you because it provides us the resources also from where the answer is taken from but the thing that I want to show you here is okay it's answering a lot but you see here there's GPT 4 being shown meaning that the answer is from gp4 and if you choose Cloud A2 then it will show here the cloud I hope that is now clear you can just play around with this but if I go to the main page there is more here because there is the thing called Labs also I want to also little would explain this if I go into the labs this is the new UI that they provide what is this this is a playground and there are different models as I said you we can play around with the API but if you just want to test what are the different models you can go here and test if you see here there is this perplexity 7B online there are other models also that you can choose from here let's say I want to go with mol 7B instruct then I can go here and ask questions related to this particular model it is really helpful if you want to just play around what different models perform Let me just go and ask what the same question that I ask before let's say is Sam Alman is still at open here it does not know because this is just the M 7B inst it says yes Sam Alman is still the CEO of open he's founded this this this and now the good part here is it will also show you okay 0.26 seconds to First token there are 192 tokens per second there are 33 tokens and it took 0.17 seconds these are the things that you can just go here and play around and compare this with other different platforms also because you don't necessarily need to use this platform it's just that it's easier to explore different things you can just go here and play around and there is this perplexity API that is what I'm going to go through next and one more thing before that is also if you go to this blog they have well documented the things also there as it happens and this is what they are going to use turbocharging Lama 27b with Nvidia S100 I don't want to be too technical but what they are trying to do is they are trying to use the more powerful nvd gpus in order to use the Llama to 70 billion that is what we can also use using the API right now let's go through the API I can go through this link it takes us to the uh website here so it's introducing the blex city API and just you can just go through here it says that uh we are excited to introduce this designed to be one of the fastest ways to assess mistol llama to code lama lama 270b repete code and they will be adding more as it happens but yeah just go through here and see what is the what is the difference between other providers and these providers also this is up to you but then what we can do now is we can go and actually try let's say how we can implement this with llama index first I will also show you if you don't want to use llama index how you can use it but yeah let's go through that right I am now in the Google collab first thing first what we need to do is install the necessary packages here is llama index gradio I'm going to show you in the last and watermarket just to display things here so I'm using these different versions just to show you that it works for you also and then this is the setups I I have taken this documentation from the Lama index uh website they have provided this and from here you can see there are the different models that it supports right so as of for November 14 the following models are supported with the perplexity LM class in Lama Index this can be updated when you watch this video and there are some of the documents here let's first go through that little bit you can find the latest supported models here this is what it is shown here but you can go through this link and it takes you to this particular website so here as you can see this is the uh website of perplexity and you can see different models here and just to show you okay let let's first go through this particular website so it's easier right okay perplexity API reference get started on the left side you can see there is this getting started and it is shown here there is the rate limits also so what are the rate limits for different model you can see from here there is supported models which I just showed you this is taken from there so you can just go here and and by the way they are going to increase the context length of mistol and open harest to mistol 7B to 32k tokens so there is also the road map when they are going to do this here is the road map you can see here there are the different things like early November and all the different things and there is this perplexity bot you can just go through this and the pricing pricing is here by the way for upgrading you need to pay of course because the pro version is not free but right now this pricing is not yet impl implemented as it is says the following price structure will be implemented when perplexity API is released to the public the pricing this pricing model is currently not in effect currently we don't need to let's say that in this way currently when you use the API key it's not the cost is not linked to how much tokens you are using it's just from the pro version you can use whatever you want but in the future this is what they have mentioned here that they are going to charge this for for different models this is how you can just go through here and there is this API reference also if you go here it will show you that there are this is the API and there are two uh completions input there is one chat completions and there is the completions in point you can just go here and provide your token and just play around already in the website also and then you can just go with different languages here now let me go back to the document or the Google collab notebook and this is how it works as I said you without llama index also you can use there is the link for you just go through this and there is the examples here introducing and if you scroll a little bit down so here is still more so here is the how you can use the call and then there is also the example with python here this is how you can use with the python normally with the the interesting part here is that they can they are using the open. create and providing the myal model and the base is perplexity it's quite interesting but this is how it works according to them now let's go to the Google collab again and now this is how we can use with Lama index so first you need to get the API key that is what I showed you in the beginning in the website itself if you go to the main perplexity website here in the Pro I showed you here there is the API Keys you can go here and create new if you want this is how you create as I said you again I will show you I will delete this please don't mention in the comment section that I showed my API key and now let me go to the Google collab again and here this is how it works from lav index we llms we import the perplexity and this is the perplexity and API key is what we provide from here and then we choose the model and the temperature you can just play around here and by the way this model you can just replace this with the different models what you want from here to get the right answers for you whatever you want to use and then you just import the chat message this is what we just provide the system message and the user message and yeah this is just the messages part here and then there is a chat you can just say okay llm the chat and provide this there is the chat message here and then again s sying chat this is just await and await things you can provide to just don't wait because this here we just have the simple question but let's say that we have many questions and I hope you know how ASN chat works that you don't need to wait for one response there's the streaming feature also so you can just use the streaming lm. stream chat and stream chat with the async also this is how it works and yeah it's really good and the the thing that it's quite fast I can just run here just to show because it doesn't take that much time so this is the API key I can go here I can import this and there is the chat message and now I can just go here and print okay provide me the answer so tell me five sentences about Sam Alman it says okay Sam Alman is an American entrepreneur this this this he has also solved as CEO as this yeah so different things are mentioned and by the way here you can see that it is not mentioning anything related to the open AI things right and now if I go here and again run this as you can see here before when I run it is showing here CEO of open so this is how the llm works so you need to be really careful when you work with this and now as you can see it is showing us the answer so always be careful when using the large language models and now if I just want to use the stream chat here it's just streaming if you see that it streams the chat and yeah as as you again see here there are the different answers when I use the a sync maybe now it will show again the open so one thing what I noticed here now is when you use the asnc it is shown here that is is the CU of open AI here so it is shown here but here it is it is not showing here for some reason I don't know but now okay that's that's great but how can you just create a simple interface just import gradio and just install the gradio first and then just Define a function which we just provided up here we just wrap that into a function and then we just get the response and pass that into the interface I can just do import gradio and then I can create the function and I can pass that function into the interface and I will say Okay input is text and output is also the text so I can just say I face launch and now this is going to launch so it says here okay you need to okay query through in Google requir sharing enable settings this this this and this is what you can just go here and run the same things okay who is Sam all it will provide us the answer right here right this this this and but if you also want to share the with someone else as you can see here you can just click this and you can share this with other also and this is the and I think it says here something okay Google collab request you can turn this off by setting this and this this this okay if you want to see because this is the https so running on the public Ur you can directly run in Google collab itself and also if you click this it is going to run here and I can ask whatever questions I said let's say what is why spark not always the same Alman right so I said what is p spark it is going to provide me the answer by the way you see that how fast it is it's not that noticeable compared to the open ey models also and it's quite accurate in in a sense that open eyes model is quite big but this is fine- tuned in such a way that the latency is quite quite good and then the answer also quite good here but I'm not going to compare the answers it's just how you can use model from the perplexity using their API things they have said that they are going to improve this and yeah you can just use any models you want from different platforms but the fact that I'm using since it was introduced and they have introduced so many good features as they progress so I I just want to let you know that okay there is something like this you can just go there and give a try yeah thank you for watching and see you in the next video
Info
Channel: Data Science Basics
Views: 3,108
Rating: undefined out of 5
Keywords: perplexity AI, what is perplexity ai, perplexity vs google bard, google bard vs perplexity, perplexity ai vs chatgpt, chatgpt vs perplexity ai, bing vs perplexity ai, perplexity ai tutorial, perplexity ai how to use, perplexity ai iphone, perplexity ai alternative, perplexity ai chrome extension, perplexity ai review, perplexity ai vs openai, perplexity ai vs gpt4, perplexity ai vs chatbot, llm, openai, chatgpt, google bard, perplexity api, use perplexity api in llamaindex, ai
Id: PHEZ6AHR57w
Channel Id: undefined
Length: 16min 56sec (1016 seconds)
Published: Sun Nov 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.