Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isv telemetry on llm deprecation #2387

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#if not CLEAN25
using System.Environment;
#endif
using System.Telemetry;

codeunit 7769 "AOAI Deployments Impl"
{
Expand All @@ -15,11 +16,15 @@
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 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;
Expand Down Expand Up @@ -103,12 +108,43 @@
exit(GetDeploymentName(GPT4oMiniLatestLbl, CallerModuleInfo));
end;

local procedure InitializeDeploymentDeprecationDates()
begin
if DeprecationDatesInitialized then
exit;

// Add deprecated deployments with their deprecation dates here
DeploymentDeprecationDates.Add(Turbo0301SaasLbl, DMY2Date(1, 11, 2024));

Check failure on line 117 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'Turbo0301SaasLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(GPT40613SaasLbl, DMY2Date(1, 11, 2024));

Check failure on line 118 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'GPT40613SaasLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(Turbo0613SaasLbl, DMY2Date(1, 11, 2024));

Check failure on line 119 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'Turbo0613SaasLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(GPT35TurboLatestLbl, DMY2Date(1, 11, 2024));

Check failure on line 120 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'GPT35TurboLatestLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(GPT35TurboPreviewLbl, DMY2Date(1, 11, 2024));

Check failure on line 121 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'GPT35TurboPreviewLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(GPT4PreviewLbl, DMY2Date(1, 11, 2024));

Check failure on line 122 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'GPT4PreviewLbl' does not exist in the current context.
DeploymentDeprecationDates.Add(GPT4LatestLbl, DMY2Date(1, 11, 2024));

Check failure on line 123 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)

AL0118 The name 'GPT4LatestLbl' does not exist in the current context.
christian-andersen-msft marked this conversation as resolved.
Show resolved Hide resolved

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));
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
Error(UnableToGetDeploymentNameErr);

Expand Down
Loading