File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
sample/Cnblogs.DashScope.Sample Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 99using Microsoft . Extensions . AI ;
1010using ChatMessage = Cnblogs . DashScope . Core . ChatMessage ;
1111
12- const string apiKey = "sk-**" ;
12+ const string apiKey = "sk-*** " ;
1313var dashScopeClient = new DashScopeClient ( apiKey ) ;
1414
1515Console . WriteLine ( "Choose the sample you want to run:" ) ;
@@ -195,7 +195,9 @@ string GetWeather(WeatherReportParameters parameters)
195195
196196async Task ChatWithMicrosoftExtensions ( )
197197{
198+ Console . WriteLine ( "Requesting model..." ) ;
198199 var chatClient = dashScopeClient . AsChatClient ( "qwen-max" ) ;
199200 var response = await chatClient . CompleteAsync ( "你好,很高兴认识你" ) ;
200- Console . WriteLine ( JsonSerializer . Serialize ( response ) ) ;
201+ var serializerOptions = new JsonSerializerOptions ( JsonSerializerDefaults . Web ) { WriteIndented = true } ;
202+ Console . WriteLine ( JsonSerializer . Serialize ( response , serializerOptions ) ) ;
201203}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public static string GetDescription(this SampleType sampleType)
1111 SampleType . ChatCompletion => "Conversation between user and assistant" ,
1212 SampleType . ChatCompletionWithTool => "Function call sample" ,
1313 SampleType . ChatCompletionWithFiles => "File upload sample using qwen-long" ,
14+ SampleType . MicrosoftExtensionsAi => "Use with Microsoft.Extensions.AI" ,
1415 _ => throw new ArgumentOutOfRangeException ( nameof ( sampleType ) , sampleType , "Unsupported sample option" )
1516 } ;
1617 }
You can’t perform that action at this time.
0 commit comments