-
Notifications
You must be signed in to change notification settings - Fork 169
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
Application Insights warning on llm model deprecation #2524
base: main
Are you sure you want to change the base?
Changes from all commits
8068a6e
07d1124
4caeb89
22f3f66
0f7c2f8
d3e8d63
46fd9f0
86d84dd
10ba1ee
a6be283
9388ab9
bbc44ef
6b5d7fb
e7cc871
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
#if not CLEAN25 | ||
using System.Environment; | ||
#endif | ||
using System.Telemetry; | ||
|
||
codeunit 7769 "AOAI Deployments Impl" | ||
{ | ||
|
@@ -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; | ||
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'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make the text a bit more dev friendly. |
||
#if not CLEAN25 | ||
GPT4LatestLbl: Label 'gpt-4-latest', Locked = true; | ||
GPT4PreviewLbl: Label 'gpt-4-preview', Locked = true; | ||
|
@@ -103,12 +108,55 @@ | |
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 | ||
DeprecatedDeployments.Add(Turbo0301SaasLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 118 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This label is defined in the file, but it's between the We can talk about this in person if you like :) |
||
DeprecatedDeployments.Add(GPT40613SaasLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 119 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
DeprecatedDeployments.Add(Turbo0613SaasLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 120 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
DeprecatedDeployments.Add(GPT35TurboLatestLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 121 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
DeprecatedDeployments.Add(GPT35TurboPreviewLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 122 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
DeprecatedDeployments.Add(GPT4PreviewLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 123 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
DeprecatedDeployments.Add(GPT4LatestLbl, DMY2Date(1, 11, 2024)); | ||
Check failure on line 124 in src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al GitHub Actions / Build System Application and Tools (Clean) / System Application and Tools (Clean)
|
||
|
||
DeprecationDatesInitialized := true; | ||
end; | ||
|
||
// Application Insights telemetry on deprecated models | ||
local procedure LogDeprecationTelemetry(DeploymentName: Text) | ||
var | ||
CustomDimensions: Dictionary of [Text, Text]; | ||
IsDeprecated: Boolean; | ||
DeprecatedDate: Date; | ||
begin | ||
InitializeDeploymentDeprecationDates(); | ||
IsDeprecated := DeprecatedDeployments.ContainsKey(DeploymentName); | ||
if IsDeprecated then begin | ||
DeprecatedDate := DeprecatedDeployments.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; | ||
end; | ||
|
||
local procedure GetDeploymentName(DeploymentName: Text; CallerModuleInfo: ModuleInfo): Text | ||
var | ||
AzureOpenAiImpl: Codeunit "Azure OpenAI Impl"; | ||
CurrentModuleInfo: ModuleInfo; | ||
begin | ||
LogDeprecationTelemetry(DeploymentName); | ||
|
||
NavApp.GetCurrentModuleInfo(CurrentModuleInfo); | ||
|
||
if (CallerModuleInfo.Publisher <> CurrentModuleInfo.Publisher) and not AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls() then | ||
Error(UnableToGetDeploymentNameErr); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we translate these strings or do we emit partner telemetry always in english?
If we translate them, you are good, but if we emit in english, you need to lock this string for translations, by adding
, Locked = true
after you close the quote of the comment