Azure OpenAI Embeddings QnA Sample | Upload your Enterprise documents directly on the Custom Website

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back in this video we are going to set up Azure open AI Ambience q a this repository allows you to upload documents on a website for which you want to enable the embeddings and connect it to the cognitive search plus Azure open Ai and you can ask the questions based on your documents so instead of directly putting them into storage account you can upload them through the website and it will be directly available you can also delete those documents directly from the website so this is a simple architecture diagram so where users will interact with the model by asking their questions and it will just look at the vector database and get some data and also after retrieving some data from the vector database it goes to the Azure open Ai and give the response generate the response from the on top of the retrieved value from the vector database and on the other hand it uses Azure form recognizer to retrieve your content from the documents that you upload currently this model only supports PDF JPG files and yeah text files it doesn't support Word document but yeah you can modify this sample in order to support that also it has multiple Solutions one of the solution is using Azure cognitive search as the vector database and the one it uses Azure cache for radish Enterprise and another one it uses redis search so these three different solution it has so I'll be just picking up the first one Azure cognitive search and you can just click on this single button to deploy the whole solution so let me just guide you with that before filling those values out let me quickly check if I already have an Azure open AI resource created for me so that I do not have to create it again okay I do not have all right so select the subscription which has access to the Azure open AI then you can either create a new Resource Group or select the existing one so let me create a new one select the region and also resource prefix this will be used for all the other resources that will be created as part of this deployment so this is my resource prefix this name will be used and here you can see how it is concatenating with search plan Str site so basically JD Bots q a dash search will be used for the Azure cognitive search resource name and similarly so on um I did find something that the free resource doesn't work but we can quickly try that out now and before trying that out let me quickly check if I do not have already have free source into my subscription okay I do not have a resource let's select free plan for now and then we can move ahead for after that and this one hosting plan yeah this is really important it doesn't support free plan or shared plan this is the hosting plan for the functions so I'll be going ahead with the B1 plan the next apart from the free and shared then storage account name website name function name application inside translator name and Azure open AI name so let's uh give a name and if at all you already have an open AI resource created you just need to give that resource name and also provide the open AI API key so that it directly connects to your existing resource if you do not have an existing resource you can leave this field blank and just give a name and also what model you're targeting so I want to Target the chat GPT model so here's a table which shows you the possible values of all those fields so open AI engine the default value it is having is text in c003 so I'm going to change that to gpt35 Turbo and since I am targeting the chat GPT models or I can say chat completions model so I need to replace this text with chat the all the instructions are here open AI deployment type text text for instruction engine chat for chat based deployments okay if you have access to gpt4 on your Azure open AI subscription then yes you can use the gpt4 as well currently I do not have access so I'll be just going with the 3.5 Turbo and also what embeddings model you are targeting you can mention that I'll be just keeping those fields as default and click on next so I am not pretty sure what should be the Azure cognitive search SKU I have selected free but yeah let's see if it works for free we are good if it doesn't we'll have to come back and change that to basic plan okay let's create it can take anywhere between two to five minutes or even more if at all any error has occurred it will show up here based on my current experience I find that the cognitive search resource deployment has been improved earlier it used to take around 8 to 10 minutes just for the cognitive search deployment and now they have improved it takes less than a minute for the deployment to happen but yeah it may vary subscription to subscription so it's just my experience on creating these resources I am assuming all the resource have been created and now it is just running that deployment script for the website so here's the code available and here is the front end piece I haven't explored the code yet but yeah you can explore it these are the apis that will be deployed to the Azure functions one of them is this one okay let me show you the API documentation that will be much better so once you deploy this particular model that also enables you to access the apis from your custom application and here's the documentation for that okay so you can use a q a API on your data exposed by the Azure function for batch processing so this is the overall body parameters that it supports and here is the individual example how you can call those apis if you are not using the history then you can call the API using this basically your function batch processing function URL slash API slash API q a and in the body it's a Json body so just pass on your question if you want to enable the history as well as in a chat mode then you can pass on the history as an array yeah so I'll be showing you how how we can call this API through the postman then you can easily incorporate those in your custom application [Music] foreign let me also prepare the postman so that we do not waste much of the time during after deployment it's a post request and also let me have a look at my Azure functions so that I just copy the URL directly let's go to the resource Group open my function app click on functions and this is the one that is having the apis basically API q a you can also get the function URL from here yeah you can get the function URL from here just copy and paste it here okay and the body it's a Json body so I'll be showing you both ways with history and without history all right my body Json body is ready so as soon as the deployment is completed and we upload our custom document we are good okay I have my document ready it is on Quantum Computing I copied it from chat GPT so I'll be uploading this particular document on the website and also our deployment is completed let's go to the resource Group open the app service you can click on browse it will take some time for the website to get restarted or get ready for working and by the way yes it worked for the cognitive search on the free version that means we can easily lower our cost but yeah the free version only supports three indexes let me also show you the pricing of that foreign and you can only add one free cognitive service cognitive search per subscription if you already have a free cognitive search into your subscription you cannot add one more and the pricing goes on basic standard standard S2 all right so let's wait for this to get ready the website has been successfully started and we came across this error so let's see what does it say it seems to be the line in your source code and also the validation error one validation error for open AI embedding root did not find open API key so let's see if it if this deployment has created an open API key for us no it did not create not sure what happened but the first time when I tried it did create Azure open AI service but now it did not so let's create one with the same name that we have given so what where we can find the name you can go to your web app you can click on configuration if you already have an Azure open AI service and you have mentioned the name as well as key then you're good it will it will work since it did not create a open AI service let's see how we can fix that so here's the API base so this is the resource name that I gave during the deployment that is JD Bots open AI let me search open AI okay and make sure you use the same region that you selected during the deployment just to be sure that no problems happen after that and next next next and create okay so once this will be created I can just copy paste the key and paste it here under open AI API key currently the value is blank and you can also see all the values that you have set during the deployment so this is the one place where you need to modify the configuration and also you need to modify in the Azure functions let's see if we need to modify there as well let me also open the Azure function side by side so that we will change the configuration then and there itself open your function app click on configuration so the same configuration is valid for any number of functions that are available inside here functions settings okay so here also you find API base as well as open API key currently it is blank okay the deployment is completed if at all you create the Azure open AI service with a different name make sure you change this open AI API Base address as well So currently we'll be just getting the key and edit paste similarly for this one and also make sure you save your configuration after you have made changes and also make sure you restart the web app as well as the function app okay both of them are saved and let me restart the web app first and also restart the function app foreign check if at all any other service that might be using the open API key um I don't think so okay that's all right and one more important thing that you need to consider first go to your Azure open AI Studio and you need to deploy the model that you have given during the deployment in our case GPT 3.5 Turbo so I'll use create new deployment select the model since I use gpt35 turbo and I use the same name as my deployment name okay and create along with the chat model we also put the embeddings model into the deployment so this also needs to be added okay all right so now let's see refresh the web page and see if it works and also uh I am very amazed with the technology behind these web application nowadays so it all uses Streamlight so it doesn't require your web page to load so everything will happen behind the scene you can just write out and explore this front-end technology I really find it very cool and yeah it's very powerful for large language models all right uh something is running and it all happens in the real time so you will not find the web page loading so everything will be happening in the background on the single screen okay so the first step you need to check if your deployment is there or your llm model is working so I'll just click on check deployment so LM is working embedding is working translation is working search is working perfect we are good to go to the next step next step is you need to add a document so here you can add documents one document or multiple documents so that I have it ready and here you can see currently it supports PDF jpeg PNG and text files okay once that is done the process is running it doesn't [Music] us it doesn't loads the web page so yeah everything is happening in the real time it will try to create the embeddings and also convert my PDF to a text document basically retrieve all the content using the form recognizer and it will try to convert into a text document okay so now add it to the knowledge base that's perfect you can see your document from here and here you can see convert it as well as embeddings added to cross check you can go to your storage browser go to your blob containers documents and here is the uploaded document and also the converted one set it converted into a text document okay perfect and here you can see what all indexes are there and also you can delete the embeddings you can also delete the file or you can delete all the embeddings okay and let's see what all features it has you can try it out your own custom prompts document summary that's pretty cool that's a really good feature of summarizing the document conversation data extraction okay and prompt exploration okay these are some of the features that you can utilize so yeah let's go to chat and see how it works let's say hi to the bot okay hello I can assist you today let me open the document and find out what questions I can ask so let's see what is qubit okay it is replying with with the answer and also the source from where it is coming so if at all you have multiple documents so that Source will be appeared here okay and let's say create 10 question and answer PS n is suitable format with three columns ID question and answer so it should be intelligent enough to create a table for me no it is not that intelligent but I did try this prompt and it worked for me create 10 question and okay okay yeah so without a specific topic here so basically I need to specify like this let me copy this prompt paste it here appears from the given document in a suitable format okay and also it takes time uh if your response is large enough so it will take more time for this to reply back perfect perfect so it is using markdown format to format my table with three columns so this is pretty cool and much powerful and also now let us try our standard question it should not reply with the response basically it should not reply me with an answer Who is the fastest man alive so it should say that is the information okay the information provided in the text does not answer to the question about the identity of the fastest man alive so that confirms that it is not replying from outside the context or document it is replying from our own documents okay so the next part is running the API from the postman what is Quantum computing so this one is using without history we will also try with history during my text test run I did not find history very useful but yeah you can utilize that okay so here's the question here is a response here is a context and also here is the source okay this works you can now call this API from any of your custom application and now let us try the second API with the history enabled so I just need to pass the history it's an array and also it contains the array elements with a question and what was the response currently I am doing this manually basically this needs to be handled by your application for managing state okay so this is my history and now let me ask the second question why do you think Quantum computing uses qubits it's just a random question that I am asking okay qubits are used um not a big fan of this uh but yeah we can okay I think that should be fine you can experiment with this history enabled non-history and yeah incorporate this API call into your application all right thanks everyone
Info
Channel: Dewiride Technologies
Views: 5,981
Rating: undefined out of 5
Keywords: Azure, Open AI, Search Demo, ChatGPT, enterprise data, training, chatbot, AI, machine learning, NLP, natural language processing, artificial intelligence, tutorial, setup, custom knowledge, cloud computing, Azure services, Microsoft, azure search, openai, bot, train own data chatgpt, chatgpt train custom data, use own data in chatgpt, enterprise data in chatgpt, cognitive search, vector db, train custom data, chatgpt train own data, azure open ai train data, open ai, embeddings
Id: bO0oGtu_gwo
Channel Id: undefined
Length: 29min 33sec (1773 seconds)
Published: Tue Jul 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.