Skip to main content

Introduction

At a high level, working with the SDK has 3 steps.

  1. Initializing and creating an SDK object instance.
  2. Using the SDK instance to access capabilities like Models, Deployments, Files, Fine-Tunes or Completions, and perform operations.
  3. (Optional) Depending on organization's policies, use Enterprise Control feature of SDK to restrict operations that can be performed.

Initializing the SDK and creating an instance

data(sdk_instance) = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk(
api_version = <api_version>
api_base = <AI resource base URL>
api_type = <API Type>
api_key = <AAD token or API Key>
sdkprofile = <Profile ID>
params = <Profile Parameters>
).
Enterprise Control Parameters

For SDK initialization as shown above, the sdkprofile and params are optional parameters. These are used for enterprise control, and will be covered there.

Parameter NameData TypeRequiredDescription
sdk_instancezif_peng_azoai_sdkYesInstance of the AI SDK object.
api_versionstringYesAI Engine API Version.
api_basestringYesAI Engine end point
api_typestringYesAI Engine and Authentication type.
api_keystringYesBearer token or key for authentication. Specifics depends on AI engine being used.

api_version

Azure Open AI service APIs are versioned using the api_version parameter. All stable versions follow the YYYY-MM-DD date structure.

caution

Versions with -preview are early preview versions, and should not be used for productive applications.

Version StringPre-Defined SDK Value (Optional)
2022-12-01zif_peng_azoai_sdk_constants=>c_versions-v_2022_12_01
2023-03-15-previewzif_peng_azoai_sdk_constants=>c_versions-v_2023_03_15_preview
2023-05-15zif_peng_azoai_sdk_constants=>c_versions-v_2023_05_15
2023-06-01-previewzif_peng_azoai_sdk_constants=>c_versions-v_2023_06_01_preview
2023-07-01-previewzif_peng_azoai_sdk_constants=>c_versions-v_2023_07_01_preview
2023-08-01-previewzif_peng_azoai_sdk_constants=>c_versions-v_2023_08_01_preview

api_base

This value can be found in the Keys & Endpoint section when examining your resource from the Azure portal.

End Point Format

The Azure Open AI API Base takes the format https://<your resource ID>.openai.azure.com/

An example endpoint is: https://aisdktest.openai.azure.com/.

api_type

ValuePre-Defined SDK Value (Optional)Description
azurezif_peng_azoai_sdk_constants=>c_apitype-azureUse Key authentication. The KEY1 or KEY2 from Azure Portal should be passed in api_key parameter
azure_adzif_peng_azoai_sdk_constants=>c_apitype-azure_adUse Azure Active Directory token for authentication. You can read the how-to guide on authenticating with Azure Active Directory.

api_key

ValueNotes
KEY1 or KEY2Key from Azure Portal.

The api_type must be set to azure
bearer tokenBearer token received from Azure Active Directory . You can read the how-to guide on authenticating with Azure Active Directory.

The api_type must be set to azure_ad