Repository navigation
Releases
Releases · AlexNek/AIProviderConnect
v1.3.2
Fixed
- OpenAI-compatible chat requests no longer send an unset
max_tokens,response_format, ortoolsasnull; the keys are now omitted. Hosts that dereference a presentresponse_format(LM Studio) refused every chat, streaming, and read-out decision request with HTTP 400Cannot read properties of null (reading 'type'). Set values are sent unchanged
Full Changelog: v1.3.1...v1.3.2
v1.3.1
Fixed
- An HTTP error whose body is a flat
{ "error": "text" }value or a bare JSON string no longer crashes withInvalidOperationExceptionwhile the failure report is built; it now surfaces as the usualAiExceptionwith its status classification, and the provider's text is appended to the message. Any other body that is not an object, or whoseerroris neither an object nor a string, yields the plain status line. Bodies that were reported correctly before are unchanged
Full Changelog: v1.3.0...v1.3.1
v1.3.0
Added
- Decisions are now a capability of every provider, not a separate provider family: any chat-capable provider that declares no native decisions surface answers
IDecisionProvider.DecideAsyncthrough a read-out over its own chat surface — one chat turn per question, the option tokens' logprobs read from the response, with distinct token variants of one option combined and a repeated token counted once, then renormalised with softmax.IDecisionProvider.DecisionSourceand the newEDecisionSourceenum report the mechanism (ReadoutorNative), and the model-override decorators forward it, sois IDecisionProviderandDecisionSourcestay accurate after decoration; decorator selection also keepsis IEmbeddingProviderhonest in both directions — an embedding-capable provider keeps that capability after decoration, and a provider without an embeddings surface is never wrapped in a decorator that claims one ChatCompletionRequest.Logprobs/TopLogprobsandChatCompletionResponse.Logprobsexpose token log probabilities, with the newChatContentLogprobs,ChatTokenLogprob, andChatTopLogprobmodels. Mapped on theOpenAICompatible/HybridGatewayandKeyQuerywires; a protocol whose API carries no logprob field leaves the block null rather than inventing a distribution- Read-out configuration on
AIProviderOptions:DecisionReadoutEnabled(defaulttrue;falserestores theai/decision-not-supportedrefusal),DecisionReadoutPromptTemplate(placeholders{state},{instructions},{options}),DecisionReadoutOptionTokenStyle(uppercaseLetter,lowercaseLetter,levelIndex),DecisionReadoutTopLogprobs(default 20, also the read-out's option ceiling),DecisionReadoutBoolTokens(defaultyes,no),DecisionReadoutTemperature(default 0), andDecisionsMaxOptions(a declared Choice-option ceiling for both transports). Each is also seedable from a definition'sprotocolConfiguration, and both ceilings refuse withai/configuration-errorbefore any request leaves the process - Two error codes for a read-out that cannot produce a distribution:
ai/decision-readout-unavailable(the chat response carried no logprobs block) andai/decision-readout-unreadable(none of the declared option tokens appeared among the reported alternatives) EProviderProtocol.DecisionReadout(JSON"decisionReadout") as anendpoints["decisions"]override that explicitly declares the read-out on a chat-capable root; aDecisionReadoutentry on a root with no chat surface is rejected at registrationAIProviderServiceCollectionExtensions.SeedFromDefinition(AIProviderOptions, ProviderDefinition)is now public, so a provider registered throughAddProvider<TProvider>gets the same definition seeding as a built-in protocol — base URL, endpoint paths,requiresApiKey, the read-out members, andprotocolConfiguration. ANative-id provider is skipped by the automatic registration loop, so its own factory is the only place the definition can be applied
Changed
- Decision support is a default capability of
AIProviderBase:SupportsDecisionsandDecideAsyncare virtual members whose default body is the chat read-out, whileDecisionProviderandOpenAICompatibleDecisionProvideroverride them and reportEDecisionSource.Native. A consumer that readis IDecisionProvideras "this is a decision model" now getstruefor every chat-capable provider — checkDecisionSourceorSupportsDecisionsinstead. Only aDecision-rooted provider still refusesChatAsyncwithai/chat-not-supported, and a chat-capable provider no longer refuses decisions for lack of adecisionsdeclaration - A loopback base URL may now use plain
http: request pre-flight andendpointsvalidation accepthttp://localhost,http://127.0.0.1, andhttp://[::1], while routable hosts still require HTTPS - API-key requirements resolve in three layers:
AIProviderOptions.RequiresApiKey, thenProviderDefinition.RequiresApiKey(new JSON fieldrequiresApiKey), then a value derived from the configured address — a loopback host requires none.IAIProvider.RequiresApiKeyexposes the effective value without a cast, and the per-call check re-derives it from an overridden address
Full Changelog: v1.2.0...v1.3.0
v1.2.0
Added
AIModel.Capabilitiesis nowEModelCapability?(nullable). Three states:nullmeans the provider did not report capabilities (unknown);EModelCapability.Nonemeans the provider reported having none; any other value means the provider reported exactly those flags. A newProtocolParsingHelpers.ParseCapabilitieshelper reads capabilities from a model JSON element using a configurable dotted path and format (arrayorflags-string)- Optional decision-model capability via
IDecisionProvider(SupportsDecisions,DecideAsync): a provider answers typed questions about application state with probabilities rather than chat prose. SupportsChoice,Noul(yes/no), andScorequestion kinds with typed answers (ChoiceAnswer,NoulAnswer,ScoreAnswer), a newEProviderProtocol.Decisionwire protocol (JSON value"decision"), anEModelCapability.Decisionflag for call-free discovery,DecisionProviderOptions(configurablealpha/decisionsendpoint and optional decisions base-URL override), and dedicated error codes (ai/chat-not-supported,ai/decision-not-supported). A decision provider rejectsChatAsync; per-request credentials, retry, and error classification behave as they do for chat UsageInfo.Cost(USD, nullable) reports a per-call cost when the provider returns one; existing protocols leave it unset- Optional
AdditionalQueryParameteronEndpointDefinition: an opaque query parameter (e.g.output_modalities=all) that a provider's models-endpoint entry can declare so model discovery returns the provider's full catalog instead of a default-filtered subset. The seeding step appends?{value}to the models-endpoint path; providers that declare nothing keep byte-identical URLs. Validation rejects values starting with?or containing an unencoded#or space - Optional per-operation
endpointsblock onProviderDefinitionfor multi-protocol providers: each entry (keyschat,models,messages,embeddings,decisions, matched case-insensitively) carries a relativepath, an optionalbaseUrloverride used only when the surface sits on a different root than the definition's common base, and an optionalprotocoloverride with nullable-aware JSON conversion. Endpoint paths, andbaseUrloverrides fordecisionsandembeddings, fold into the named options at registration time with a documented precedence (defaults, flat field,endpointsentry, consumerConfigure), and malformed entries (unknown operation key, absolute path, non-HTTPS override, an entry that changes nothing, an unservabledecisionsoverride, or a KeyQuerychatpath without a{model}placeholder) fail registration fast. AnOpenAICompatible/HybridGatewayprovider declaring adecisionsentry withprotocol: "decision"registers the combinedOpenAICompatibleDecisionProvider— one provider id serving chat, streaming, model discovery, embeddings, and decisions — and the model-override decorator chain stays capability-transparent for it
Fixed
AIModel.Capabilitiesis now nullable (EModelCapability?) so "not reported" (null) is distinguished from "reported as having none" (None). Previously every discovered model carriedNone, which the type could not distinguish from an explicit negative — a consumer checkingHasFlag(ToolCalling)sawfalsefor every model without knowing whether the provider had spoken. TheModelOverrideMergermerge rule (override ?? target) carries the three states through transparently. Documentation and IntelliSense now describe the three states explicitly- Documentation and IntelliSense no longer conflate capabilities with modalities:
EModelCapabilityis described as what a model may be asked to do, distinct fromAIModel.Modality(which data types flow in and out), with the rule that a modality never implies a capability. Both now state that model discovery reports no capability flags —Nonemeans nothing was said, not that the model cannot do it — and that consumers declare the flags they rely on throughModelOverride.Capabilities, replacing a publishedHasFlag(EModelCapability.ToolCalling)example that returnedfalsefor every discovered model without any warning.Decisionis now listed with the other capability members - A call whose effective base URL is not a valid absolute URL — a typo, or a per-request/options override that omits the scheme — now fails with
AiException(ai/invalid-request) before the request is sent instead of leaking a rawUriFormatExceptionfrom request construction, upholding the contract that every provider failure surfaces as anAiExceptionacross chat, model discovery, streaming, and embeddings; well-formed absolute URLs are unaffected - Model discovery now honors a provider's
capabilitiesPath/capabilitiesFormatprotocol configuration: the Catalog, KeyQuery, Messages API, and OpenAI-compatible discovery mappers read each model's reported capabilities intoAIModel.Capabilities— an explicitly empty reported array yieldsEModelCapability.None, while an unconfigured or absent path leaves itnull(unreported). Previously theProtocolParsingHelpers.ParseCapabilitieshelper existed but was never invoked by discovery, so models arrived withCapabilities = nullregardless of configuration
Full Changelog: v1.1.0...v1.2.0
v1.1.0
Added
- Optional embeddings capability via
IEmbeddingProviderwith OpenAI-compatible/embeddingswire mapping, separateDefaultEmbeddingModelconfiguration, and dedicated error codes (ai/embedding-failed,ai/embedding-model-not-configured) - Per-request (runtime) credential and model resolution: the
RequestCredentialsrecord (key-maskedToString) and theICredentialResolverhook let a consumer supply an API key, base URL, and model per call — across chat, streaming, model discovery, and embeddings — without rebuilding the DI graph or leaving the singleton provider behind. Resolution priority isGetProvideroverrides >ICredentialResolver> configured options IAIProviderFactory.GetProvider(providerId, RequestCredentials overrides)returns a transient provider bound to the supplied overrides; the shared singleton resolved byGetProvider(providerId)is never mutated. A provider id that has model-override entries is decorated, and the decorator exposes no embeddings through either overloadAddAiProviders(b => b.UseCredentialResolver(resolver))registers a consumer-suppliedICredentialResolver(the library ships no default implementation)
Changed
AIProviderOptions.DefaultModelis now applied at runtime as the fallback model when a request carries no model and no per-call override supplies one; it was previously inert. An empty effective chat model now throwsAiExceptionwithai/invalid-request- Provider configuration is validated against the effective values (per-call override combined with configured options) before the model is resolved, so a provider configured with an empty API key or base URL completes a call once an override supplies the missing value, still fails when nothing does, and keeps reporting the actionable configuration error when the request also carries no model
IAIProviderFactorygains theGetProvider(providerId, RequestCredentials)member — a breaking change for consumers who implementIAIProviderFactorythemselves, who must now also implement the new overload
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Added
- Unified
IAIProviderinterface (ChatAsync) with optional capabilities:IStreamingChatProvider(StreamAsync) andIModelDiscoveryProvider(GetModelsAsync) IAIProviderFactoryabstraction for multi-provider scenarios- 35+ provider definitions via embedded JSON catalog (
ProviderCatalog), served by four protocol implementations - OpenAI-compatible wire protocol (
OpenAICompatibleWireProtocol,OpenAICompatibleProvider) - Messages API wire protocol (
MessagesApiProtocol,MessagesApiProvider) - Key-query protocol for Google-style APIs (
KeyQueryProvider) - Model catalog protocol for GitHub Models-style APIs (
ModelCatalogProvider) - Hybrid gateway protocol (
OpenAICompatibleProviderwithHybridGatewayProviderOptions) - Streaming via
IAsyncEnumerable<StreamingChatChunk>with tool-call deltas (StreamingToolCallDelta) - Tool / function calling support
- Structured output via
ResponseFormatwith JSON schema - Structured error handling via
AiExceptionwith centralizedAiErrorCodes, including status-aware messages for common HTTP error codes - Single
AddAiProviders()DI extension registering every catalog provider with named options per provider ID - Named provider options bindable from
appsettings.jsonviaMicrosoft.Extensions.Options - Developer manual published as a documentation site via MkDocs Material and GitHub Pages