Devlooped.Extensions.AI 0.5.1

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

Extensions for Microsoft.Extensions.AI

Grok

Full support for Grok Live Search and Reasoning model options.

// Sample X.AI client usage with .NET
var messages = new Chat()
{
    { "system", "You are a highly intelligent AI assistant." },
    { "user", "What is 101*3?" },
};

var grok = new GrokClient(Env.Get("XAI_API_KEY")!);

var options = new GrokChatOptions
{
    ModelId = "grok-3-mini", // or "grok-3-mini-fast"
    Temperature = 0.7f,
    ReasoningEffort = ReasoningEffort.High, // or ReasoningEffort.Low
    Search = GrokSearch.Auto, // or GrokSearch.On or GrokSearch.Off
};

var response = await grok.GetResponseAsync(messages, options);

Search can alternatively be configured using a regular ChatOptions and adding the HostedWebSearchTool to the tools collection, which sets the live search mode to auto like above:

var messages = new Chat()
{
    { "system", "You are an AI assistant that knows how to search the web." },
    { "user", "What's Tesla stock worth today? Search X and the news for latest info." },
};

var grok = new GrokClient(Env.Get("XAI_API_KEY")!);

var options = new ChatOptions
{
    ModelId = "grok-3",
    Tools = [new HostedWebSearchTool()]
};

var response = await grok.GetResponseAsync(messages, options);

Console Logging

Additional UseJsonConsoleLogging extension for rich JSON-formatted console logging of AI requests are provided at two levels:

  • Chat pipeline: similar to UseLogging.
  • HTTP pipeline: lowest possible layer before the request is sent to the AI service, can capture all requests and responses. Can also be used with other Azure SDK-based clients that leverage ClientPipelineOptions.

Rich JSON formatting is provided by Spectre.Console

The HTTP pipeline logging can be enabled by calling UseJsonConsoleLogging on the client options passed to the client constructor:

var openai = new OpenAIClient(
    Env.Get("OPENAI_API_KEY")!,
    new OpenAIClientOptions().UseJsonConsoleLogging());

For a Grok client with search-enabled, a request would look like the following:

alternate text is missing from this package README image

Both alternatives receive an optional JsonConsoleOptions instance to configure the output, including truncating or wrapping long messages, setting panel style, and more.

The chat pipeline logging is added similar to other pipeline extensions:

IChatClient client = new GrokClient(Env.Get("XAI_API_KEY")!)
    .AsBuilder()
    .UseOpenTelemetry()
    // other extensions...
    .UseJsonConsoleLogging(new JsonConsoleOptions()
    {
        // Formatting options...
        Border = BoxBorder.None,
        WrapLength = 80,
    })
    .Build();

Sponsors

Clarius Org MFB Technologies, Inc. Torutek DRIVE.NET, Inc. Keith Pickford Thomas Bolon Kori Francis Toni Wenzel Uno Platform Reuben Swartz Jacob Foshee alternate text is missing from this package README image Eric Johnson David JENNI Jonathan Charley Wu Ken Bonny Simon Cropp agileworks-eu sorahex Zheyu Shen Vezel ChilliCream 4OTC Vincent Limo Jordan S. Jones domischell Justin Wendlandt Adrian Alonso Michael Hagedorn

Sponsor this project  

Learn more about GitHub Sponsors

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 (1)

Showing the top 1 NuGet packages that depend on Devlooped.Extensions.AI:

Package Downloads
Smith

Run AI-powered C# files using Microsoft.Extensions.AI and Devlooped.Extensions.AI

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.2 164 7/4/2025
0.6.1 102 7/4/2025
0.6.0 171 7/2/2025
0.5.2 108 7/2/2025
0.5.1 100 7/1/2025
0.5.0 120 7/1/2025