File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
samples/AspNetCoreSseServer/Tools
src/ModelContextProtocol.Core/Server Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 3
3
<ManagePackageVersionsCentrally >true</ManagePackageVersionsCentrally >
4
4
<System9Version >9.0.5</System9Version >
5
5
<System10Version >10.0.0-preview.4.25258.110</System10Version >
6
- <MicrosoftExtensionsAIVersion >9.6 .0</MicrosoftExtensionsAIVersion >
6
+ <MicrosoftExtensionsAIVersion >9.7 .0</MicrosoftExtensionsAIVersion >
7
7
</PropertyGroup >
8
8
9
9
<!-- Product dependencies netstandard -->
13
13
<PackageVersion Include =" Microsoft.Extensions.Logging.Abstractions" Version =" 8.0.3" />
14
14
<PackageVersion Include =" System.Diagnostics.DiagnosticSource" Version =" 8.0.1" />
15
15
<PackageVersion Include =" System.IO.Pipelines" Version =" 8.0.0" />
16
- <PackageVersion Include =" System.Text.Json" Version =" 8.0.5 " />
16
+ <PackageVersion Include =" System.Text.Json" Version =" 8.0.6 " />
17
17
<PackageVersion Include =" System.Threading.Channels" Version =" 8.0.0" />
18
18
</ItemGroup >
19
19
53
53
<PrivateAssets >all</PrivateAssets >
54
54
</PackageVersion >
55
55
<PackageVersion Include =" GitHubActionsTestLogger" Version =" 2.4.1" />
56
- <PackageVersion Include =" Microsoft.Extensions.AI.OpenAI" Version =" 9.6 .0-preview.1.25310 .2" />
56
+ <PackageVersion Include =" Microsoft.Extensions.AI.OpenAI" Version =" 9.7 .0-preview.1.25356 .2" />
57
57
<PackageVersion Include =" Microsoft.Extensions.DependencyInjection" Version =" $(System9Version)" />
58
58
<PackageVersion Include =" Microsoft.Extensions.Hosting" Version =" $(System9Version)" />
59
59
<PackageVersion Include =" Microsoft.Extensions.Logging" Version =" $(System9Version)" />
Original file line number Diff line number Diff line change @@ -17,19 +17,14 @@ public static async Task<string> SampleLLM(
17
17
[ Description ( "Maximum number of tokens to generate" ) ] int maxTokens ,
18
18
CancellationToken cancellationToken )
19
19
{
20
- ChatMessage [ ] messages =
21
- [
22
- new ( ChatRole . System , "You are a helpful test server." ) ,
23
- new ( ChatRole . User , prompt ) ,
24
- ] ;
25
-
26
20
ChatOptions options = new ( )
27
21
{
22
+ Instructions = "You are a helpful test server." ,
28
23
MaxOutputTokens = maxTokens ,
29
24
Temperature = 0.7f ,
30
25
} ;
31
26
32
- var samplingResponse = await thisServer . AsSamplingChatClient ( ) . GetResponseAsync ( messages , options , cancellationToken ) ;
27
+ var samplingResponse = await thisServer . AsSamplingChatClient ( ) . GetResponseAsync ( prompt , options , cancellationToken ) ;
33
28
34
29
return $ "LLM sampling result: { samplingResponse } ";
35
30
}
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ public static async Task<ChatResponse> SampleAsync(
64
64
65
65
StringBuilder ? systemPrompt = null ;
66
66
67
+ if ( options ? . Instructions is { } instructions )
68
+ {
69
+ ( systemPrompt ??= new ( ) ) . Append ( instructions ) ;
70
+ }
71
+
67
72
List < SamplingMessage > samplingMessages = [ ] ;
68
73
foreach ( var message in messages )
69
74
{
You can’t perform that action at this time.
0 commit comments