Skip to content

Commit 5b510fe

Browse files
committed
Made sure to align AI invocation calls with new refactored interface exposed in the Common.AI module.
1 parent 76e0b4e commit 5b510fe

21 files changed

+136
-421
lines changed

Modules/Intent.Modules.AI.AutoImplementation/Intent.AI.AutoImplementation.imodspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.AI.AutoImplementation</id>
4-
<version>1.0.0-beta.18</version>
4+
<version>1.0.0-beta.19</version>
55
<supportedClientVersions>[4.5.18-a,5.0.0)</supportedClientVersions>
66
<summary>AI auto-implementation of business logic capabilities for the Services designer. By default, uses Open AI and requires an API Key.</summary>
77
<description>AI auto-implementation of business logic capabilities for the Services designer. By default, uses Open AI and requires an API Key.</description>
@@ -15,7 +15,7 @@
1515
<moduleSettings></moduleSettings>
1616
<dependencies>
1717
<dependency id="Intent.Common" version="3.7.2" />
18-
<dependency id="Intent.Common.AI" version="1.0.0-beta.10" />
18+
<dependency id="Intent.Common.AI" version="1.0.0-beta.13" />
1919
<dependency id="Intent.Common.Types" version="3.4.0" />
2020
<dependency id="Intent.Modelers.Services" version="3.8.0" />
2121
<dependency id="Intent.Modelers.Services.CQRS" version="5.1.1" />

Modules/Intent.Modules.AI.AutoImplementation/Intent.Metadata/Module Builder/Intent.AI.AutoImplementation/Intent.AI.AutoImplementation.pkg.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<definitionPackageName>Intent.ModuleBuilder</definitionPackageName>
3535
<definitionPackageId>9972b2a9-b749-4bba-b5c8-824bf694c6ef</definitionPackageId>
3636
<properties>
37-
<property name="4bb9695b-6004-46e1-acea-c48c60c5f8ce" display="Version" value="1.0.0-beta.17" isActive="true" />
37+
<property name="4bb9695b-6004-46e1-acea-c48c60c5f8ce" display="Version" value="1.0.0-beta.19" isActive="true" />
3838
<property name="177a2415-e749-46e7-8257-440e19ecfb5e" display="API Namespace" isActive="true" />
3939
<property name="0d2ae582-090e-42d6-a7d6-689144433254" display="NuGet Package Id" isActive="true" />
4040
<property name="27cf6544-a9a2-4992-9fef-51d0ed49e66e" display="NuGet Package Version" value="" isActive="true" />

Modules/Intent.Modules.AI.AutoImplementation/Intent.Modules.AI.AutoImplementation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Intent.Modules.Common" Version="3.7.3" />
16-
<PackageReference Include="Intent.Modules.Common.AI" Version="1.0.0-beta.10" />
16+
<PackageReference Include="Intent.Modules.Common.AI" Version="1.0.0-beta.13" />
1717
<PackageReference Include="Intent.Modules.Common.CSharp" Version="3.8.6" />
1818
<PackageReference Include="Intent.Modules.Modelers.Services" Version="3.8.0" />
1919
<PackageReference Include="Intent.Modules.Modelers.Services.CQRS" Version="5.1.1" />

Modules/Intent.Modules.AI.AutoImplementation/Tasks/AutoImplementCqrsHandlerTask.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
using Intent.Modelers.Services.Api;
1111
using Intent.Modelers.Services.DomainInteractions.Api;
1212
using Intent.Modules.Common.AI;
13+
using Intent.Modules.Common.AI.CodeGeneration;
1314
using Intent.Plugins;
1415
using Intent.Registrations;
1516
using Intent.Utils;
1617
using Microsoft.SemanticKernel;
1718
using Newtonsoft.Json;
18-
using Intent.Modules.AI.AutoImplementation.Tasks.Helpers;
19+
using Intent.Modules.Common.AI.Extensions;
1920
using Intent.Modules.Common.AI.Settings;
2021
using ApiMetadataDesignerExtensions = Intent.Modelers.Domain.Api.ApiMetadataDesignerExtensions;
2122

@@ -75,14 +76,18 @@ public string Execute(params string[] args)
7576

7677
var designContext = GetDesignContext(element);
7778

