From 8068a6e620843191cfee3bdcf295d4c53acd0e44 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Thu, 31 Oct 2024 15:49:07 +0100 Subject: [PATCH 01/10] 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 07d1124a47810a0fba760b0367806f417b0a97d1 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 1 Nov 2024 11:26:25 +0100 Subject: [PATCH 02/10] 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 4caeb89ad1d2a70e76997040d2899004a47f1fb8 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 1 Nov 2024 11:28:42 +0100 Subject: [PATCH 03/10] 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 22f3f66817450412a64df70472d5bcaf4e8138bd Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 15 Nov 2024 16:11:58 +0100 Subject: [PATCH 04/10] 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 0f7c2f8fe106d50249018d822b73f1b5eef8622d Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 22 Nov 2024 12:54:29 +0100 Subject: [PATCH 05/10] 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 d3e8d63bc631ae58b55fe20c70d0eea20b0d8b40 Mon Sep 17 00:00:00 2001 From: christian-andersen-msft Date: Wed, 27 Nov 2024 11:21:18 +0100 Subject: [PATCH 06/10] 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; From 10ba1eed1c1e9a15802258e29f61aa37e456b94b Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 6 Dec 2024 14:35:16 +0100 Subject: [PATCH 07/10] Added debug telemetry 0000AD0 --- .../App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 5 +++++ 1 file changed, 5 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 4ea70a1d03..f569fceabf 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 @@ -133,6 +133,11 @@ codeunit 7769 "AOAI Deployments Impl" CustomDimensions: Dictionary of [Text, Text]; DeprecatedDate: Date; begin + //debug + CustomDimensions.Add('DeploymentName', DeploymentName); + Telemetry.LogMessage('0000AD0', StrSubstNo('DeprecationMessageLbl', DeploymentName, 'DeprecatedDate'), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); + //debug + InitializeDeploymentDeprecationDates(); NavApp.GetCurrentModuleInfo(CurrentModuleInfo); From a6be283baa729fbd1c9d43029289e5c275e37542 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Fri, 6 Dec 2024 15:41:18 +0100 Subject: [PATCH 08/10] Added additional telemetry tests --- .../AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 f569fceabf..cd43e6fe03 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 @@ -135,21 +135,22 @@ codeunit 7769 "AOAI Deployments Impl" begin //debug CustomDimensions.Add('DeploymentName', DeploymentName); - Telemetry.LogMessage('0000AD0', StrSubstNo('DeprecationMessageLbl', DeploymentName, 'DeprecatedDate'), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); + Telemetry.LogMessage('0000AD0', 'Test', Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions); //debug 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)); + Telemetry.LogMessage('0000AD2', 'Test2', Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions); Telemetry.LogMessage('0000AD1', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); end; + NavApp.GetCurrentModuleInfo(CurrentModuleInfo); + if (CallerModuleInfo.Publisher <> CurrentModuleInfo.Publisher) and not AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls() then Error(UnableToGetDeploymentNameErr); From bbc44ef3ae1c4ba2aaba42ffd7cc2c519f519d09 Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Tue, 10 Dec 2024 10:48:22 +0100 Subject: [PATCH 09/10] temporarely removed duplicate CustomDimension entry --- .../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 cd43e6fe03..83f3ae81e5 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 @@ -143,7 +143,7 @@ codeunit 7769 "AOAI Deployments Impl" IsDeprecated := DeploymentDeprecationDates.ContainsKey(DeploymentName); if IsDeprecated then begin DeprecatedDate := DeploymentDeprecationDates.Get(DeploymentName); - CustomDimensions.Add('DeploymentName', DeploymentName); + //CustomDimensions.Add('DeploymentName', DeploymentName); CustomDimensions.Add('DeprecationDate', Format(DeprecatedDate)); Telemetry.LogMessage('0000AD2', 'Test2', Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions); Telemetry.LogMessage('0000AD1', StrSubstNo(DeprecationMessageLbl, DeploymentName, DeprecatedDate), Verbosity::Warning, DataClassification::SystemMetadata, Enum::"AL Telemetry Scope"::All, CustomDimensions); From 6b5d7fbe191561da9e0401c1e5aa1273ea27adae Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Tue, 10 Dec 2024 16:37:58 +0100 Subject: [PATCH 10/10] Cleaned up code for release --- .../AOAIDeploymentsImpl.Codeunit.al | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 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 83f3ae81e5..5ae8022e25 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 @@ -22,7 +22,7 @@ codeunit 7769 "AOAI Deployments Impl" 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]; + DeprecatedDeployments: Dictionary of [Text, Date]; DeprecationDatesInitialized: Boolean; 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 @@ -108,46 +108,52 @@ codeunit 7769 "AOAI Deployments Impl" exit(GetDeploymentName(GPT4oMiniLatestLbl, CallerModuleInfo)); end; + // Initializes dictionary of deprecated models local procedure InitializeDeploymentDeprecationDates() begin if DeprecationDatesInitialized then exit; // Add deprecated deployments with their deprecation dates here - 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(GPT4PreviewLbl, DMY2Date(1, 11, 2024)); - DeploymentDeprecationDates.Add(GPT4LatestLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(Turbo0301SaasLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(GPT40613SaasLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(Turbo0613SaasLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(GPT35TurboLatestLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(GPT35TurboPreviewLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(GPT4PreviewLbl, DMY2Date(1, 11, 2024)); + DeprecatedDeployments.Add(GPT4LatestLbl, DMY2Date(1, 11, 2024)); DeprecationDatesInitialized := true; end; - local procedure GetDeploymentName(DeploymentName: Text; CallerModuleInfo: ModuleInfo): Text + // Application Insights telemetry on deprecated models + local procedure LogDeprecationTelemetry(DeploymentName: Text) var - AzureOpenAiImpl: Codeunit "Azure OpenAI Impl"; - CurrentModuleInfo: ModuleInfo; - IsDeprecated: Boolean; CustomDimensions: Dictionary of [Text, Text]; + IsDeprecated: Boolean; DeprecatedDate: Date; begin - //debug - CustomDimensions.Add('DeploymentName', DeploymentName); - Telemetry.LogMessage('0000AD0', 'Test', Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions); - //debug - InitializeDeploymentDeprecationDates(); - - IsDeprecated := DeploymentDeprecationDates.ContainsKey(DeploymentName); + IsDeprecated := DeprecatedDeployments.ContainsKey(DeploymentName); if IsDeprecated then begin - DeprecatedDate := DeploymentDeprecationDates.Get(DeploymentName); - //CustomDimensions.Add('DeploymentName', DeploymentName); + DeprecatedDate := DeprecatedDeployments.Get(DeploymentName); + CustomDimensions.Add('DeploymentName', DeploymentName); CustomDimensions.Add('DeprecationDate', Format(DeprecatedDate)); - Telemetry.LogMessage('0000AD2', 'Test2', Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions); - Telemetry.LogMessage('0000AD1', 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; + end; + + local procedure GetDeploymentName(DeploymentName: Text; CallerModuleInfo: ModuleInfo): Text + var + AzureOpenAiImpl: Codeunit "Azure OpenAI Impl"; + CurrentModuleInfo: ModuleInfo; + begin + LogDeprecationTelemetry(DeploymentName); NavApp.GetCurrentModuleInfo(CurrentModuleInfo);