DeepSeek 1.0.1

dotnet add package DeepSeek --version 1.0.1                
NuGet\Install-Package DeepSeek -Version 1.0.1                
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" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DeepSeek --version 1.0.1                
#r "nuget: DeepSeek, 1.0.1"                
#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 DeepSeek as a Cake Addin
#addin nuget:?package=DeepSeek&version=1.0.1

// Install DeepSeek as a Cake Tool
#tool nuget:?package=DeepSeek&version=1.0.1                

DeepSeek

DeepSeek.NET ���� Api/Ollama

Nuget Downloads License Vistors

��װ

DeepSeek �� NuGet ������ʽ�ṩ��������ʹ�� NuGet ������̨���ڰ�װ����

PM> Install-Package DeepSeek

Api ʹ��ʾ��

Program.cs

var services = new ServiceCollection();

var configuration = new ConfigurationBuilder()
   .SetBasePath(AppContext.BaseDirectory)
   .AddJsonFile($"appsettings.json", true, true)
   .Build();

services.AddSingleton<IConfiguration>(configuration);
services.AddDeepSeekClient();

var provider = services.BuildServiceProvider();

var deepSeekService = provider.GetRequiredService<IDeepSeekService>();

while (true)
{
    Console.WriteLine();
    Console.Write("�����룺");

    var input = Console.ReadLine();

    if (string.IsNullOrEmpty(input))
    {
        continue;
    }

    Console.WriteLine();
    Console.Write("����˼�������Ժ�...");
    Console.WriteLine();
    Console.WriteLine();

    var request = new ApiChatRequest
    {
        Messages = [Message.NewUserMessage(input)],
        Model = Constants.Models.ChatModel,
    };

    var cancellationToken = new CancellationTokenSource();

    var choices = deepSeekService.ApiChatStreamAsync(request, cancellationToken.Token);

    await foreach (var choice in choices)
    {
        Console.Write(choice?.Delta?.Content);
    }

    if (deepSeekService.ErrorMessage is not null)
    {
        Console.WriteLine(deepSeekService.ErrorMessage);
        continue;
    }

    Console.WriteLine();

    var balance = await deepSeekService.ApiGetUserBalanceAsync(cancellationToken.Token);
    
    if (deepSeekService.ErrorMessage is not null)
    {
        Console.WriteLine(deepSeekService.ErrorMessage);
        continue;
    }

    Console.WriteLine();
    Console.WriteLine($"�˻���{balance?.BalanceInfos?.FirstOrDefault()?.TotalBalance}");
}

appsettings.json

{
  "DeepSeek": {
    "ApiKey": "sk-xxxxxxxxxxxxxxxx"
  }
}

Ollama ʹ��ʾ��

var services = new ServiceCollection();

services.AddDeepSeekClient();

var provider = services.BuildServiceProvider();

var deepSeekService = provider.GetRequiredService<IDeepSeekService>();

while (true)
{
    Console.WriteLine();
    Console.Write("�����룺");

    var input = Console.ReadLine();

    if (string.IsNullOrEmpty(input))
    {
        continue;
    }

    Console.WriteLine();
    Console.Write("����˼�������Ժ�...");
    Console.WriteLine();
    Console.WriteLine();

    var request = new OllamaChatRequest
    {
        ModelId = Constants.OllamaModels.DeepSeek_R1_7b,
        BaseUrl = "http://localhost:11434",
        PromptTemplate = input,
    };

    var cancellationToken = new CancellationTokenSource();

    var response = deepSeekService.OllamaChatStreamingAsync(request, cancellationToken.Token);

    await foreach (var result in response)
    {
        Console.Write(result);
    }

    if (deepSeekService.ErrorMessage is not null)
    {
        Console.WriteLine(deepSeekService.ErrorMessage);
        continue;
    }

    Console.WriteLine();
}

������־

CHANGELOG

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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. 
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.1 0 2/12/2025
1.0.0 0 2/12/2025