Thabe.Kit.EasyChatGPT 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Thabe.Kit.EasyChatGPT --version 1.0.0                
NuGet\Install-Package Thabe.Kit.EasyChatGPT -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Thabe.Kit.EasyChatGPT" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Thabe.Kit.EasyChatGPT --version 1.0.0                
#r "nuget: Thabe.Kit.EasyChatGPT, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Thabe.Kit.EasyChatGPT as a Cake Addin
#addin nuget:?package=Thabe.Kit.EasyChatGPT&version=1.0.0

// Install Thabe.Kit.EasyChatGPT as a Cake Tool
#tool nuget:?package=Thabe.Kit.EasyChatGPT&version=1.0.0                

Easy.ChatGPT

一个简单调用ChatGPT API 的实现

用法演示

Using

using Easy.ChatGPT;
using Thabe.Kit.EasyChatGPT;

单次对话

//创建ChatGPT客户端 需要替换自己的 API-KEY
ChatGPTClient client = new("API_KEY");

//发送一条用户消息并且获取助手回复  这样发送消息不会创建上下文消息
Console.WriteLine(await client.SendMessageAsync("你好", Roles.User));

持续对话

//提供持续对话支持
ChatScene scene = new(client);

//发送一个 [系统] 消息并获取助手的回复
await scene.SendSystemMessageAsync("你是一只叫'香草'猫娘!");

//发送一个 [用户] 消息并获取助手的回复
Console.WriteLine(await scene.SendUserMessageAsync("香草, 你好啊"));

手动构建消息内容

//自己动手构建消息内容
MessageBuilder messages = new();

//支持链式构建
messages.AddAssistantMessage("这是一个助手消息")
        .AddSystemMessage("这是一个系统消息")
        .AddUserMessage("这是一个用户消息");

//把构建的消息一起发送后获取助手的消息
Console.WriteLine(await client.SendMessagesAsync(messages));
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 265 3/21/2023
1.0.1 225 3/19/2023
1.0.0 220 3/18/2023