NousToolCalling 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NousToolCalling --version 0.1.0
                    
NuGet\Install-Package NousToolCalling -Version 0.1.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="NousToolCalling" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NousToolCalling" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="NousToolCalling" />
                    
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 NousToolCalling --version 0.1.0
                    
#r "nuget: NousToolCalling, 0.1.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.
#:package NousToolCalling@0.1.0
                    
#: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=NousToolCalling&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=NousToolCalling&version=0.1.0
                    
Install as a Cake Tool

NousToolCalling

Make on-prem / OpenAI-compatible LLMs that emit tool calls as XML text work with Microsoft.Extensions.AI and Microsoft Agent Framework tools.

Many self-hosted models (Qwen, Hermes, DeepSeek, …) served via vLLM, llama.cpp, Ollama or a corporate gateway don't fill the OpenAI tool_calls field. They reply with plain text like:

<tool_call>{"name": "get_weather", "arguments": {"city": "Istanbul"}}</tool_call>

FunctionInvokingChatClient never sees that, so your tools never run. NousToolCallingChatClient is a DelegatingChatClient that:

  • injects your ChatOptions.Tools into the system prompt as <tools> JSON schemas,
  • parses <tool_call> blocks (streaming and non-streaming) into FunctionCallContent,
  • sends tool results back as <tool_response> messages,
  • handles <think> reasoning blocks safely.

Usage

using Microsoft.Extensions.AI;

IChatClient client = new OpenAI.Chat.ChatClient(
        model: "qwen3-32b",
        credential: new System.ClientModel.ApiKeyCredential("not-needed"),
        options: new OpenAI.OpenAIClientOptions { Endpoint = new Uri("http://localhost:8080/v1") })
    .AsIChatClient()
    .AsBuilder()
    .UseFunctionInvocation()   // must come first (outermost)
    .UseNousToolCalling()
    .Build();

var response = await client.GetResponseAsync(
    "What's the weather in Istanbul?",
    new ChatOptions { Tools = [AIFunctionFactory.Create((string city) => $"Sunny, 22C in {city}", "get_weather")] });

client can also be wrapped in a ChatClientAgent (client.AsAIAgent(...)), so agents, RAG and MCP tools work unchanged.

Options

Option Default Description
StrictThinkMode true Don't parse tool calls while a <think> block is still open
PreserveThinkBlocks false Store <think> content in AdditionalProperties["nous_think"]
ToolCallIdPrefix "nous" Prefix for generated call IDs (unique per response)

Docs, samples and source: https://github.com/Murat7Ay/nous-tool-calling

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.  net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on NousToolCalling:

Package Downloads
NousToolCalling.AgentFramework

Composition helpers for Nous-style tool calling with Microsoft Agent Framework: a one-call ChatClientAgent pipeline for on-prem OpenAI-compatible models and an MCP tool host that exposes server tools as AIFunctions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 295 10/6/2026
0.1.0 153 10/4/2026