If you’re using Azure OpenAI then you must be aware that the most common and easiest way to authenticate our application is using app-key. The key-based authentication approach is very popular because it is very straightforward. Let's have a quick look at the below code snippet: from openai import AzureOpenAI client = AzureOpenAI ( api_key = 'KEY_GOES_HERE' , api_version = "2024-02-01" , azure_endpoint = 'ENDPOINT_GOES_HERE' ) response = client . completions . create ( model = 'MODEL_GOES_HERE' , prompt = 'Tell me a joke' , max_tokens = 80 ) print ( "\n ##########" ) print ( response . choices [ 0 ] . text ) The above code snippet constructs the AzureOpenAI client object using api-key,api-version, and endpoint. Then, this object makes a call to the completion endpoint with the required parameters. Of course, app key works very well for the experimentation purpose and is not very well suited for ente
This blog is all about my technical learnings pertaining to LLM, OpenAI, Azure OpenAI, C#, Azure, Python, AI, ML, Visual Studio Code and many more.