diff --git a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al index d8ef80a9f79..e04ffa74ffb 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al @@ -165,6 +165,8 @@ codeunit 7771 "Azure OpenAI" AzureOpenAIImpl.SetAuthorization(ModelType, Deployment); end; +#if not CLEAN29 +#pragma warning disable AL0432 /// /// Generates a text completion given a prompt. /// @@ -174,6 +176,7 @@ codeunit 7771 "Azure OpenAI" /// The completion authentication was not configured. /// The completion generation failed with status code %1. [NonDebuggable] + [Obsolete('Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.', '29.0')] procedure GenerateTextCompletion(Prompt: SecretText; var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text var CallerModuleInfo: ModuleInfo; @@ -192,6 +195,7 @@ codeunit 7771 "Azure OpenAI" /// The completion authentication was not configured. /// The completion generation failed with status code %1. [NonDebuggable] + [Obsolete('Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.', '29.0')] procedure GenerateTextCompletion(Prompt: SecretText; AOAICompletionParams: Codeunit "AOAI Text Completion Params"; var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text var CallerModuleInfo: ModuleInfo; @@ -210,6 +214,7 @@ codeunit 7771 "Azure OpenAI" /// The completion authentication was not configured. /// The completion generation failed with status code %1. [NonDebuggable] + [Obsolete('Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.', '29.0')] procedure GenerateTextCompletion(Metaprompt: SecretText; Prompt: SecretText; var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text var CallerModuleInfo: ModuleInfo; @@ -229,6 +234,7 @@ codeunit 7771 "Azure OpenAI" /// The completion authentication was not configured. /// The completion generation failed with status code %1. [NonDebuggable] + [Obsolete('Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.', '29.0')] procedure GenerateTextCompletion(Metaprompt: SecretText; Prompt: SecretText; AOAICompletionParams: Codeunit "AOAI Text Completion Params"; var AOAIOperationResponse: Codeunit "AOAI Operation Response"): Text var CallerModuleInfo: ModuleInfo; @@ -236,7 +242,8 @@ codeunit 7771 "Azure OpenAI" NavApp.GetCallerModuleInfo(CallerModuleInfo); exit(AzureOpenAIImpl.GenerateTextCompletion(Metaprompt, Prompt, AOAICompletionParams, AOAIOperationResponse, CallerModuleInfo)); end; - +#pragma warning restore AL0432 +#endif /// /// Generates embeddings given an input. diff --git a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al index 71731dc20fe..e374d591aa9 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al @@ -5,7 +5,9 @@ namespace System.AI; using System; +#if not CLEAN29 using System.Azure.KeyVault; +#endif using System.Environment; using System.Privacy; using System.Telemetry; @@ -27,24 +29,32 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name" Telemetry: Codeunit Telemetry; InvalidModelTypeErr: Label 'Selected model type is not supported.'; GenerateRequestFailedErr: Label 'The request did not return a success status code.'; +#if not CLEAN29 CompletionsFailedWithCodeErr: Label 'Text completions failed to be generated'; +#endif EmbeddingsFailedWithCodeErr: Label 'Embeddings failed to be generated.'; ChatCompletionsFailedWithCodeErr: Label 'Chat completions failed to be generated.'; AuthenticationNotConfiguredErr: Label 'The authentication was not configured.'; CapabilityBackgroundErr: Label 'Microsoft Copilot Capabilities are not allowed in the background.'; CapabilityODataErr: Label 'Microsoft Copilot Capabilities are not allowed in API and OData Web Services sessions.'; MessagesMustContainJsonWordWhenResponseFormatIsJsonErr: Label 'The messages must contain the word ''json'' in some form, to use ''response format'' of type ''json_object''.'; +#if not CLEAN29 EmptyMetapromptErr: Label 'The metaprompt has not been set, please provide a metaprompt.'; MetapromptLoadingErr: Label 'Metaprompt not found.'; +#endif FunctionCallingFunctionNotFoundErr: Label 'Function call not found, %1.', Comment = '%1 is the name of the function'; +#if not CLEAN29 TelemetryGenerateTextCompletionLbl: Label 'Text completion generated.', Locked = true; +#endif TelemetryGenerateEmbeddingLbl: Label 'Embedding generated.', Locked = true; TelemetryGenerateChatCompletionLbl: Label 'Chat Completion generated.', Locked = true; TelemetryChatCompletionToolCallLbl: Label 'Tools called by chat completion.', Locked = true; TelemetryChatCompletionToolUsedLbl: Label 'Tools added to chat completion.', Locked = true; TelemetryProhibitedCharactersTxt: Label 'Prohibited characters removed from the prompt.', Locked = true; TelemetryTokenCountLbl: Label 'Metaprompt token count: %1, Prompt token count: %2, Total token count: %3', Comment = '%1 is the number of tokens in the metaprompt, %2 is the number of tokens in the prompt, %3 is the total number of tokens', Locked = true; +#if not CLEAN29 TelemetryMetapromptRetrievalErr: Label 'Unable to retrieve metaprompt from Azure Key Vault.', Locked = true; +#endif TelemetryFunctionCallingFailedErr: Label 'Function calling failed for function: %1', Comment = '%1 is the name of the function', Locked = true; AzureOpenAiTxt: Label 'Azure OpenAI', Locked = true; BillingTypeAuthorizationErr: Label 'Usage of AI resources not authorized with chosen billing type, Capability: %1, Billing Type: %2. Please contact your system administrator.', Comment = '%1 is the capability name, %2 is the billing type'; @@ -155,6 +165,8 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name" end; end; +#if not CLEAN29 +#pragma warning disable AL0432 [NonDebuggable] procedure GenerateTextCompletion(Prompt: SecretText; var AOAIOperationResponse: Codeunit "AOAI Operation Response"; CallerModuleInfo: ModuleInfo): Text var @@ -211,6 +223,8 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name" FeatureTelemetry.LogUsage('0000KVL', GetAzureOpenAICategory(), TelemetryGenerateTextCompletionLbl, Enum::"AL Telemetry Scope"::All, CustomDimensions); Result := AOAIOperationResponse.GetResult(); end; +#pragma warning restore AL0432 +#endif [NonDebuggable] procedure GenerateEmbeddings(Input: SecretText; var AOAIOperationResponse: Codeunit "AOAI Operation Response"; CallerModuleInfo: ModuleInfo): List of [Decimal] @@ -563,6 +577,7 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name" exit(Result); end; +#if not CLEAN29 [NonDebuggable] internal procedure GetTextMetaprompt() Metaprompt: SecretText; var @@ -596,6 +611,7 @@ codeunit 7772 "Azure OpenAI Impl" implements "AI Service Name" Error(EmptyMetapromptErr); end; end; +#endif procedure GetTokenCount(Input: SecretText; Encoding: Text) TokenCount: Integer var diff --git a/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParams.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParams.Codeunit.al index 1dc5c4b30b3..5937a4a9d65 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParams.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParams.Codeunit.al @@ -1,3 +1,4 @@ +#if not CLEAN29 // ------------------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +14,9 @@ codeunit 7765 "AOAI Text Completion Params" Access = Public; InherentEntitlements = X; InherentPermissions = X; + ObsoleteState = Pending; + ObsoleteReason = 'Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.'; + ObsoleteTag = '29.0'; var AOAITextCompletionParamsImpl: Codeunit "AOAI TextCompletionParams Impl"; @@ -140,4 +144,5 @@ codeunit 7765 "AOAI Text Completion Params" begin AOAITextCompletionParamsImpl.AddCompletionsParametersToPayload(Payload); end; -} \ No newline at end of file +} +#endif diff --git a/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParamsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParamsImpl.Codeunit.al index b3e5ba4aa67..100461c7fe8 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParamsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParamsImpl.Codeunit.al @@ -1,3 +1,4 @@ +#if not CLEAN29 // ------------------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,6 +10,9 @@ codeunit 7766 "AOAI TextCompletionParams Impl" Access = Internal; InherentEntitlements = X; InherentPermissions = X; + ObsoleteState = Pending; + ObsoleteReason = 'Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.'; + ObsoleteTag = '29.0'; var Initialized: Boolean; @@ -152,4 +156,5 @@ codeunit 7766 "AOAI TextCompletionParams Impl" SetPresencePenalty(0); SetFrequencyPenalty(0); end; -} \ No newline at end of file +} +#endif diff --git a/src/System Application/Partner Test/AI/src/AzureOpenAITestPartner.Codeunit.al b/src/System Application/Partner Test/AI/src/AzureOpenAITestPartner.Codeunit.al index 773cf1b499f..ccaca4c0d74 100644 --- a/src/System Application/Partner Test/AI/src/AzureOpenAITestPartner.Codeunit.al +++ b/src/System Application/Partner Test/AI/src/AzureOpenAITestPartner.Codeunit.al @@ -7,7 +7,9 @@ namespace Partner.Test.AI; using System.AI; using System.Privacy; +#if not CLEAN29 using System.TestLibraries.AI; +#endif using System.TestLibraries.Utilities; codeunit 139021 "Azure OpenAI Test Partner" @@ -25,6 +27,8 @@ codeunit 139021 "Azure OpenAI Test Partner" LearMoreUrlLbl: Label 'http://LearnMore.com', Locked = true; BillingTypeAuthorizationErr: Label 'Usage of AI resources not authorized with chosen billing type, Capability: %1, Billing Type: %2. Please contact your system administrator.', Comment = '%1 is the capability name, %2 is the billing type'; +#if not CLEAN29 +#pragma warning disable AL0432 [Test] [Scope('OnPrem')] procedure GenerateTextCompletionsBillingTypeAuthorizationErr() @@ -73,6 +77,8 @@ codeunit 139021 "Azure OpenAI Test Partner" ErrorMessage := StrSubstNo(BillingTypeAuthorizationErr, Enum::"Copilot Capability"::"Text Partner Capability", Enum::"Copilot Billing Type"::"Custom Billed"); LibraryAssert.ExpectedError(ErrorMessage); end; +#pragma warning restore AL0432 +#endif [Test] [Scope('OnPrem')] diff --git a/src/System Application/Test/AI/src/AzureOpenAITest.Codeunit.al b/src/System Application/Test/AI/src/AzureOpenAITest.Codeunit.al index e46c6b6dc04..9f02f88e1c2 100644 --- a/src/System Application/Test/AI/src/AzureOpenAITest.Codeunit.al +++ b/src/System Application/Test/AI/src/AzureOpenAITest.Codeunit.al @@ -24,7 +24,9 @@ codeunit 132684 "Azure OpenAI Test" AzureOpenAiTxt: Label 'Azure OpenAI', Locked = true; EndpointTxt: Label 'https://resourcename.openai.azure.com/', Locked = true; DeploymentTxt: Label 'deploymentid', Locked = true; +#if not CLEAN29 BillingTypeAuthorizationErr: Label 'Usage of AI resources not authorized with chosen billing type, Capability: %1, Billing Type: %2. Please contact your system administrator.', Comment = '%1 is the capability name, %2 is the billing type'; +#endif [Test] [HandlerFunctions('HandleCopilotNotAvailable')] @@ -172,6 +174,8 @@ codeunit 132684 "Azure OpenAI Test" LibraryAssert.ExpectedError('Copilot capability ''Text Capability'' has not been enabled. Please contact your system administrator.'); end; +#if not CLEAN29 +#pragma warning disable AL0432 [Test] procedure GenerateTextCompletionsCopilotCapabilityNotSet() var @@ -324,6 +328,8 @@ codeunit 132684 "Azure OpenAI Test" ErrorMessage := StrSubstNo(BillingTypeAuthorizationErr, Enum::"Copilot Capability"::"Text Capability", Enum::"Copilot Billing Type"::"Custom Billed"); LibraryAssert.ExpectedError(ErrorMessage); end; +#pragma warning restore AL0432 +#endif [Test] procedure GenerateEmbeddingCopilotCapabilityNotSet()