Skip to main content

AZOPENAI Library

Overview

The AZOPENAI Library is an importable library containing functions to connect, authenticate, and interact with Microsoft's Foundry. This library is used in the Azure OpenAI Adapter.

Import the AZOPENAI library into your project. Typically only the AZOPENAIclient module needs to be required in order to create the client and access the API methods.

require "AZOPENAI.AZOPENAIclient"   

How it works:

Use the Translator's built in help to review how to use each function:

AZOPENAIclient - sets up the adapter framework

Creates the AZOPENAI adapter framework, adding the various method modules to a metatable and storing the configurations added to the custom fields.

You can also retrieve the model's endpoint mode (completions vs responses) once you create your client object

   -- Create Azure OpenAI client   
local AzureClient = AZOPENAIclient{
model_uri = Configs["Model URI"],
auth_mode = Configs["Authentication Mode"],
api_key = Configs["API Key"],
azure_tenant_id = Configs["Azure Tenant ID"],
azure_client_id = Configs["Azure Client ID"],
azure_client_secret = Configs["Azure Client Secret"],
http_timeout = Configs["Request Timeout"]
}

-- Check endpoint mode
local EndpointMode = AzureClient.parsed_endpoint.mode

AZOPENAIchatCompletionsCreate

Create a chat using Azure OpenAI chat completions.

AZOPENAIresponsesCreate

Create a chat using Azure OpenAI responses.