Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b1ff18b

Browse files
committed
feat: upgrade packages
1 parent de649d7 commit b1ff18b

File tree

8 files changed

+30
-18
lines changed

8 files changed

+30
-18
lines changed

‎src/KernelMemory.DashScope/KernelMemory.DashScope.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
<ItemGroup>
2121
<PackageReference Include="Microsoft.DeepDev.TokenizerLib" Version="1.3.3" />
22-
<PackageReference Include="Microsoft.KernelMemory.Abstractions" Version="0.93.241118.1" />
23-
<PackageReference Include="Cnblogs.DashScope.Core" Version="0.4.0" />
22+
<PackageReference Include="Microsoft.KernelMemory.Abstractions" Version="0.95.241216.2" />
23+
<PackageReference Include="Cnblogs.DashScope.Core" Version="0.5.1" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

‎src/SemanticKernel.DashScope/DashScopeChatCompletionService.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public async Task<IReadOnlyList<ChatMessageContent>> GetChatMessageContentsAsync
5555
var autoInvoke = kernel is not null && chatParameters.ToolCallBehavior?.MaximumAutoInvokeAttempts > 0;
5656
for (var it = 1; ; it++)
5757
{
58+
var chatParametersTools = chatParameters.Tools?.ToList();
5859
var response = await _dashScopeClient.GetTextCompletionAsync(
5960
new ModelRequest<TextGenerationInput, ITextGenerationParameters>
6061
{
@@ -83,14 +84,14 @@ public async Task<IReadOnlyList<ChatMessageContent>> GetChatMessageContentsAsync
8384

8485
foreach (var call in message.ToolCalls)
8586
{
86-
if (call.Type is not ToolTypes.Function||call.Functionisnull)
87+
if (call.Type is not ToolTypes.Function)
8788
{
8889
AddResponseMessage(chat, null, "Error: Tool call was not a function call.", call.Id);
8990
continue;
9091
}
9192

9293
// ensure not calling function that was not included in request list.
93-
if (chatParameters.Tools?.Any(
94+
if (chatParametersTools?.Any(
9495
x => string.Equals(x.Function?.Name, call.Function.Name, StringComparison.OrdinalIgnoreCase))
9596
!= true)
9697
{
@@ -133,7 +134,7 @@ public async Task<IReadOnlyList<ChatMessageContent>> GetChatMessageContentsAsync
133134
AddResponseMessage(chat, stringResult, null, call.Id);
134135
}
135136

136-
chatParameters.Tools?.Clear();
137+
chatParameters.Tools=[];
137138
chatParameters.ToolCallBehavior?.ConfigureOptions(kernel, chatParameters);
138139
if (it >= chatParameters.ToolCallBehavior!.MaximumAutoInvokeAttempts)
139140
{
@@ -273,7 +274,7 @@ private void LogToolCalls(IReadOnlyCollection<ToolCall>? calls)
273274
{
274275
_logger.LogTrace(
275276
"Function call requests: {Requests}",
276-
string.Join(", ", calls.Select(ftc => $"{ftc.Function?.Name}({ftc.Function?.Arguments})")));
277+
string.Join(", ", calls.Select(ftc => $"{ftc.Function.Name}({ftc.Function.Arguments})")));
277278
}
278279
}
279280

‎src/SemanticKernel.DashScope/DashScopeMapper.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ namespace Cnblogs.SemanticKernel.Connectors.DashScope;
55

66
internal static class DashScopeMapper
77
{
8-
public static List<ChatMessage> ToChatMessages(this ChatHistory history)
8+
public static List<TextChatMessage> ToChatMessages(this ChatHistory history)
99
{
1010
return history.Select(
1111
x =>
1212
{
1313
if (x is DashScopeChatMessageContent d)
1414
{
15-
return new ChatMessage(x.Role.Label, x.Content ?? string.Empty, d.Name, ToolCalls: d.ToolCalls);
15+
return new TextChatMessage(x.Role.Label, x.Content ?? string.Empty, d.Name, ToolCalls: d.ToolCalls);
1616
}
1717

18-
return new ChatMessage(x.Role.Label, x.Content ?? string.Empty);
18+
return new TextChatMessage(x.Role.Label, x.Content ?? string.Empty);
1919
}).ToList();
2020
}
2121

‎src/SemanticKernel.DashScope/DashScopePromptExecutionSettings.cs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ public class DashScopePromptExecutionSettings : PromptExecutionSettings, ITextGe
2626
/// <inheritdoc />
2727
public string? ResultFormat { get; set; }
2828

29+
/// <inheritdoc />
30+
public DashScopeResponseFormat? ResponseFormat { get; }
31+
2932
/// <inheritdoc />
3033
public int? MaxTokens { get; set; }
3134

3235
/// <inheritdoc />
3336
public float? RepetitionPenalty { get; set; }
3437

38+
/// <inheritdoc />
39+
public float? PresencePenalty { get; }
40+
3541
/// <inheritdoc />
3642
public float? Temperature { get; set; }
3743

@@ -42,7 +48,10 @@ public class DashScopePromptExecutionSettings : PromptExecutionSettings, ITextGe
4248
public bool? EnableSearch { get; set; }
4349

4450
/// <inheritdoc />
45-
public List<ToolDefinition>? Tools { get; internal set; }
51+
public ToolChoice? ToolChoice { get; }
52+
53+
/// <inheritdoc />
54+
public IEnumerable<ToolDefinition>? Tools { get; set; }
4655

4756
/// <summary>
4857
/// Gets or sets the behavior for how tool calls are handled.

‎src/SemanticKernel.DashScope/SemanticKernel.DashScope.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
<ItemGroup>
2121
<FrameworkReference Include="Microsoft.AspNetCore.App" />
22-
<PackageReference Include="Cnblogs.DashScope.Core" Version="0.4.0" />
23-
<PackageReference Include="JsonSchema.Net.Generation" Version="4.5.1" />
24-
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="1.30.0" />
22+
<PackageReference Include="Cnblogs.DashScope.Core" Version="0.5.1" />
23+
<PackageReference Include="JsonSchema.Net.Generation" Version="4.6.0" />
24+
<PackageReference Include="Microsoft.SemanticKernel.Core" Version="1.32.0" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

‎test/KernelMemory.DashScope.UnitTests/KernelMemory.DashScope.UnitTests.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
17-
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.93.241118.1" />
17+
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.95.241216.2" />
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1919
<PackageReference Include="xunit" Version="2.9.2" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
20+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Update="FluentAssertions" Version="6.12.2" />
24+
<PackageReference Update="FluentAssertions" Version="7.0.0" />
2525
<PackageReference Update="NSubstitute" Version="5.3.0" />
2626
</ItemGroup>
2727

‎test/SemanticKernel.DashScope.UnitTest/Cases.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public static ModelResponse<TextGenerationOutput, TextGenerationTokenUsage> ErrT
9595
(f, i) => new ToolCall(
9696
$"{i}",
9797
toolType,
98+
i,
9899
new($"{pluginName}-{f.Name}", paramBody))).ToList())
99100
}
100101
]
@@ -125,6 +126,7 @@ public static ModelResponse<TextGenerationOutput, TextGenerationTokenUsage>
125126
f => new ToolCall(
126127
"0",
127128
"function",
129+
0,
128130
new($"MyPlugin-{f.Name}", "{\"location\": \"LA\"}"))).ToList())
129131
}
130132
]

‎test/SemanticKernel.DashScope.UnitTest/SemanticKernel.DashScope.UnitTest.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
</PackageReference>
77
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
88
<PackageReference Include="xunit" Version="2.9.2" />
9-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
9+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
13-
<PackageReference Update="FluentAssertions" Version="6.12.2" />
13+
<PackageReference Update="FluentAssertions" Version="7.0.0" />
1414
<PackageReference Update="NSubstitute" Version="5.3.0" />
1515
</ItemGroup>
1616
<ItemGroup>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /