Ivilson.AI.VllmChatClient 1.2.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ivilson.AI.VllmChatClient --version 1.2.5
                    
NuGet\Install-Package Ivilson.AI.VllmChatClient -Version 1.2.5
                    
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="Ivilson.AI.VllmChatClient" Version="1.2.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ivilson.AI.VllmChatClient" Version="1.2.5" />
                    
Directory.Packages.props
<PackageReference Include="Ivilson.AI.VllmChatClient" />
                    
Project file
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 Ivilson.AI.VllmChatClient --version 1.2.5
                    
#r "nuget: Ivilson.AI.VllmChatClient, 1.2.5"
                    
#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.
#:package Ivilson.AI.VllmChatClient@1.2.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ivilson.AI.VllmChatClient&version=1.2.5
                    
Install as a Cake Addin
#tool nuget:?package=Ivilson.AI.VllmChatClient&version=1.2.5
                    
Install as a Cake Tool

It can work for qwen3, qwq32b, gemma3, glm4, glm z1, deepseek-r1 on vllm==v0.8.5.支持多工具并行调用.

VllmQwen3ChatClient

VllmQwqChatClient

VllmGemmaChatClient

VllmGlm4ChatClient

VllmGlmZ1ChatClient

VllmDeepseekR1ChatClient

support stream function call .

https://github.com/iwaitu/Microsoft.Extensions.AI.VllmChatClient

vllm deployment:

docker run -it --gpus all -p 8000:8000 \
  -v /models/Qwen3-32B-FP8:/models/Qwen3-32B-FP8 \
  --restart always \
  vllm/llm-openai:v0.8.5 \
  --model /models/Qwen3-32B-FP8 \
  --enable-auto-tool-choice \
  --tool-call-parser llama3_json \
  --trust-remote-code \
  --max-model-len 131072 \
  --tensor-parallel-size 2 \
  --gpu_memory_utilization 0.8 \
  --served-model-name "qwen3" 
using Microsoft.Extensions.AI

string apiurl = "http://localhost:8000/{0}/{1}";

[Description("Gets the weather")]
static string GetWeather() => Random.Shared.NextDouble() > 0.5 ? "It's sunny" : "It's raining";

IChatClient vllmclient = new VllmQwen3ChatClient(apiurl,null, "qwen3");
ChatOptions chatOptions = new()
{
    Tools = [AIFunctionFactory.Create(GetWeather)],
    NoThinking = false    //this is for qwen3 only. when you turn off think mode, set NoThinking = true, qwen3 will can not call the tool or function.
};
var messages = new List<ChatMessage>
{
    new ChatMessage(ChatRole.System ,"你是一个智能助手,名字叫菲菲"),
    new ChatMessage(ChatRole.User,"今天天气如何?")
};

private async Task<(string answer, string reasoning)> StreamChatResponseAsync(List<ChatMessage> messages, ChatOptions chatOptions)
{
    string answer = string.Empty;
    string reasoning = string.Empty;
    await foreach (var update in _chatClient.GetStreamingResponseAsync(messages, chatOptions))
    {
        var updateText = update.ToString();
        if (update is ReasoningChatResponseUpdate reasoningUpdate)
        {
            if (!reasoningUpdate.Thinking)
            {
                answer += updateText;
            }
            else
            {
                reasoning += updateText;
            }
        }
        else
        {
            answer += updateText;
        }
    }
    return (answer, reasoning);
}

var (answer, reasoning) = await StreamChatResponseAsync(messages, chatOptions);
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 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.4.2 185 6/23/2025
1.4.0 134 6/23/2025
1.3.8 135 6/21/2025
1.3.6 70 6/21/2025
1.3.5 87 6/20/2025
1.3.2 62 6/20/2025
1.3.1 62 6/20/2025
1.3.0 343 6/3/2025
1.2.8 123 6/3/2025
1.2.7 80 5/31/2025
1.2.6 56 5/31/2025
1.2.5 50 5/31/2025
1.2.3 57 5/30/2025
1.2.2 116 5/24/2025
1.2.0 293 5/13/2025
1.1.8 224 5/13/2025
1.1.6 173 5/12/2025
1.1.5 102 5/2/2025
1.1.4 116 4/29/2025
1.1.3 107 4/29/2025
1.1.2 111 4/29/2025
1.1.1 112 4/29/2025
1.1.0 145 4/23/2025
1.0.8 143 4/23/2025
1.0.6 129 4/18/2025