78-
var requestFunction = CreatePromptFunction(kernel, thinkingLevel);
79-
var fileChangesResult = requestFunction.InvokeFileChangesPrompt(kernel, new KernelArguments()
80-
{
81-
["inputFilesJson"] = jsonInput,
82-
["designContext"] = designContext,
83-
["userProvidedContext"] = userProvidedContext,
84-
["targetFileName"] = element.Name + "Handler"
85-
});
79+
var promptTemplate = GetPromptTemplate();
80+
var fileChangesResult = kernel.InvokeFileChangesPrompt(
81+
promptTemplate: promptTemplate,
82+
thinkingLevel: thinkingLevel,
83+
arguments: new KernelArguments()
84+
{
85+
["inputFilesJson"] = jsonInput,
86+
["designContext"] = designContext,
87+
["userProvidedContext"] = userProvidedContext,
88+
["targetFileName"] = element.Name + "Handler",
89+
["fileChangesSchema"] = FileChangesSchema.GetPromptInstructions()
90+
});
8691

8792
// Output the updated file changes.
8893
var applicationConfig = _solution.GetApplicationConfig(args[0]);
@@ -95,7 +100,7 @@ public string Execute(params string[] args)
95100
return "success";
96101
}
97102

98-
private KernelFunction CreatePromptFunction(Kernel kernel, string thinkingLevel)
103+
private static string GetPromptTemplate()
99104
{
100105
const string promptTemplate =
101106
"""
@@ -169,9 +174,6 @@ 4. If the response contains aggregated data (e.g. Count, Sum, Average, etc.):
169174
## Input Code Files
170175
{{$inputFilesJson}}
171176
172-
## Previous Error Message
173-
{{$previousError}}
174-
175177
## Required Output Format
176178
Your response MUST include:
177179
1. Respond ONLY with deserializable JSON that matches the following schema:
@@ -217,10 +219,11 @@ 2.3. Any modified repository concrete classes (if you added implementations)
217219
2.4. All files must maintain their exact original paths (CRITICAL)
218220
2.5. All existing code and attributes must be preserved unless explicitly modified
219221
2.6. DO NOT do any character escaping to the code.
222+
223+
{{$previousError}}
220224
""";
221225

222-
var requestFunction = kernel.CreateFunctionFromPrompt(promptTemplate, kernel.GetRequiredService<IAiProviderService>().GetPromptExecutionSettings(thinkingLevel));
223-
return requestFunction;
226+
return promptTemplate;
224227
}
225228

226229
/// <summary>

Modules/Intent.Modules.AI.AutoImplementation/Tasks/AutoImplementServiceOperationTask.cs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
using Intent.Metadata.Models;
88
using Intent.Modelers.Domain.Api;
99
using Intent.Modelers.Services.Api;
10-
using Intent.Modules.AI.AutoImplementation.Tasks.Helpers;
1110
using Intent.Modules.Common.AI;
11+
using Intent.Modules.Common.AI.CodeGeneration;
12+
using Intent.Modules.Common.AI.Extensions;
1213
using Intent.Modules.Common.AI.Settings;
1314
using Intent.Plugins;
1415
using Intent.Registrations;
@@ -66,14 +67,18 @@ public string Execute(params string[] args)
6667
var inputFiles = GetInputFiles(element);
6768
var jsonInput = JsonConvert.SerializeObject(inputFiles, Formatting.Indented);
6869

69-
var requestFunction = CreatePromptFunction(kernel, thinkingLevel);
70-
var fileChangesResult = requestFunction.InvokeFileChangesPrompt(kernel, new KernelArguments()
71-
{
72-
["inputFilesJson"] = jsonInput,
73-
["userProvidedContext"] = userProvidedContext,
74-
["targetFileName"] = element.Name + "Handler",
75-
["modelName"] = element.Name
76-
});
70+
var promptTemplate = GetPromptTemplate();
71+
var fileChangesResult = kernel.InvokeFileChangesPrompt(
72+
promptTemplate: promptTemplate,
73+
thinkingLevel: thinkingLevel,
74+
arguments: new KernelArguments()
75+
{
76+
["inputFilesJson"] = jsonInput,
77+
["userProvidedContext"] = userProvidedContext,
78+
["targetFileName"] = element.Name + "Handler",
79+
["modelName"] = element.Name,
80+
["fileChangesSchema"] = FileChangesSchema.GetPromptInstructions()
81+
});
7782

7883
// Output the updated file changes.
7984
var applicationConfig = _solution.GetApplicationConfig(args[0]);
@@ -86,7 +91,7 @@ public string Execute(params string[] args)
8691
return "success";
8792
}
8893

