Documentation
Table of Contents

Namespace IntentSharp.Extensions.AI

Classes

ChatClientBuilderExtensions

Puts a Microsoft.Extensions.AI Microsoft.Extensions.AI.IChatClient behind an IntentClient.

var client = new IntentClientBuilder()
    .UseChatClient(azureOpenAIChatClient, name: "AzureOpenAI")
    .UseChatClientAsFallback(ollamaChatClient, name: "Ollama")
    .Build();
ChatClientProvider

Runs IntentSharp on any Microsoft.Extensions.AI Microsoft.Extensions.AI.IChatClient: Azure OpenAI, OpenAI, Ollama, the Agent Framework and every other backend that implements the abstraction. The chat client only carries each request and its reply; the checks on the result, further attempts, the judge and memory work as they do with the built-in providers.

var client = new IntentClientBuilder()
    .UseChatClient(chatClient)
    .Build();
IntentToolExtensions

Exposes catalog intents as Microsoft.Extensions.AI Microsoft.Extensions.AI.AIFunction tools, so an Agent Framework agent (or any chat client with function invocation) can call verified, versioned behaviour by name:

var tools = runtime.AsAIFunctions();                       // every enabled intent of an IntentRuntime
var options = new ChatOptions { Tools = [.. tools] };

Each tool takes one input argument (text; a JSON object or text for intents with a compiled .NET result type), runs the intent, and returns JSON: {"success": true, "intent": ..., "value": ...} for a verified result or {"success": false, "intent": ..., "error": ...} otherwise. A tool never throws into the agent loop; only a cancellation the caller asked for propagates.

Interfaces

IIntentInvoker

What an agent tool needs from an intent runner: run a named intent and return its verified result as JSON, describe a definition, and list the enabled ones. IntentRuntime from IntentSharp.Catalog is the standard runner; implement this interface to expose another catalog runner as tools through IntentToolExtensions.