Azure OpenAI Service for Rad Studio

From sgcWebSockets 2023.7.0 the Microsoft Azure OpenAI Service is supported. 

Azure OpenAI Service can be used to create chatbots, generate text, translate languages, and write different kinds of creative content. As the platform continues to evolve, developers will be able to use it to build even more powerful and sophisticated applications.

The difference between OpenAI and Azure OpenAI is that the latest offers advanced language AI with OpenAI models while providing the security and enterprise promise of Azure. It is co-developed by Microsoft and OpenAI, ensuring compatibility and a smooth transition between the two.


The client supports Microsoft Azure OpenAI Services, so you can use your Azure account to interactuate with the Azure OpenAI API too. In order to configure the client to work with Azure, follow the next steps:

1. Configure the property OpenAIOptions.Provider = oapvAzure
2. Set the values of ResourceName and DeploymentId (these values can be located in your Azure Account)

  a. OpenAIOptions.AzureOptions.ResourceName = <your resource name>.
  b. OpenAIOptions.AzureOptions.DeploymentId = <your deployment id>.

3. Set the API Key of your Azure Account

  a. OpenAIOptions.ApiKey = <azure api key>.

Keep in mind that not all the OpenAI methods are supported by Azure, currently only the following methods are supported:

  • Completion
  • Chat Completion 
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.Provider := oapvAzure;
OpenAI.OpenAIOptions.AzureOptions.ResourceName := '<your resource name>';
OpenAI.OpenAIOptions.AzureOptions.DeploymentId := '<your deployment id>';
OpenAI._CreateChatCompletion('', 'How are you?'); 

Azure OpenAI Delphi Demo

Find below a demo built with the sgcWebSockets library showing the main features of OpenAI API. Can be tested using the OpenAI API directly or the Azure OpenAI Service. The demo is compiled with Delphi for Windows.

2.9 mb
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Bitstamp API Client Updated
sgcWebSockets 2023.6

Related Posts