Documentation
Table of Contents

Installation

IntentSharp comes as three NuGet packages. Every project that uses IntentSharp adds IntentSharp; add IntentSharp.Catalog for intents kept in files, and IntentSharp.Extensions.AI for IChatClient and agent tools (the three packages). Your project can target .NET 8, 9 or 10 (system requirements).

Note

Subject to change. IntentSharp 1.0.0-rc.2 is not on nuget.org yet. Until it is, we send the three package files (IntentSharp.1.0.0-rc.2.nupkg, IntentSharp.Catalog.1.0.0-rc.2.nupkg and IntentSharp.Extensions.AI.1.0.0-rc.2.nupkg) by email to evaluators and licensees. If you have a key and no package files, write to licensing@c2consultants.net, quoting your license id. Then follow Install from the package files below.

Install from the package files

The package files go into a folder that NuGet reads as a package source. Do this once per solution.

  1. Put the three .nupkg files in a folder named intentsharp-packages, beside your solution or project file.

  2. In the folder of the solution or project, create a file named nuget.config with this content:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <clear />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <add key="IntentSharp" value="./intentsharp-packages" />
      </packageSources>
      <!-- IntentSharp from the folder; everything else from nuget.org. -->
      <packageSourceMapping>
        <packageSource key="IntentSharp">
          <package pattern="IntentSharp" />
          <package pattern="IntentSharp.*" />
        </packageSource>
        <packageSource key="nuget.org">
          <package pattern="*" />
        </packageSource>
      </packageSourceMapping>
    </configuration>
    

    It lists the folder and nuget.org, which NuGet still needs: the packages that IntentSharp depends on come from there. The packageSourceMapping section takes the IntentSharp packages from the folder only, so a package with the same name on nuget.org is never used in their place. <clear /> drops the package sources set elsewhere on the machine. If your project uses other sources, or the folder already has a nuget.config, add the IntentSharp source and its mapping to that file, and map the packages of each other source too.

  3. Add the packages as in the next section.

Everyone who builds the project needs the same nuget.config and the folder, a build server included. Keep both beside the project, or point the source at a folder your builds can read.

Add the packages

From the folder of your project:

dotnet add package IntentSharp --prerelease
dotnet add package IntentSharp.Catalog --prerelease
dotnet add package IntentSharp.Extensions.AI --prerelease

Add only the packages you use. --prerelease is needed because 1.0.0-rc.2 is a release candidate. In Visual Studio, use Manage NuGet Packages, choose the source, and tick Include prerelease.

The package references

The commands add one PackageReference per package to your project file:

<ItemGroup>
  <PackageReference Include="IntentSharp" Version="1.0.0-rc.2" />
  <PackageReference Include="IntentSharp.Catalog" Version="1.0.0-rc.2" />
  <PackageReference Include="IntentSharp.Extensions.AI" Version="1.0.0-rc.2" />
</ItemGroup>

The three packages are released together under one version number. Keep all three at the same version, and name the version exactly rather than with a wildcard such as 1.*. Upgrading says what to check before you change it.

Your model provider's API key

IntentSharp calls the model with your own provider account. Put the provider's API key where your application reads it:

  • In environment variables. ANTHROPIC_API_KEY and OPENAI_API_KEY are read by UseProvidersFromEnvironment on the builder, and by AddIntentSharp when the configuration has no key. In bash:

    export ANTHROPIC_API_KEY="..."
    

    In PowerShell:

    $env:ANTHROPIC_API_KEY = "..."
    
  • In the application's configuration, when you register IntentSharp with AddIntentSharp(configuration): the values IntentSharp:AnthropicApiKey and IntentSharp:OpenAIApiKey. In an ASP.NET Core or generic host application, which reads user secrets in the Development environment, keep them there during development:

    dotnet user-secrets init
    dotnet user-secrets set "IntentSharp:AnthropicApiKey" "..."
    

    In production, set them as the environment variables IntentSharp__AnthropicApiKey and IntentSharp__OpenAIApiKey, or from your secret store.

  • In code, as the argument of UseAnthropic, UseOpenAI and the other provider methods of the builder.

Keep API keys out of source control. Configuration and dependency injection lists every setting, and Providers covers choosing the primary provider and a fallback.

Your license key

Evaluation is free for 30 days: ask for an evaluation key, which arrives by email. Your license key shows where the key goes.

Next

The quick start builds one console program with the packages.