Posts

Showing posts with the label Azure OpenAI Service

Integrating Azure OpenAI with Spring Boot: Complete Guide

Image
This guide will walk you through integrating Azure OpenAI with a Spring Boot application using the spring-ai-azure-openai-spring-boot-starter dependency. You will learn how to configure, develop, and test an end-to-end solution. Step 1: Set Up Your Azure OpenAI Resource 1.1. Create Azure OpenAI Resource Log in to Azure Portal . Navigate to Create a resource and search for Azure OpenAI . Follow the prompts to create a new Azure OpenAI resource. 1.2. Get Required Values Once your Azure OpenAI resource is set up, gather the following details: Resource Name : Found in the resource overview. Example: my-openai-resource API Key : Navigate to Keys and Endpoint in the left menu of your OpenAI resource. Copy one of the API keys (e.g., KEY1 ). Deployment Name : Go to Deployments in the left menu. Deploy a model (e.g., text-davinci-003 ). Note the Name of your deployment. Step 2: Create a Spring Boot Project 2.1. Generate Project Using Spring Initializr Visit Spring Initializr . Configure th...

How to Integrate Azure OpenAI Service with ASP.NET Core Web API

Image
Integrating Azure OpenAI Service with an ASP.NET application allows you to build web-based solutions powered by OpenAI's GPT models (like GPT-3 or GPT-4) using Azure’s API. Below is an end-to-end guide on how to build an ASP.NET Core Web API application that interacts with the Azure OpenAI Service. Prerequisites Azure Subscription : You need an Azure account to create an OpenAI resource. Azure OpenAI Resource : Create an OpenAI resource in Azure and get your API key and endpoint . .NET SDK : Install the .NET SDK . NuGet Packages : You’ll need the following NuGet packages: Microsoft.Extensions.Configuration Newtonsoft.Json Microsoft.AspNetCore.Mvc.NewtonsoftJson Step 1: Create an ASP.NET Core Web API Project Create a new ASP.NET Core Web API project: dotnet new webapi -n AzureOpenAIServiceApi cd AzureOpenAIServiceApi Step 2: Install NuGet Packages Install the necessary NuGet packages: dotnet add package Newtonsoft .Json dotnet add package Microsoft .Extensions .Configuration ...