From db63eeaaa0f2085678663a47545e8788961652bb Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Thu, 31 Oct 2024 15:49:07 +0100 Subject: [PATCH 1/6] Slice 548931: [AI][Public Preview]Copilot Toolkit: Targeted ISV communications to signal model changes on CAPI/managed AI resources --- .../AOAIDeploymentsImpl.Codeunit.al | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index 2eb0d3c083..a35dc1df9c 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -4,6 +4,7 @@ // ------------------------------------------------------------------------------------------------ namespace System.AI; +using System.Telemetry; #if not CLEAN25 using System.Environment; #endif @@ -15,11 +16,15 @@ codeunit 7769 "AOAI Deployments Impl" InherentPermissions = X; var + Telemetry: Codeunit Telemetry; UnableToGetDeploymentNameErr: Label 'Unable to get deployment name, if this is a third party capability you must specify your own deployment name. You may need to contact your partner.'; GPT4oLatestLbl: Label 'gpt-4o-latest', Locked = true; GPT4oPreviewLbl: Label 'gpt-4o-preview', Locked = true; GPT4oMiniLatestLbl: Label 'gpt-4o-mini-latest', Locked = true; GPT4oMiniPreviewLbl: Label 'gpt-4o-mini-preview', Locked = true; + DeploymentDeprecationDates: Dictionary of [Text, Date]; + DeprecationDatesInitialized: Boolean; + DeprecationMessageLbl: Label 'Deployment %1 deprecated from %2. Check out code unit 7768 AOAI Deployments', Comment = 'Telemetry message where %1 is the name of the deployment and %2 is the date of deprecation'; #if not CLEAN25 GPT4LatestLbl: Label 'gpt-4-latest', Locked = true; GPT4PreviewLbl: Label 'gpt-4-preview', Locked = true; @@ -32,6 +37,7 @@ codeunit 7769 "AOAI Deployments Impl" GPT40613Lbl: Label 'gpt-4-32k', Locked = true; Turbo031316kLbl: Label 'gpt-35-turbo-16k', Locked = true; + procedure GetTurbo0301(CallerModuleInfo: ModuleInfo): Text var EnviromentInformation: Codeunit "Environment Information"; @@ -103,12 +109,39 @@ codeunit 7769 "AOAI Deployments Impl" exit(GetDeploymentName(GPT4oMiniLatestLbl, CallerModuleInfo)); end; + local procedure InitializeDeploymentDeprecationDates() + begin + if DeprecationDatesInitialized then + exit; + + // Add deprecated deployments with their deprecation dates here + DeploymentDeprecationDates.Add(GPT4LatestLbl, DMY2Date(31, 12, 2023)); + DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(31, 12, 2023)); + + DeprecationDatesInitialized := true; + end; + local procedure GetDeploymentName(DeploymentName: Text; CallerModuleInfo: ModuleInfo): Text var AzureOpenAiImpl: Codeunit "Azure OpenAI Impl"; CurrentModuleInfo: ModuleInfo; + IsDeprecated: Boolean; + CustomDimensions: Dictionary of [Text, Text]; + DeprecatedDate: Date; begin + InitializeDeploymentDeprecationDates(); + NavApp.GetCurrentModuleInfo(CurrentModuleInfo); + + IsDeprecated := DeploymentDeprecationDates.ContainsKey(DeploymentName); + if IsDeprecated then begin + DeprecatedDate := DeploymentDeprecationDates.Get(DeploymentName); + CustomDimensions.Add('DeploymentName', DeploymentName); + CustomDimensions.Add('DeprecationDate', Format(DeprecatedDate)); + //add date, check out code unit codeunit 7768 "AOAI Deployments", + Telemetry.LogMessage('', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); + end; + if (CallerModuleInfo.Publisher <> CurrentModuleInfo.Publisher) and not AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls() then Error(UnableToGetDeploymentNameErr); From c43a9aa97b3a5bac00152e5ff3117b46cbf67c8c Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 1 Nov 2024 11:26:25 +0100 Subject: [PATCH 2/6] added current deprecated models to deprecation list --- .../AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index a35dc1df9c..fca84774c4 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -115,8 +115,13 @@ codeunit 7769 "AOAI Deployments Impl" exit; // Add deprecated deployments with their deprecation dates here - DeploymentDeprecationDates.Add(GPT4LatestLbl, DMY2Date(31, 12, 2023)); - DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(31, 12, 2023)); + DeploymentDeprecationDates.Add(Turbo0301SaasLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(GPT40613SaasLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(Turbo0613SaasLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(GPT35TurboPreviewLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(GPT4oPreviewLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(GPT4oLatestLbl, DMY2Date(31, 12, 2024)); DeprecationDatesInitialized := true; end; From bb9c7aa0305a087b2558d1ad12385458f77610c9 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 1 Nov 2024 11:28:42 +0100 Subject: [PATCH 3/6] modified dates on model deprecation list to be deprecated from november 1st 2024 --- .../Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index fca84774c4..69bc74928b 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -115,13 +115,13 @@ codeunit 7769 "AOAI Deployments Impl" exit; // Add deprecated deployments with their deprecation dates here - DeploymentDeprecationDates.Add(Turbo0301SaasLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(GPT40613SaasLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(Turbo0613SaasLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(GPT35TurboPreviewLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(GPT4oPreviewLbl, DMY2Date(31, 12, 2024)); - DeploymentDeprecationDates.Add(GPT4oLatestLbl, DMY2Date(31, 12, 2024)); + DeploymentDeprecationDates.Add(Turbo0301SaasLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT40613SaasLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(Turbo0613SaasLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT35TurboPreviewLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT4oPreviewLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT4oLatestLbl, DMY2Date(1, 11, 2024)); DeprecationDatesInitialized := true; end; From 4d70f895b9dd3486c66053a3715e9f00a467f44c Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 15 Nov 2024 16:11:58 +0100 Subject: [PATCH 4/6] corrected deprecated models from gpt4o to gpt4 --- .../App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index 69bc74928b..e8accceb65 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -120,8 +120,8 @@ codeunit 7769 "AOAI Deployments Impl" DeploymentDeprecationDates.Add(Turbo0613SaasLbl, DMY2Date(1, 11, 2024)); DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(1, 11, 2024)); DeploymentDeprecationDates.Add(GPT35TurboPreviewLbl, DMY2Date(1, 11, 2024)); - DeploymentDeprecationDates.Add(GPT4oPreviewLbl, DMY2Date(1, 11, 2024)); - DeploymentDeprecationDates.Add(GPT4oLatestLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT4PreviewLbl, DMY2Date(1, 11, 2024)); + DeploymentDeprecationDates.Add(GPT4LatestLbl, DMY2Date(1, 11, 2024)); DeprecationDatesInitialized := true; end; From 1c8e51a8ab9dffe12d36e4d2cbf0e3eaa79156d8 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 22 Nov 2024 12:54:29 +0100 Subject: [PATCH 5/6] Added EventId to log message --- .../App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index e8accceb65..63ebcb602c 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -144,7 +144,7 @@ codeunit 7769 "AOAI Deployments Impl" CustomDimensions.Add('DeploymentName', DeploymentName); CustomDimensions.Add('DeprecationDate', Format(DeprecatedDate)); //add date, check out code unit codeunit 7768 "AOAI Deployments", - Telemetry.LogMessage('', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); + Telemetry.LogMessage('0000AD1', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); end; if (CallerModuleInfo.Publisher <> CurrentModuleInfo.Publisher) and not AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls() then From 46876fd1014c78c392e13e551920e6fc050f5b21 Mon Sep 17 00:00:00 2001 From: christian-andersen-msft Date: Wed, 27 Nov 2024 11:21:18 +0100 Subject: [PATCH 6/6] Apply suggestions from code review Readability and structure improvements Co-authored-by: Natalie Karolak, MVP <34504100+NKarolak@users.noreply.github.com> --- .../App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al index 63ebcb602c..4ea70a1d03 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al @@ -4,10 +4,10 @@ // ------------------------------------------------------------------------------------------------ namespace System.AI; -using System.Telemetry; #if not CLEAN25 using System.Environment; #endif +using System.Telemetry; codeunit 7769 "AOAI Deployments Impl" { @@ -24,7 +24,7 @@ codeunit 7769 "AOAI Deployments Impl" GPT4oMiniPreviewLbl: Label 'gpt-4o-mini-preview', Locked = true; DeploymentDeprecationDates: Dictionary of [Text, Date]; DeprecationDatesInitialized: Boolean; - DeprecationMessageLbl: Label 'Deployment %1 deprecated from %2. Check out code unit 7768 AOAI Deployments', Comment = 'Telemetry message where %1 is the name of the deployment and %2 is the date of deprecation'; + DeprecationMessageLbl: Label 'Deployment %1 deprecated from %2. Check out codeunit 7768 AOAI Deployments', Comment = 'Telemetry message where %1 is the name of the deployment and %2 is the date of deprecation'; #if not CLEAN25 GPT4LatestLbl: Label 'gpt-4-latest', Locked = true; GPT4PreviewLbl: Label 'gpt-4-preview', Locked = true; @@ -37,7 +37,6 @@ codeunit 7769 "AOAI Deployments Impl" GPT40613Lbl: Label 'gpt-4-32k', Locked = true; Turbo031316kLbl: Label 'gpt-35-turbo-16k', Locked = true; - procedure GetTurbo0301(CallerModuleInfo: ModuleInfo): Text var EnviromentInformation: Codeunit "Environment Information"; @@ -143,7 +142,6 @@ codeunit 7769 "AOAI Deployments Impl" DeprecatedDate := DeploymentDeprecationDates.Get(DeploymentName); CustomDimensions.Add('DeploymentName', DeploymentName); CustomDimensions.Add('DeprecationDate', Format(DeprecatedDate)); - //add date, check out code unit codeunit 7768 "AOAI Deployments", Telemetry.LogMessage('0000AD1', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); end;