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 |
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 | 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 | System.AI."AOAI Model Type" |
Returns
Type | Description |
---|---|
Boolean |
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 | 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 | 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 | 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 | System.AI."AOAI Text Completion Params" |
The optional completion parameters to use. |
AOAIOperationResponse | 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 | 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 | System.AI."AOAI Text Completion Params" |
The optional completion parameters to use. |
AOAIOperationResponse | 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 | 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 | System.AI."AOAI Chat Messages" |
The chat messages to generate completion for. |
AOAIOperationResponse | 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 | System.AI."AOAI Chat Messages" |
The chat messages to generate completion for. |
AOAIChatCompletionParams | System.AI."AOAI Chat Completion Params" |
The optional chat completion parameters to use. |
AOAIOperationResponse | 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__ |
ApproximateTokenCount
Obsolete
This element will become obsolete from version 24.0. Use the AOAI Token codeunit.
Gets the approximate token count for the input.
[NonDebuggable]
[Obsolete(Use the AOAI Token codeunit.,24.0)]
procedure ApproximateTokenCount(Input: Text): Integer
Parameters
Name | Type | Description |
---|---|---|
Input | Text |
The input to get the approximate token count for. |
Returns
Type | Description |
---|---|
Integer |
The approximate token count. |