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"
23
23
## Usage
24
24
Program.cs
25
25
``` cs
26
- using Microsoft .Extensions .Configuration ;
27
- using Microsoft .Extensions .DependencyInjection ;
28
26
using Microsoft .SemanticKernel ;
29
27
30
28
var builder = Kernel .CreateBuilder ();
31
- builder .Services .AddSingleton (GetConfiguration ());
32
- builder .AddDashScopeChatCompletion ();
29
+ builder .AddDashScopeChatCompletion <Program >();
33
30
var kernel = builder .Build ();
34
31
35
32
var prompt = @" <message role="" user"" >Tell me about the Cnblogs</message>" ;
36
33
var result = await kernel .InvokePromptAsync (prompt );
37
34
Console .WriteLine (result );
38
35
39
- static IConfiguration GetConfiguration ()
40
- {
41
- return new ConfigurationBuilder ()
42
- .SetBasePath (Directory .GetCurrentDirectory ())
43
- .AddJsonFile (" appsettings.json" )
44
- .AddUserSecrets <Program >()
45
- .Build ();
46
- }
47
-
48
36
public partial class Program
49
37
{ }
50
38
```
You can’t perform that action at this time.
0 commit comments