Class SpecialistRouter
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
A provider that passes each call to the specialist provider a SpecialistRuntime received in an offer
(an offer with Provider set). Add it to the client with
AddProvider(IAIProvider) (under dependency injection, services.AddNamedProvider, or
AddRouter), so the client reaches it by name only and it never becomes the
primary provider or part of a chain, and pass the same instance to the runtime. The runtime points each running
definition at it and tags the definition with a route, which arrives in Tags; a call without
a known route fails without reaching any model.
public sealed class SpecialistRouter : IAIProvider
- Inheritance
-
objectSpecialistRouter
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Remarks
The router itself sends nothing, so RequestHost is null. For each call the client asks
GetRequestHost(AIRequest), which answers with the host of the specialist provider the call is routed to, so a
Request checkpoint rule on request.host allows or refuses a routed call by the host it actually reaches. A call
with no known route, or routed to a provider that reports no host, has an unknown host.
Constructors
- SpecialistRouter(string?)
Creates a router.
Fields
- DefaultName
The router's name unless another is given.
- RouteTag
The request tag that carries a running definition's route.
Properties
- Name
Stable provider name used in results, rate limiting, logs, the roles of the provider options and Provider (for example "OpenAI"). Names are compared ignoring case.
- RequestHost
Null: the router sends nothing itself. See GetRequestHost(AIRequest) for the host of a routed call.
- RouteCount
The number of specialist providers the router can reach now.
Methods
- CompleteAsync(AIRequest, CancellationToken)
Passes the request to the specialist provider its RouteTag names and returns that provider's reply.
- GetRequestHost(AIRequest)
The host of the specialist provider
requestis routed to by its RouteTag, as that provider reports it for the request (GetRequestHost(AIRequest)); null when the request carries no route, its route is no longer in use, or that provider reports no host.