Interface ISpecialistService
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
A specialist service: a provider of models for single intents, which hands back a model for an intent on request. Implement it as an adapter over the service you use; the library assumes no wire format. A SpecialistRuntime calls RequestAsync(SpecialistRequest, CancellationToken) once per request, then WaitAsync(SpecialistTicket, TimeSpan, CancellationToken) until an offer arrives or its waits run out, then ReportFitAsync(SpecialistTicket, FitReport, CancellationToken) with the verdict on the offer, and RetireAsync(SpecialistTicket, CancellationToken) when the application no longer needs the specialist.
public interface ISpecialistService
- Extension Methods
Properties
- Name
The service's name, recorded on every ticket it issues.
Methods
- RecallAsync(HeldSpecialist, CancellationToken)
Hands back the offer of a specialist the runtime held (HeldSpecialist) whose offer brought a provider of its own, so it can be put in use again without a new request or a wait, for example after a restart; or null when the service cannot recall it. The runtime calls it only when UseHeld allows it, and on null, or an exception, waits on the recorded ticket as it would without the record. The default answers null. An offer that names a configured provider is put in use from the record and never comes here.
- ReportFitAsync(SpecialistTicket, FitReport, CancellationToken)
Tells the service whether its offer met the requirement, and why not when it did not.
- RequestAsync(SpecialistRequest, CancellationToken)
Sends a request and returns the ticket for it. It does not wait for the specialist.
- RetireAsync(SpecialistTicket, CancellationToken)
Tells the service the application no longer uses the specialist of
ticket.
- WaitAsync(SpecialistTicket, TimeSpan, CancellationToken)
Waits up to
timeoutfor the specialist ofticket. Returns the offer once it is ready, or null when it is not ready yet. Either hold the call until the offer is ready or the timeout ends, or answer null at once: within its wait, the runtime asks again after WaitPollInterval with the time left. Never wait past the timeout: the runtime ends the call there and counts it as not ready.