Codeunit 7769 AOAI Deployments Impl in 28
- App
- System Application
- Namespace
- System.AI
Versions171819202122232425262728latest
Source in 28
src/System Application/App/AI/src/Azure OpenAI/AOAIDeploymentsImpl.Codeunit.al120 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.AI;
using System.Telemetry;
codeunit 7769 "AOAI Deployments Impl"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;
var
Telemetry: Codeunit Telemetry;
#if not CLEAN27
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;
#endif
GPT41LatestLbl: Label 'gpt-41-latest', Locked = true;
GPT41PreviewLbl: Label 'gpt-41-preview', Locked = true;
GPT41MiniLatestLbl: Label 'gpt-41-mini-latest', Locked = true;
GPT41MiniPreviewLbl: Label 'gpt-41-mini-preview', Locked = true;
DeprecatedDeployments: Dictionary of [Text, Date];
DeprecationDatesInitialized: Boolean;
DeprecationMessageLbl: Label 'We detected usage of the Azure OpenAI deployment "%1". This model is obsoleted starting %2 and the quality of your results might vary after that date. Check out codeunit 7768 AOAI Deployments to find the supported deployments.', Comment = 'Telemetry message where %1 is the name of the deployment and %2 is the date of deprecation';
#if not CLEAN27
procedure GetGPT4oPreview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oPreviewLbl));
end;
procedure GetGPT4oLatest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oLatestLbl));
end;
procedure GetGPT4oMiniPreview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oMiniPreviewLbl));
end;
procedure GetGPT4oMiniLatest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oMiniLatestLbl));
end;
#endif
procedure GetGPT41Preview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT41PreviewLbl));
end;
procedure GetGPT41Latest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT41LatestLbl));
end;
procedure GetGPT41MiniPreview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT41MiniPreviewLbl));
end;
procedure GetGPT41MiniLatest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT41MiniLatestLbl));
end;
// Initializes dictionary of deprecated models
local procedure InitializeDeploymentDeprecationDates()
begin
if DeprecationDatesInitialized then
exit;
// Add deprecated deployments with their deprecation dates here:
#if not CLEAN27
DeprecatedDeployments.Add(GPT4oLatestLbl, DMY2Date(15, 7, 2025));
DeprecatedDeployments.Add(GPT4oPreviewLbl, DMY2Date(15, 7, 2025));
DeprecatedDeployments.Add(GPT4oMiniLatestLbl, DMY2Date(15, 7, 2025));
DeprecatedDeployments.Add(GPT4oMiniPreviewLbl, DMY2Date(15, 7, 2025));
#endif
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): Text
var
CurrentModuleInfo: ModuleInfo;
begin
LogDeprecationTelemetry(DeploymentName);
NavApp.GetCurrentModuleInfo(CurrentModuleInfo);
exit(DeploymentName);
end;
}Procedures, 8
| Name | Parameters | Returns | Access | Obsolete |
|---|---|---|---|---|
| GetGPT4oPreview | (ModuleInfo) | Text | public | - |
| GetGPT4oLatest | (ModuleInfo) | Text | public | - |
| GetGPT4oMiniPreview | (ModuleInfo) | Text | public | - |
| GetGPT4oMiniLatest | (ModuleInfo) | Text | public | - |
| GetGPT41Preview | (ModuleInfo) | Text | public | - |
| GetGPT41Latest | (ModuleInfo) | Text | public | - |
| GetGPT41MiniPreview | (ModuleInfo) | Text | public | - |
| GetGPT41MiniLatest | (ModuleInfo) | Text | public | - |