diff --git a/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIChatMessages.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIChatMessages.Codeunit.al
index 6fb58731ae..48e8086590 100644
--- a/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIChatMessages.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIChatMessages.Codeunit.al
@@ -199,19 +199,15 @@ codeunit 7763 "AOAI Chat Messages"
exit(AOAIChatMessagesImpl.GetHistoryTokenCount());
end;
-#if not CLEAN25
///
/// Appends a Tool to the payload.
///
/// The Tool to be added to the payload.
/// See more details here: https://go.microsoft.com/fwlink/?linkid=2254538
[NonDebuggable]
- [Obsolete('Use AddTool that takes in an AOAI Function interface.', '25.0')]
procedure AddTool(NewTool: JsonObject)
begin
-#pragma warning disable AL0432
AOAIToolsImpl.AddTool(NewTool);
-#pragma warning restore AL0432
end;
///
@@ -221,12 +217,9 @@ codeunit 7763 "AOAI Chat Messages"
/// The new Tool.
/// Message id does not exist.
[NonDebuggable]
- [Obsolete('Deprecated with no replacement. Use DeleteFunctionTool and AddTool.', '25.0')]
procedure ModifyTool(Id: Integer; NewTool: JsonObject)
begin
-#pragma warning disable AL0432
AOAIToolsImpl.ModifyTool(Id, NewTool);
-#pragma warning restore AL0432
end;
///
@@ -234,14 +227,10 @@ codeunit 7763 "AOAI Chat Messages"
///
/// Id of the Tool.
/// Message id does not exist.
- [Obsolete('Use DeleteFunctionTool that takes in a function name instead.', '25.0')]
procedure DeleteTool(Id: Integer)
begin
-#pragma warning disable AL0432
AOAIToolsImpl.DeleteTool(Id);
-#pragma warning restore AL0432
end;
-#endif
///
/// Adds a function to the payload.
@@ -290,20 +279,15 @@ codeunit 7763 "AOAI Chat Messages"
exit(AOAIToolsImpl.GetFunctionTools());
end;
-#if not CLEAN25
///
/// Gets the list of Tools.
///
/// List of Tools.
[NonDebuggable]
- [Obsolete('Use GetFunctionTool() that takes in a function name and returns the interface.', '25.0')]
procedure GetTools(): List of [JsonObject]
begin
-#pragma warning disable AL0432
exit(AOAIToolsImpl.GetTools());
-#pragma warning restore AL0432
end;
-#endif
///
/// Checks if at least one Tools exists in the list.
diff --git a/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIToolsImpl.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIToolsImpl.Codeunit.al
index cb56511ab4..7e0eb5af9f 100644
--- a/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIToolsImpl.Codeunit.al
+++ b/src/System Application/App/AI/src/Azure OpenAI/Chat Completion/AOAIToolsImpl.Codeunit.al
@@ -18,11 +18,9 @@ codeunit 7778 "AOAI Tools Impl"
AddToolToPayload: Boolean;
[NonDebuggable]
ToolChoice: Text;
-#if not CLEAN25
[NonDebuggable]
Tools: List of [JsonObject];
ToolIdDoesNotExistErr: Label 'Tool id does not exist.';
-#endif
ToolObjectInvalidErr: Label '%1 object does not contain %2 property.', Comment = '%1 is the object name and %2 is the property that is missing.';
ToolTypeErr: Label 'Tool type must be of function type.';
TooManyFunctionsAddedErr: Label 'Too many functions have been added. Maximum number of functions is %1', Comment = '%1 is the maximum number of tools that can be added.';
@@ -61,9 +59,7 @@ codeunit 7778 "AOAI Tools Impl"
exit(FunctionNames.Keys());
end;
-#if not CLEAN25
[NonDebuggable]
- [Obsolete('Use AddTool that takes in an AOAI Function interface instead.', '25.0')]
procedure AddTool(NewTool: JsonObject)
begin
Initialize();
@@ -72,7 +68,6 @@ codeunit 7778 "AOAI Tools Impl"
end;
[NonDebuggable]
- [Obsolete('Use ModifyTool that takes in an AOAI Function interface instead.', '25.0')]
procedure ModifyTool(Id: Integer; NewTool: JsonObject)
begin
if (Id < 1) or (Id > Tools.Count) then
@@ -81,7 +76,6 @@ codeunit 7778 "AOAI Tools Impl"
Tools.Set(Id, NewTool);
end;
- [Obsolete('Use DeleteTool that takes in a function name instead.', '25.0')]
procedure DeleteTool(Id: Integer)
begin
if (Id < 1) or (Id > Tools.Count) then
@@ -91,12 +85,10 @@ codeunit 7778 "AOAI Tools Impl"
end;
[NonDebuggable]
- [Obsolete('Use GetTool() that takes in a function name and var for AOAI Function interface.', '25.0')]
procedure GetTools(): List of [JsonObject]
begin
exit(Tools);
end;
-#endif
procedure DeleteTool(Name: Text): Boolean
var
@@ -118,9 +110,7 @@ codeunit 7778 "AOAI Tools Impl"
procedure ClearTools()
begin
-#if not CLEAN25
Clear(Tools);
-#endif
Clear(Functions);
Clear(FunctionNames);
end;
@@ -129,9 +119,7 @@ codeunit 7778 "AOAI Tools Impl"
procedure PrepareTools() ToolsResult: JsonArray
var
Counter: Integer;
-#if not CLEAN25
Tool: JsonObject;
-#endif
begin
Initialize();
Counter := 1;
@@ -142,7 +130,6 @@ codeunit 7778 "AOAI Tools Impl"
Counter += 1;
until Counter > FunctionNames.Count();
-#if not CLEAN25
Counter := 1;
if Tools.Count <> 0 then
repeat
@@ -151,7 +138,6 @@ codeunit 7778 "AOAI Tools Impl"
ToolsResult.Add(Tool);
Counter += 1;
until Counter > Tools.Count;
-#endif
end;
procedure ToolsExists(): Boolean
@@ -159,11 +145,7 @@ codeunit 7778 "AOAI Tools Impl"
if not AddToolToPayload then
exit(false);
-#if not CLEAN25
if (FunctionNames.Count() = 0) and (Tools.Count = 0) then
-#else
- if (FunctionNames.Count() = 0) then
-#endif
exit(false);
exit(true);
diff --git a/src/System Application/Test/AI/src/AzureOpenAIToolsTest.Codeunit.al b/src/System Application/Test/AI/src/AzureOpenAIToolsTest.Codeunit.al
index 2186299e15..5b9ceba4e9 100644
--- a/src/System Application/Test/AI/src/AzureOpenAIToolsTest.Codeunit.al
+++ b/src/System Application/Test/AI/src/AzureOpenAIToolsTest.Codeunit.al
@@ -11,19 +11,16 @@ codeunit 132686 "Azure OpenAI Tools Test"
var
LibraryAssert: Codeunit "Library Assert";
ToolObjectInvalidErr: Label '%1 object does not contain %2 property.', Comment = '%1 is the object name and %2 is the property that is missing.';
-#if not CLEAN25
+
[Test]
procedure TestAddingToolsInChatMessages()
var
AOAIChatMessages: Codeunit "AOAI Chat Messages";
begin
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
-#pragma warning restore AL0432
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool via JsonObject should exist');
end;
-#endif
[Test]
procedure TestAddingFunctionsInChatMessages()
@@ -36,7 +33,6 @@ codeunit 132686 "Azure OpenAI Tools Test"
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool via interface should exist');
end;
-#if not CLEAN25
[Test]
procedure TestModifyToolsInChatMessages()
var
@@ -47,21 +43,15 @@ codeunit 132686 "Azure OpenAI Tools Test"
begin
Function1Tool := GetTestFunction1Tool();
Function2Tool := GetTestFunction2Tool();
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(Function1Tool);
Tools := AOAIChatMessages.GetTools();
-#pragma warning restore AL0432
LibraryAssert.AreEqual(1, Tools.Count, 'Tool should exist');
LibraryAssert.AreEqual(Format(Function1Tool), Format(Tools.Get(1)), 'Tool should have same value.');
-#pragma warning disable AL0432
AOAIChatMessages.ModifyTool(1, Function2Tool);
-#pragma warning restore AL0432
LibraryAssert.AreEqual(Format(Function2Tool), Format(Tools.Get(1)), 'Tool should have same value.');
-#pragma warning disable AL0432
AOAIChatMessages.DeleteTool(1);
-#pragma warning restore AL0432
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
end;
@@ -74,23 +64,16 @@ codeunit 132686 "Azure OpenAI Tools Test"
Payload: Text;
begin
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
AOAIChatMessages.AddTool(GetTestFunction2Tool());
-#pragma warning restore AL0432
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool should exist');
-#pragma warning disable AL0432
AOAIChatMessages.DeleteTool(1);
-#pragma warning restore AL0432
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool should exist');
-#pragma warning disable AL0432
Tools := AOAIChatMessages.GetTools();
-#pragma warning restore AL0432
Tools.Get(1, ToolObject);
ToolObject.WriteTo(Payload);
LibraryAssert.AreEqual(Format(GetTestFunction2Tool()), Payload, 'Tool should have same value.');
end;
-#endif
[Test]
procedure TestDeleteFunctionToolInChatMessages()
@@ -115,22 +98,18 @@ codeunit 132686 "Azure OpenAI Tools Test"
LibraryAssert.AreEqual(Format(TestFunction2.GetPrompt()), Payload, 'Tool should have same value.');
end;
-#if not CLEAN25
[Test]
procedure TestClearToolsInChatMessagesObsoleted()
var
AOAIChatMessages: Codeunit "AOAI Chat Messages";
begin
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
AOAIChatMessages.AddTool(GetTestFunction2Tool());
-#pragma warning restore AL0432
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool should exist');
AOAIChatMessages.ClearTools();
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'No tool should exist');
end;
-#endif
[Test]
procedure TestClearToolsInChatMessages()
@@ -147,20 +126,16 @@ codeunit 132686 "Azure OpenAI Tools Test"
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'No tool should exist');
end;
-#if not CLEAN25
[Test]
procedure TestSetAddToolsToChatMessages()
var
AOAIChatMessages: Codeunit "AOAI Chat Messages";
begin
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
-#pragma warning restore AL0432
LibraryAssert.IsTrue(AOAIChatMessages.ToolsExists(), 'Tool should exist');
AOAIChatMessages.SetAddToolsToPayload(false);
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
end;
-#endif
[Test]
procedure TestSetAddFunctionToolsToChatMessages()
@@ -173,7 +148,7 @@ codeunit 132686 "Azure OpenAI Tools Test"
AOAIChatMessages.SetAddToolsToPayload(false);
LibraryAssert.IsFalse(AOAIChatMessages.ToolsExists(), 'Tool should not exist');
end;
-#if not CLEAN25
+
[Test]
procedure TestToolFormatInChatMessages()
var
@@ -182,19 +157,14 @@ codeunit 132686 "Azure OpenAI Tools Test"
begin
Function1Tool := GetTestFunction1Tool();
Function1Tool.Remove('type');
-#pragma warning disable AL0432
asserterror AOAIChatMessages.AddTool(Function1Tool);
-#pragma warning restore AL0432
LibraryAssert.ExpectedError(StrSubstNo(ToolObjectInvalidErr, 'Tool', 'type'));
Function1Tool := GetTestFunction1Tool();
Function1Tool.Remove('function');
-#pragma warning disable AL0432
asserterror AOAIChatMessages.AddTool(Function1Tool);
-#pragma warning restore AL0432
LibraryAssert.ExpectedError(StrSubstNo(ToolObjectInvalidErr, 'Tool', 'function'));
end;
-#endif
[Test]
procedure TestFunctionToolFormatInChatMessages()
@@ -210,7 +180,6 @@ codeunit 132686 "Azure OpenAI Tools Test"
LibraryAssert.ExpectedError(StrSubstNo(ToolObjectInvalidErr, 'Tool', 'function'));
end;
-#if not CLEAN25
[Test]
procedure TestToolCoiceInChatMessages()
var
@@ -219,16 +188,13 @@ codeunit 132686 "Azure OpenAI Tools Test"
ToolChoice: Text;
begin
Function1Tool := GetTestFunction1Tool();
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
-#pragma warning restore AL0432
LibraryAssert.AreEqual('auto', AOAIChatMessages.GetToolChoice(), 'Tool choice should be auto by default.');
ToolChoice := GetToolChoice();
AOAIChatMessages.SetToolChoice(ToolChoice);
LibraryAssert.AreEqual(ToolChoice, AOAIChatMessages.GetToolChoice(), 'Tool choice should be equal to what was set.');
end;
-#endif
[Test]
procedure TestToolChoiceInChatMessages()
@@ -271,7 +237,6 @@ codeunit 132686 "Azure OpenAI Tools Test"
LibraryAssert.AreEqual(Format(TestFunction2.GetPrompt()), Format(Tool2), 'Tool should have same value.');
end;
-#if not CLEAN25
[Test]
procedure TestAssembleToolsInChatMessages()
var
@@ -284,14 +249,10 @@ codeunit 132686 "Azure OpenAI Tools Test"
Tools: JsonArray;
begin
Function1Tool := GetTestFunction1Tool();
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction1Tool());
-#pragma warning restore AL0432
Function2Tool := GetTestFunction2Tool();
-#pragma warning disable AL0432
AOAIChatMessages.AddTool(GetTestFunction2Tool());
-#pragma warning restore AL0432
Tools := AzureOpenAITestLibrary.GetAOAIAssembleTools(AOAIChatMessages);
@@ -578,7 +539,6 @@ codeunit 132686 "Azure OpenAI Tools Test"
ToolJsonObject.ReadFrom(TestTool);
exit(ToolJsonObject);
end;
-#endif
local procedure GetToolChoice(): Text
begin