Codeunit "Azure OpenAI"
Provides functionality for using the Azure OpenAI API.
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
IsEnabled
procedure IsEnabled(CopilotCapability: __MissingTypeSymbol__): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| CopilotCapability | __MissingTypeSymbol__ |
Returns
| Type | Description |
|---|---|
| Boolean |
IsEnabled
procedure IsEnabled(CopilotCapability: __MissingTypeSymbol__, Silent: Boolean): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| CopilotCapability | __MissingTypeSymbol__ | |
| Silent | Boolean |
Returns
| Type | Description |
|---|---|
| Boolean |
IsEnabled
procedure IsEnabled(CopilotCapability: __MissingTypeSymbol__, Silent: Boolean, AppId: Guid): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| CopilotCapability | __MissingTypeSymbol__ | |
| Silent | Boolean | |
| AppId | Guid |
Returns
| Type | Description |
|---|---|
| Boolean |
IsAuthorizationConfigured
Checks if the Azure OpenAI API authorization is configured for the environment.
procedure IsAuthorizationConfigured(ModelType: Enum "AOAI Model Type"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to check authorization for. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if API is authorized for environment. |
IsInitialized
procedure IsInitialized(CopilotCapability: __MissingTypeSymbol__, ModelType: Enum "AOAI Model Type"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| CopilotCapability | __MissingTypeSymbol__ | |
| ModelType | Enum System.AI."AOAI Model Type" |
Returns
| Type | Description |
|---|---|
| Boolean |
SetManagedResourceAuthorization
Obsolete
This element will become obsolete from version 26.0. Using Managed AI resources now requires different input parameters. Use the other overload for SetManagedResourceAuthorization instead.
Sets the managed Azure OpenAI API authorization to use for a specific model type.
This will send the Azure OpenAI call to the deployment specified in ManagedResourceDeployment, and will use the other parameters to verify that you have access to Azure OpenAI.
[NonDebuggable]
[Obsolete(Using Managed AI resources now requires different input parameters. Use the other overload for SetManagedResourceAuthorization instead.,26.0)]
procedure SetManagedResourceAuthorization(ModelType: Enum "AOAI Model Type", Endpoint: Text, Deployment: Text, ApiKey: SecretText, ManagedResourceDeployment: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to set authorization for. |
| Endpoint | Text |
The endpoint to use to verify access to Azure OpenAI. This is used only for verification, not for actual Azure OpenAI calls. |
| Deployment | Text |
The deployment to use to verify access to Azure OpenAI. This is used only for verification, not for actual Azure OpenAI calls. |
| ApiKey | SecretText |
The API key to use to verify access to Azure OpenAI. This is used only for verification, not for actual Azure OpenAI calls. |
| ManagedResourceDeployment | Text |
The managed deployment to use for the model type. |
Remarks
function is currently only available to selected partners. Endpoint would look like: https://resource-name.openai.azure.com/ Deployment would look like: gpt-35-turbo-16k
SetManagedResourceAuthorization
Obsolete
This element will become obsolete from version 28.0. Using Managed AI resources now requires only Model Type & Deployment Text as input parameters. Use the other overload for SetManagedResourceAuthorization instead. AOAIAccountName & ApiKey are ignored in the current version of SetManagedResourceAuthorization.
Sets the managed Azure OpenAI API authorization to use for a specific model type.
This will send the Azure OpenAI call to the deployment specified in ManagedResourceDeployment, and will use the other parameters to verify that you have access to Azure OpenAI.
[NonDebuggable]
[Obsolete(Using Managed AI resources now requires only Model Type & Deployment Text as input parameters. Use the other overload for SetManagedResourceAuthorization instead. AOAIAccountName & ApiKey are ignored in the current version of SetManagedResourceAuthorization.,28.0)]
procedure SetManagedResourceAuthorization(ModelType: Enum "AOAI Model Type", AOAIAccountName: Text, ApiKey: SecretText, ManagedResourceDeployment: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to set authorization for. |
| AOAIAccountName | Text |
Name of the Azure Open AI resource like "MyAzureOpenAIResource" |
| ApiKey | SecretText |
The API key to access the Azure Open AI resource. This is used only for verification of access, not for actual Azure Open AI calls. |
| ManagedResourceDeployment | Text |
The managed deployment to use for the model type. |
SetManagedResourceAuthorization
Sets the managed Azure OpenAI API authorization to use for a specific model type.
This will send the Azure OpenAI call to the deployment specified in ManagedResourceDeployment, and will use the other parameters to verify that you have access to Azure OpenAI.
[NonDebuggable]
procedure SetManagedResourceAuthorization(ModelType: Enum "AOAI Model Type", ManagedResourceDeployment: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to set authorization for. |
| ManagedResourceDeployment | Text |
The managed deployment to use for the model type. |
SetAuthorization
Sets the Azure OpenAI API authorization to use for a specific model type and endpoint.
[NonDebuggable]
procedure SetAuthorization(ModelType: Enum "AOAI Model Type", Endpoint: Text, Deployment: Text, ApiKey: SecretText)
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to set authorization for. |
| Endpoint | Text |
The endpoint to use for the model type. |
| Deployment | Text |
The deployment to use for the endpoint. |
| ApiKey | SecretText |
The API key to use for the endpoint. |
Remarks
Endpoint would look like: https://resource-name.openai.azure.com/ Deployment would look like: gpt-35-turbo-16k
SetAuthorization
Sets the Azure OpenAI API authorization to use for a specific model type.
[NonDebuggable]
procedure SetAuthorization(ModelType: Enum "AOAI Model Type", Deployment: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| ModelType | Enum System.AI."AOAI Model Type" |
The model type to set authorization for. |
| Deployment | Text |
The deployment name to use for the model type. |
Remarks
Deployment would look like: gpt-35-turbo-16k
GenerateTextCompletion
Generates a text completion given a prompt.
[NonDebuggable]
procedure GenerateTextCompletion(Prompt: SecretText, var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text
Parameters
| Name | Type | Description |
|---|---|---|
| Prompt | SecretText |
The prompt to generate completion for. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
Returns
| Type | Description |
|---|---|
| Text |
The generated completion. |
GenerateTextCompletion
Generates a completion given a prompt and completion parameters.
[NonDebuggable]
procedure GenerateTextCompletion(Prompt: SecretText, AOAICompletionParams: Codeunit "AOAI Text Completion Params", var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text
Parameters
| Name | Type | Description |
|---|---|---|
| Prompt | SecretText |
The prompt to generate completion for. |
| AOAICompletionParams | Codeunit System.AI."AOAI Text Completion Params" |
The optional completion parameters to use. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
Returns
| Type | Description |
|---|---|
| Text |
The generated completion. |
GenerateTextCompletion
Generates a text completion given a prompt.
[NonDebuggable]
procedure GenerateTextCompletion(Metaprompt: SecretText, Prompt: SecretText, var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text
Parameters
| Name | Type | Description |
|---|---|---|
| Metaprompt | SecretText |
The metaprompt to be appended with the prompt. |
| Prompt | SecretText |
The prompt to generate completion for. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
Returns
| Type | Description |
|---|---|
| Text |
The generated completion. |
GenerateTextCompletion
Generates a completion given a prompt and completion parameters.
[NonDebuggable]
procedure GenerateTextCompletion(Metaprompt: SecretText, Prompt: SecretText, AOAICompletionParams: Codeunit "AOAI Text Completion Params", var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text
Parameters
| Name | Type | Description |
|---|---|---|
| Metaprompt | SecretText |
The metaprompt to be appended with the prompt. |
| Prompt | SecretText |
The prompt to generate completion for. |
| AOAICompletionParams | Codeunit System.AI."AOAI Text Completion Params" |
The optional completion parameters to use. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
Returns
| Type | Description |
|---|---|
| Text |
The generated completion. |
GenerateEmbeddings
Generates embeddings given an input.
[NonDebuggable]
procedure GenerateEmbeddings(Input: SecretText, var AOAIOperationResponse: Codeunit "AOAI Operation Response"): List of [Decimal]
Parameters
| Name | Type | Description |
|---|---|---|
| Input | SecretText |
The input to generate embedding for. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
Returns
| Type | Description |
|---|---|
| List of [Decimal] |
The generated list of embeddings. |
GenerateChatCompletion
Generates a chat completion given a list of chat messages.
[NonDebuggable]
procedure GenerateChatCompletion(var AOAIChatMessages: Codeunit "AOAI Chat Messages", var AOAIOperationResponse: Codeunit "AOAI Operation Response")
Parameters
| Name | Type | Description |
|---|---|---|
| AOAIChatMessages | Codeunit System.AI."AOAI Chat Messages" |
The chat messages to generate completion for. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
GenerateChatCompletion
Generates a chat completion given a list of chat messages and completion parameters.
[NonDebuggable]
procedure GenerateChatCompletion(var AOAIChatMessages: Codeunit "AOAI Chat Messages", AOAIChatCompletionParams: Codeunit "AOAI Chat Completion Params", var AOAIOperationResponse: Codeunit "AOAI Operation Response")
Parameters
| Name | Type | Description |
|---|---|---|
| AOAIChatMessages | Codeunit System.AI."AOAI Chat Messages" |
The chat messages to generate completion for. |
| AOAIChatCompletionParams | Codeunit System.AI."AOAI Chat Completion Params" |
The optional chat completion parameters to use. |
| AOAIOperationResponse | Codeunit System.AI."AOAI Operation Response" |
The response of the operation upon successful or failure execution. |
SetCopilotCapability
[NonDebuggable]
procedure SetCopilotCapability(CopilotCapability: __MissingTypeSymbol__)
Parameters
| Name | Type | Description |
|---|---|---|
| CopilotCapability | __MissingTypeSymbol__ |