File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed
Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change @@ -23,28 +23,16 @@ dotnet user-secrets set "dashscope:apiKey" "sk-xxx"
2323## Usage
2424Program.cs
2525``` cs
26- using Microsoft .Extensions .Configuration ;
27- using Microsoft .Extensions .DependencyInjection ;
2826using Microsoft .SemanticKernel ;
2927
3028var builder = Kernel .CreateBuilder ();
31- builder .Services .AddSingleton (GetConfiguration ());
32- builder .AddDashScopeChatCompletion ();
29+ builder .AddDashScopeChatCompletion <Program >();
3330var kernel = builder .Build ();
3431
3532var prompt = @" <message role="" user"" >Tell me about the Cnblogs</message>" ;
3633var result = await kernel .InvokePromptAsync (prompt );
3734Console .WriteLine (result );
3835
39- static IConfiguration GetConfiguration ()
40- {
41- return new ConfigurationBuilder ()
42- .SetBasePath (Directory .GetCurrentDirectory ())
43- .AddJsonFile (" appsettings.json" )
44- .AddUserSecrets <Program >()
45- .Build ();
46- }
47-
4836public partial class Program
4937{ }
5038```
You can’t perform that action at this time.
0 commit comments