Integrate ChatGpt in asp.net core

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends welcome to code heaven today I'm going to show you about this about this AI technology that we've been this is pretty much which is very famous nowadays that's called chat GPT so we are going to integrate our dotnet project with uh open AI apis so that so that we can generate so that we can generate Auto completion text in our API so let's get started so for that let's make a new project the project uh would be an API project so it's asp.net core API project and let's name it open API next let's use.net standard seven API support we can either use controllers or use minimal apis so let's use controllers for now just to test because there's lots of already set up in controllers with meanwhile and apis where I have to can set up many more things let's use controllers for now and after that it's come in so we've got controllers here and we've got program file here which is our main file recording builds Swagger as well for this set GPT what we will have to do is we'll have to now and let me open a new browser now let's look for open API foreign [Music] API where is the open API chat that's this one so we'll have to go to API and it's foreign with Google yes so we've signed it positive so there are lots of options here like we can build a text you have completion code completion fine tuning imagination and backings but before that we will have to go to personal to get our API keys so let's send it to New API key so this one this is our API key let's save it I'll save it in save it in my notepad for a moment okay so this is our API key now what we will have to do is and we will generate a controller will have to add [Music] we'll have to add open API SDK so there are two ways we can either use the recipients install this one it's now installed okay so after installing what we will have to do is now let's create a controller let's create a new controller called this and create an empty controller let's call it open AI for two alone and in this open AI controller part will have these let's uh go ahead and let's make it here result and like this post is going to be post because Maybe attention from partying string brought so now we'll be putting some I will uh between the API key so the API key it would be the one that we saved before there's this one and here we go return view actually this is meant to be an API controller will list API make this as later on over each guys answer you know it's pretty fast think that empty now open your eyes open foreign [Music] Maybe spring these are which is provided by I'll open the istp and uh so we need this conversation that Trump now it's going to prompt Publications but and cognition is will make a loop what is loop inside the result complications [Music] Loop for cancer values answer is equal to I can start the text and then we'll return okay and we'll return this inside here for else if result is null then what we have to do is which is going to turn back list not uh so in our code we have created an endpoint will get answer variable API key is holding the API key that we have generated and we've created an object of completion requests because we need to define the model type and next weapons Max token will decide the length of the text so if you want a long answer then keep the max token value large so if you want a long answer then we'll increase this tax token here now let's run this API and see the magic okay it's coming thank you so we've got weather forecast here let's check out if I'm going to podcast is running yeah Escape answer screen you know in this thing is execute books we've got some error here so it's a red limit reach for default um into text damage let's say in exception let's view details okay inside in your exception let's look inside your exception because power limit is 15 000. contact if you too many requests so it says too many requests okay so I think this issue is from the open AI so probably able to approve your requests that's all that so we can say uh okay yes let's Google this is very limited what do we do when we receive this kind of error okay I didn't find the right answer let's see what this one has to say I get same here in fine source so many people are getting the same there foreign [Music] let's try that foreign let's go inside this model so there are other more guests but this is the one we are using people is talking to text with this let's find the default one let's not let's not put anything in the model right for now okay sorry 24th one foreign [Applause] [Music] too many requests then only for default dark and see geometry it looks like there's issuing type in C1 instead of let's start with someone let's use some other models let's use this Christmas code okay huh does that make me a video so let's run this once again probably we're getting too many requests from many clients foreign this asks us looks like it's asking us [Music] our question capital of failure if you're lucky if the answer that's why once again saving some time for this leader once again too many requests let's try one second now we've got the answer it's it says camera you see the AI is working but the only issue in this AI is the server limit maybe it's getting too much maybe many people are using this AI they are getting too much server too much load in the server so this AI is working as expected so there could be many use cases for this AI if it work properly you can increase this with our like chat system you know any other messaging systems and so on we can make a chatbot with this one so this possible today thanks guys don't forget to like And subscribe and also share my my channel thank you very much Christmas us
Info
Channel: code heaven
Views: 380
Rating: undefined out of 5
Keywords: chatgpt, asp.net core, inegrate chatgpt in dot net core, chat gpt in c#, c#, openai, dotnet7
Id: ydJ2kEgXScE
Channel Id: undefined
Length: 23min 36sec (1416 seconds)
Published: Fri Feb 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.