89-
private static KernelFunction CreatePromptFunction(Kernel kernel, string thinkingLevel)
94+
private static string GetPromptTemplate()
9095
{
9196
const string promptTemplate =
9297
"""
@@ -159,9 +164,6 @@ 4. If the response contains aggregated data (e.g. Count, Sum, Average, etc.):
159164
## Input Code Files
160165
{{$inputFilesJson}}
161166
162-
## Previous Error Message
163-
{{$previousError}}
164-
165167
## Required Output Format
166168
Your response MUST include:
167169
1. Respond ONLY with deserializable JSON that matches the following schema:
@@ -206,10 +208,11 @@ 2.2. Any modified repository interfaces (if you added methods)
206208
2.3. Any modified repository concrete classes (if you added implementations)
207209
2.4. All files must maintain their exact original paths
208210
2.5. All existing code and attributes must be preserved unless explicitly modified
211+
212+
{{$previousError}}
209213
""";
210-
211-
var requestFunction = kernel.CreateFunctionFromPrompt(promptTemplate, kernel.GetRequiredService<IAiProviderService>().GetPromptExecutionSettings(thinkingLevel));
212-
return requestFunction;
214+
215+
return promptTemplate;
213216
}
214217

215218
private List<ICodebaseFile> GetInputFiles(IElement element)

Modules/Intent.Modules.AI.AutoImplementation/Tasks/Helpers/FileChangesHelper.cs

Lines changed: 0 additions & 79 deletions
This file was deleted.

Modules/Intent.Modules.AI.AutoImplementation/Tasks/Helpers/KernelFunctionExtensions.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

Modules/Intent.Modules.AI.Blazor/Intent.AI.Blazor.imodspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.AI.Blazor</id>
4-
<version>1.0.0-beta.19</version>
4+
<version>1.0.0-beta.20</version>
55
<supportedClientVersions>[4.5.18-a,5.0.0)</supportedClientVersions>
66
<summary>AI support for auto-implementing unit tests based on existing application service implementations.</summary>
77
<description>AI support for auto-implementing unit tests based on existing application service implementations.</description>
@@ -26,7 +26,7 @@
2626
<dependencies>
2727
<dependency id="Intent.Code.Weaving.Json" version="1.0.1" />
2828
<dependency id="Intent.Common" version="3.7.2" />
29-
<dependency id="Intent.Common.AI" version="1.0.0-beta.10" />
29+
<dependency id="Intent.Common.AI" version="1.0.0-beta.13" />
3030
<dependency id="Intent.Common.Types" version="3.4.0" />
3131
<dependency id="Intent.Modelers.Services" version="3.9.3" />
3232
<dependency id="Intent.Modelers.Services.CQRS" version="5.1.3" />

Modules/Intent.Modules.AI.Blazor/Intent.Metadata/Module Builder/Intent.AI.Blazor/Intent.AI.Blazor.pkg.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<definitionPackageName>Intent.ModuleBuilder</definitionPackageName>
3232
<definitionPackageId>9972b2a9-b749-4bba-b5c8-824bf694c6ef</definitionPackageId>
3333
<properties>
34-
<property name="4bb9695b-6004-46e1-acea-c48c60c5f8ce" display="Version" value="1.0.0-beta.19" isActive="true" />
34+
<property name="4bb9695b-6004-46e1-acea-c48c60c5f8ce" display="Version" value="1.0.0-beta.20" isActive="true" />
3535
<property name="177a2415-e749-46e7-8257-440e19ecfb5e" display="API Namespace" isActive="true" />
3636
<property name="0d2ae582-090e-42d6-a7d6-689144433254" display="NuGet Package Id" isActive="true" />
3737
<property name="27cf6544-a9a2-4992-9fef-51d0ed49e66e" display="NuGet Package Version" value="" isActive="true" />

Modules/Intent.Modules.AI.Blazor/Intent.Modules.AI.Blazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="Intent.Modules.Common" Version="3.7.3" />
28-
<PackageReference Include="Intent.Modules.Common.AI" Version="1.0.0-beta.10" />
28+
<PackageReference Include="Intent.Modules.Common.AI" Version="1.0.0-beta.13" />
2929
<PackageReference Include="Intent.Modules.Modelers.Services" Version="3.9.3" />
3030
<PackageReference Include="Intent.Modules.Modelers.Services.CQRS" Version="5.1.1" />
3131
<PackageReference Include="Intent.Modules.Modelers.UI" Version="1.0.0-beta.6" />

0 commit comments

Comments
 (0)