diff --git a/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDIImpl.Codeunit.al b/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDIImpl.Codeunit.al
index fa1bec7d83..863cf314c6 100644
--- a/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDIImpl.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDIImpl.Codeunit.al
@@ -11,7 +11,7 @@ using System.AI;
///
/// Azure Document Intelligence implementation.
///
-codeunit 7779 "Azure DI Impl."
+codeunit 7779 "Azure DI Impl." implements IAIServiceName
{
Access = Internal;
InherentEntitlements = X;
@@ -29,9 +29,9 @@ codeunit 7779 "Azure DI Impl."
AzureAiDocumentIntelligenceTxt: Label 'Azure AI Document Intelligence', Locked = true;
CapabilityNotEnabledErr: Label 'Copilot capability ''%1'' has not been enabled. Please contact your system administrator.', Comment = '%1 is the name of the Copilot Capability';
- procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo; AzureAIServiceName: Text)
+ procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo)
begin
- CopilotCapabilityImpl.SetCopilotCapability(Capability, CallerModuleInfo, AzureAIServiceName);
+ CopilotCapabilityImpl.SetCopilotCapability(Capability, CallerModuleInfo, Enum::"Azure AI Service Type"::"Azure Document Intelligence");
end;
procedure RegisterCopilotCapability(CopilotCapability: Enum "Copilot Capability"; CopilotAvailability: Enum "Copilot Availability"; LearnMoreUrl: Text[2048]; CallerModuleInfo: ModuleInfo)
@@ -134,7 +134,12 @@ codeunit 7779 "Azure DI Impl."
exit(JsonText);
end;
- procedure GetAzureAIDocumentIntelligenceCategory(): Code[50]
+ procedure GetServiceName(): Text[250]
+ begin
+ exit(AzureAiDocumentIntelligenceTxt);
+ end;
+
+ procedure GetServiceId(): Code[50];
begin
exit(AzureAiDocumentIntelligenceTxt);
end;
diff --git a/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDocumentIntelligence.Codeunit.al b/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDocumentIntelligence.Codeunit.al
index e31adc32a1..d9ca35a59b 100644
--- a/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDocumentIntelligence.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure AI Document Intelligence/AzureDocumentIntelligence.Codeunit.al
@@ -69,7 +69,7 @@ codeunit 7780 "Azure Document Intelligence"
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
- AzureDIImpl.SetCopilotCapability(CopilotCapability, CallerModuleInfo, AzureDIImpl.GetAzureAIDocumentIntelligenceCategory());
+ AzureDIImpl.SetCopilotCapability(CopilotCapability, CallerModuleInfo);
end;
}
\ No newline at end of file
diff --git a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al
index 2f916b73db..21579c9bab 100644
--- a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al
@@ -268,7 +268,7 @@ codeunit 7771 "Azure OpenAI"
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
- AzureOpenAIImpl.SetCopilotCapability(CopilotCapability, CallerModuleInfo, AzureOpenAIImpl.GetAzureOpenAICategory());
+ AzureOpenAIImpl.SetCopilotCapability(CopilotCapability, CallerModuleInfo);
end;
#if not CLEAN24
diff --git a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al
index 357629a35f..e519620846 100644
--- a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al
@@ -11,7 +11,7 @@ using System.Environment;
using System.Privacy;
using System.Telemetry;
-codeunit 7772 "Azure OpenAI Impl"
+codeunit 7772 "Azure OpenAI Impl" implements IAIServiceName
{
Access = Internal;
InherentEntitlements = X;
@@ -61,9 +61,9 @@ codeunit 7772 "Azure OpenAI Impl"
CopilotCapabilityImpl.IsCapabilityEnabled(Capability, Silent, CallerModuleInfo);
end;
- procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo; AzureAIServiceName: Text)
+ procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo)
begin
- CopilotCapabilityImpl.SetCopilotCapability(Capability, CallerModuleInfo, AzureAIServiceName);
+ CopilotCapabilityImpl.SetCopilotCapability(Capability, CallerModuleInfo, Enum::"Azure AI Service Type"::"Azure OpenAI");
end;
procedure IsAuthorizationConfigured(ModelType: Enum "AOAI Model Type"; CallerModule: ModuleInfo): Boolean
@@ -616,12 +616,22 @@ codeunit 7772 "Azure OpenAI Impl"
exit(AzureOpenAiTxt);
end;
+ procedure GetServiceName(): Text[250];
+ begin
+ exit(AzureOpenAiTxt);
+ end;
+
+ procedure GetServiceId(): Code[50];
+ begin
+ exit(AzureOpenAiTxt);
+ end;
+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Privacy Notice", 'OnRegisterPrivacyNotices', '', false, false)]
local procedure CreatePrivacyNoticeRegistrations(var TempPrivacyNotice: Record "Privacy Notice" temporary)
begin
TempPrivacyNotice.Init();
TempPrivacyNotice.ID := GetAzureOpenAICategory();
- TempPrivacyNotice."Integration Service Name" := AzureOpenAiTxt;
+ TempPrivacyNotice."Integration Service Name" := GetServiceName();
if not TempPrivacyNotice.Insert() then;
end;
diff --git a/src/System Application/App/AI/src/Copilot/AzureAIServiceType.Enum.al b/src/System Application/App/AI/src/Copilot/AzureAIServiceType.Enum.al
index 905531fae0..f7e112f07a 100644
--- a/src/System Application/App/AI/src/Copilot/AzureAIServiceType.Enum.al
+++ b/src/System Application/App/AI/src/Copilot/AzureAIServiceType.Enum.al
@@ -7,7 +7,7 @@ namespace System.AI;
///
/// The supported service types for Azure AI.
///
-enum 7778 "Azure AI Service Type"
+enum 7778 "Azure AI Service Type" implements IAIServiceName
{
Access = Public;
Extensible = false;
@@ -18,6 +18,7 @@ enum 7778 "Azure AI Service Type"
value(0; "Azure OpenAI")
{
Caption = 'Azure OpenAI';
+ Implementation = IAIServiceName = "Azure OpenAI Impl";
}
///
@@ -26,5 +27,6 @@ enum 7778 "Azure AI Service Type"
value(1; "Azure Document Intelligence")
{
Caption = 'Azure Document Intelligence';
+ Implementation = IAIServiceName = "Azure OpenAI Impl";
}
}
\ No newline at end of file
diff --git a/src/System Application/App/AI/src/Copilot/CopilotCapabilityImpl.Codeunit.al b/src/System Application/App/AI/src/Copilot/CopilotCapabilityImpl.Codeunit.al
index 421caad2a1..58086b031d 100644
--- a/src/System Application/App/AI/src/Copilot/CopilotCapabilityImpl.Codeunit.al
+++ b/src/System Application/App/AI/src/Copilot/CopilotCapabilityImpl.Codeunit.al
@@ -81,10 +81,11 @@ codeunit 7774 "Copilot Capability Impl"
Telemetry.LogMessage('0000LDV', TelemetryRegisteredNewCopilotCapabilityLbl, Verbosity::Normal, DataClassification::OrganizationIdentifiableInformation, Enum::"AL Telemetry Scope"::All, CustomDimensions);
end;
- procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo; AzureAIServiceName: Text)
+ procedure SetCopilotCapability(Capability: Enum "Copilot Capability"; CallerModuleInfo: ModuleInfo; AIServiceType: Enum "Azure AI Service Type")
var
CopilotTelemetry: Codeunit "Copilot Telemetry";
Language: Codeunit Language;
+ IAIServicename: Interface IAIServiceName;
SavedGlobalLanguageId: Integer;
CustomDimensions: Dictionary of [Text, Text];
ErrorMessage: Text;
@@ -96,7 +97,8 @@ codeunit 7774 "Copilot Capability Impl"
CustomDimensions.Add('AppId', Format(CallerModuleInfo.Id()));
GlobalLanguage(SavedGlobalLanguageId);
- FeatureTelemetry.LogError('0000LFN', AzureAIServiceName, TelemetrySetCapabilityLbl, TelemetryCopilotCapabilityNotRegisteredLbl, '', Enum::"AL Telemetry Scope"::All, CustomDimensions);
+ IAIServicename := AIServiceType;
+ FeatureTelemetry.LogError('0000LFN', IAIServicename.GetServiceName(), TelemetrySetCapabilityLbl, TelemetryCopilotCapabilityNotRegisteredLbl, '', Enum::"AL Telemetry Scope"::All, CustomDimensions);
ErrorMessage := StrSubstNo(CapabilityNotRegisteredErr, Capability);
Error(ErrorMessage);
end;
diff --git a/src/System Application/App/AI/src/Copilot/Interfaces/IAIServiceName.Interface.al b/src/System Application/App/AI/src/Copilot/Interfaces/IAIServiceName.Interface.al
new file mode 100644
index 0000000000..462218b4d6
--- /dev/null
+++ b/src/System Application/App/AI/src/Copilot/Interfaces/IAIServiceName.Interface.al
@@ -0,0 +1,25 @@
+// ------------------------------------------------------------------------------------------------
+// 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;
+
+///
+/// Interface for providing naming information for a given AI service.
+///
+interface IAIServiceName
+{
+
+ ///
+ /// Get the name of the service.
+ ///
+ /// The name of the service.
+ procedure GetServiceName(): Text[250];
+
+ ///
+ /// Get the id of the service. Will often be the service name in Code form.
+ ///
+ /// The id of the service.
+ procedure GetServiceId(): Code[50];
+
+}
\ No newline at end of file
diff --git a/src/System Application/Test/AI/src/AzureDITest.Codeunit.al b/src/System Application/Test/AI/src/AzureDITest.Codeunit.al
index f472a12c53..767f6b6dd5 100644
--- a/src/System Application/Test/AI/src/AzureDITest.Codeunit.al
+++ b/src/System Application/Test/AI/src/AzureDITest.Codeunit.al
@@ -71,7 +71,7 @@ codeunit 132685 "Azure DI Test"
asserterror AzureDI.AnalyzeInvoice('Test');
// [THEN] AnalyzeInvoice returns an error
- LibraryAssert.ExpectedError('Copilot is not enabled. Please contact your system administrator.');
+ LibraryAssert.ExpectedError('Copilot capability ''Text Capability'' has not been enabled. Please contact your system administrator.');
end;
local procedure RegisterCapability(Capability: Enum "Copilot Capability")