Skip to content

Commit

Permalink
chore: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cnblogs-dudu authored Feb 13, 2024
1 parent 3d6084b commit a2d94c2
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,16 @@ dotnet user-secrets set "dashscope:apiKey" "sk-xxx"
## Usage
Program.cs
```cs
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;

var builder = Kernel.CreateBuilder();
builder.Services.AddSingleton(GetConfiguration());
builder.AddDashScopeChatCompletion();
builder.AddDashScopeChatCompletion<Program>();
var kernel = builder.Build();

var prompt = @"<message role=""user"">Tell me about the Cnblogs</message>";
var result = await kernel.InvokePromptAsync(prompt);
Console.WriteLine(result);

static IConfiguration GetConfiguration()
{
return new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.AddUserSecrets<Program>()
.Build();
}

public partial class Program
{ }
```
Expand Down

0 comments on commit a2d94c2

Please sign in to comment.