Documentation
Table of Contents

Class ServiceCollectionExtensions

Namespace
IntentSharp.DependencyInjection
Assembly
IntentSharp.dll

Registers IntentSharp with a service collection.

public static class ServiceCollectionExtensions
Inheritance
object
ServiceCollectionExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

Fields

AnthropicHttpClientName

The name of the HttpClient the Anthropic provider uses. Configure it through IHttpClientFactory.

OpenAIHttpClientName

The name of the HttpClient the OpenAI provider uses. Configure it through IHttpClientFactory.

Methods

AddIntentSharp(IServiceCollection, IConfiguration, string)

Registers a singleton IntentClient configured from the "IntentSharp" configuration section, and builds it when the application starts. Under a .NET host (ASP.NET Core, a worker service, the generic host) IHost.StartAsync runs the options startup validation (IStartupValidator) before it starts hosted services or serves a request; that validation builds the client, so the license key is checked then, exactly as Build() checks it. A LicenseException (a paid key whose maintenance ended before this release, or Options:FailWhenUnlicensed) and any other configuration error stop the host, unwrapped, and the build-time license notice is logged at startup. Without a host, call GetRequiredService<IStartupValidator>().Validate() (or resolve the client) during startup for the same behaviour. The license is checked before memory, cache or rate limiter are created.

AddIntentSharp(IServiceCollection, Action<IntentSharpSettings>)

Registers a singleton IntentClient configured in code. Startup and license behaviour are the same as the configuration overload.