Skip to content

Commit a7a41d6

Browse files
authored
Updated version of Microsoft.SemanticKernel.nuget in sample projects. (#2386)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Weekly OSS update. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Absorbed breaking changes around error handling. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
1 parent b9c77f4 commit a7a41d6

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

samples/dotnet/KernelHttpServer/KernelHttpServer.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.13.0" OutputItemType="Analyzer" />
1616
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.18.0" />
1717
<PackageReference Include="Microsoft.Graph" Version="4.54.0" />
18-
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
19-
<PackageReference Include="Microsoft.SemanticKernel.Skills.Document" Version="0.18.230725.3-preview" />
20-
<PackageReference Include="Microsoft.SemanticKernel.Skills.MsGraph" Version="0.18.230725.3-preview" />
21-
<PackageReference Include="Microsoft.SemanticKernel.Skills.Web" Version="0.18.230725.3-preview" />
18+
<PackageReference Include="Microsoft.SemanticKernel" Version="0.19.230804.2-preview" />
19+
<PackageReference Include="Microsoft.SemanticKernel.Skills.Document" Version="0.19.230804.2-preview" />
20+
<PackageReference Include="Microsoft.SemanticKernel.Skills.MsGraph" Version="0.19.230804.2-preview" />
21+
<PackageReference Include="Microsoft.SemanticKernel.Skills.Web" Version="0.19.230804.2-preview" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

samples/dotnet/KernelHttpServer/SemanticKernelEndpoint.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
using System;
34
using System.Linq;
45
using System.Net;
56
using System.Text.Json;
@@ -66,7 +67,7 @@ public async Task<HttpResponseData> InvokeFunctionAsync(
6667

6768
if (result.ErrorOccurred)
6869
{
69-
return await ResponseErrorWithMessageAsync(req, result);
70+
return await ResponseErrorWithMessageAsync(req, result.LastException!);
7071
}
7172

7273
var r = req.CreateResponse(HttpStatusCode.OK);
@@ -161,19 +162,18 @@ public async Task<HttpResponseData> ExecutePlanAsync(
161162
await r.WriteAsJsonAsync(new AskResult { Value = plan.State.ToString() });
162163
}
163164
}
164-
catch (KernelException e)
165+
catch (KernelException exception)
165166
{
166-
context.Fail(e.Message, e);
167-
return await ResponseErrorWithMessageAsync(req, context);
167+
return await ResponseErrorWithMessageAsync(req, exception);
168168
}
169169

170170
return r;
171171
}
172172

173-
private static async Task<HttpResponseData> ResponseErrorWithMessageAsync(HttpRequestData req, SKContext result)
173+
private static async Task<HttpResponseData> ResponseErrorWithMessageAsync(HttpRequestData req, Exception exception)
174174
{
175-
return result.LastException is AIException aiException && aiException.Detail is not null
175+
return exception is AIException aiException && aiException.Detail is not null
176176
? await req.CreateResponseWithMessageAsync(HttpStatusCode.BadRequest, string.Concat(aiException.Message, " - Detail: " + aiException.Detail))
177-
: await req.CreateResponseWithMessageAsync(HttpStatusCode.BadRequest, result.LastErrorDescription);
177+
: await req.CreateResponseWithMessageAsync(HttpStatusCode.BadRequest, exception.Message);
178178
}
179179
}

samples/dotnet/graph-api-skills/MsGraphSkillsExample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
2222
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
2323
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
24-
<PackageReference Include="Microsoft.SemanticKernel.Skills.MsGraph" Version="0.18.230725.3-preview" />
25-
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
24+
<PackageReference Include="Microsoft.SemanticKernel.Skills.MsGraph" Version="0.19.230804.2-preview" />
25+
<PackageReference Include="Microsoft.SemanticKernel" Version="0.19.230804.2-preview" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

samples/dotnet/graph-api-skills/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static async Task Main()
164164
summarizeSkills["Summarize"]);
165165
if (fileContentResult.ErrorOccurred)
166166
{
167-
throw new InvalidOperationException($"Failed to get file content: {fileContentResult.LastErrorDescription}");
167+
throw new InvalidOperationException("Failed to get file content.", fileContentResult.LastException!);
168168
}
169169

170170
string fileSummary = fileContentResult.Result;

samples/dotnet/openapi-skills/OpenApiSkillsExample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
3232
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
3333
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
34-
<PackageReference Include="Microsoft.SemanticKernel" Version="0.18.230725.3-preview" />
35-
<PackageReference Include="Microsoft.SemanticKernel.Skills.OpenAPI" Version="0.18.230725.3-preview" />
34+
<PackageReference Include="Microsoft.SemanticKernel" Version="0.19.230804.2-preview" />
35+
<PackageReference Include="Microsoft.SemanticKernel.Skills.OpenAPI" Version="0.19.230804.2-preview" />
3636
</ItemGroup>
3737

3838
<ItemGroup>

samples/dotnet/openapi-skills/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static async Task Main(string[] args)
7575

7676
BearerAuthenticationProvider authenticationProvider = new(() => Task.FromResult(gitHubOptions.Key));
7777

78-
await kernel.ImportOpenApiSkillFromFileAsync(
78+
await kernel.ImportAIPluginAsync(
7979
skillName: "GitHubSkill",
8080
filePath: Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "GitHubSkill/openapi.json"),
8181
new OpenApiSkillExecutionParameters(authCallback: authenticationProvider.AuthenticateRequestAsync));
@@ -145,7 +145,7 @@ private static async Task<string> PlanGitHubSkill(
145145
SKContext planContext = await plan.InvokeAsync(logger: logger);
146146
if (planContext.ErrorOccurred)
147147
{
148-
logger.LogError("{0}", planContext.LastErrorDescription);
148+
logger.LogError(planContext.LastException!, "Unexpected failure executing plan");
149149
return string.Empty;
150150
}
151151
else if (string.IsNullOrWhiteSpace(planContext.Result))

0 commit comments

Comments
 (0)