DeepSeek.Sdk
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DeepSeek.Sdk --version 1.0.0
NuGet\Install-Package DeepSeek.Sdk -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="DeepSeek.Sdk" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DeepSeek.Sdk" Version="1.0.0" />
<PackageReference Include="DeepSeek.Sdk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DeepSeek.Sdk --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DeepSeek.Sdk, 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.
#addin nuget:?package=DeepSeek.Sdk&version=1.0.0
#tool nuget:?package=DeepSeek.Sdk&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DeepSeek.SDK
DeepSeek.SDK 适用于VB.NET,C#.NET,.NET CORE等应用程序使用,支持普通对话,流式对话,查询余额,列出模型等接口。并支持.Net FarmeWork流式输出,WinForm,Office Vsto插件,CAD插件,Solid Work插件,CDR插件等应用接入场景。更多内容,请关注,微信公众号:办公魔盒
.NET .NET Framework版本支持
.NET 实现 | 版本支持 |
---|---|
.NET 和.NET Core | 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
.NET Framework | 4.6.1、4.6.2、4.7、4.7.1、4.7.2、4.8、4.8.1 |
Mono | 5.4、6.4 |
Xamarin.iOS | 10.14、12.16 |
Xamarin.Mac | 3.8、5.16 |
Xamarin.Android | 8.0、10.0 |
通用 Windows 平台 | 10.0.16299,待定 |
Unity | 2018 年 1 月 |
示例代码
VB.NET
Module Module1
'' 多轮对话记录,上一轮的结果
Private resultMsg As New Text.StringBuilder
'' 主函数
Sub Main(arg As String())
' api密钥
Dim apikey As String = "sk-666666666666666666666"
' 创建ds对象
Dim ds As New DeepSeek(apikey)
Task.Run(Async Function()
' 模型查询
'Dim modelList As Model = Await ds.GetModelList()
' 余额查询
'Dim ResBalance As Balance = Await ds.GetBalance
''-----------------
'Dim chatReq As New ChatRequest With {
' .Messages = New List(Of ChatRequest.MessagesType) From {
' New ChatRequest.MessagesType With {
' .Role = ChatRequest.RoleEnum.System,
' .Content = "你是一个Excel办公助手,仅回答办公相关的内容,其他无关内容忽略。"
' },
' New ChatRequest.MessagesType With {
' .Role = ChatRequest.RoleEnum.User,
' .Content = "你是谁?"
' }
' },
' .Model = ChatRequest.ModelEnum.DeepseekChat
'}
'Dim chatRes As ChatResponse = Await ds.Chat(chatReq)
''-----------------
Dim chatReq As New ChatRequest With {
.Messages = New List(Of ChatRequest.MessagesType) From {
New ChatRequest.MessagesType With {
.Role = ChatRequest.RoleEnum.System,
.Content = "你是一个Excel办公助手,仅回答办公相关的内容,其他无关内容忽略。"
},
New ChatRequest.MessagesType With {
.Role = ChatRequest.RoleEnum.Assistant,
.Content = resultMsg.ToString
},
New ChatRequest.MessagesType With {
.Role = ChatRequest.RoleEnum.User,
.Content = "你是谁?"
}
},
.Model = ChatRequest.ModelEnum.DeepseekChat,
.Stream = True
}
resultMsg.Clear() ''拼接完成则清空,进行下一轮拼接
Await ds.ChatStream(chatReq, openedCallBack:=Sub(state As String) ''打开状态
Console.WriteLine(state)
End Sub,
closedCallBack:=Sub(state) ''关闭状态
Console.WriteLine(state)
End Sub,
msgCallback:=Sub(res As ChatResponse) ''接收信息
Dim msg As String = res.Choices.First?.Delta?.Content
resultMsg.Append(msg)
Console.WriteLine(msg)
End Sub,
errorCallback:=Sub(ex As Exception) ''异常处理
Console.WriteLine(ex.Message)
End Sub)
Await Task.CompletedTask
End Function).GetAwaiter().GetResult()
End Sub
End Module
C#.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
// api密钥
string apikey = "sk-666666666666666666666";
// 创建ds对象
var ds = new DeepSeek(apikey);
Task.Run(async () =>
{
// 模型查询
// var modelList = await ds.GetModelList();
// 余额查询
// var resBalance = await ds.GetBalance();
//-----------------
// var chatReq = new ChatRequest
// {
// Messages = new List<ChatRequest.MessagesType>
// {
// new ChatRequest.MessagesType
// {
// Role = ChatRequest.RoleEnum.System,
// Content = "你是一个Excel办公助手,仅回答办公相关的内容,其他无关内容忽略。"
// },
// new ChatRequest.MessagesType
// {
// Role = ChatRequest.RoleEnum.User,
// Content = "你是谁?"
// }
// },
// Model = ChatRequest.ModelEnum.DeepseekChat
// };
// var chatRes = await ds.Chat(chatReq);
//-----------------
var chatReq = new ChatRequest
{
Messages = new List<ChatRequest.MessagesType>
{
new ChatRequest.MessagesType
{
Role = ChatRequest.RoleEnum.System,
Content = "你是一个Excel办公助手,仅回答办公相关的内容,其他无关内容忽略。"
},
new ChatRequest.MessagesType
{
Role = ChatRequest.RoleEnum.Assistant,
Content = resultMsg.ToString()
},
new ChatRequest.MessagesType
{
Role = ChatRequest.RoleEnum.User,
Content = "你是谁?"
}
},
Model = ChatRequest.ModelEnum.DeepseekChat,
Stream = true
};
resultMsg.Clear(); // 拼接完成则清空, 进行下一轮拼接
await ds.ChatStream(chatReq,
openedCallBack: (state) => // 打开状态
{
Console.WriteLine(state);
},
closedCallBack: (state) => // 关闭状态
{
Console.WriteLine(state);
},
msgCallback: (res) => // 接收信息
{
string msg = res.Choices.FirstOrDefault()?.Delta?.Content;
resultMsg.Append(msg);
Console.WriteLine(msg);
},
errorCallback: (ex) => // 异常处理
{
Console.WriteLine(ex.Message);
});
await Task.CompletedTask;
}).GetAwaiter().GetResult();
}
private static StringBuilder resultMsg = new StringBuilder();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- LaunchDarkly.EventSource (>= 5.2.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
首版发布