DelegatingModel
Namespace: E2E.OAuth
public abstract class DelegatingModel : IAgentModel, IDisposableA model that settles its protocol on the first call and delegates to the client for it. One lookup serves every concurrent call, under its own timeout, so a caller that gives up never fails the others. Only a lookup that succeeded is remembered: when it could not be read, that call goes over the fallback and the next call asks again.
Inheritance: object
Implements: IAgentModel, IDisposable
Derived: CopilotModel, OpenCodeConsoleModel
Constructors
Section titled “Constructors”DelegatingModel(string, HttpClient)
Section titled “DelegatingModel(string, HttpClient)”protected DelegatingModel(string name, HttpClient http)Parameters
| Name | Type | Description |
|---|---|---|
name |
string | |
http |
HttpClient |
Properties
Section titled “Properties”Fallback
Section titled “Fallback”protected abstract IAgentModel Fallback { get; }The model to use until a lookup succeeds.
Value: IAgentModel
protected HttpClient Http { get; }Value: HttpClient
public string Name { get; }Provider and model id, printed in the run summary. Changing it does not miss the replay cache.
Value: string
Methods
Section titled “Methods”CompleteAsync(ModelRequest, CancellationToken)
Section titled “CompleteAsync(ModelRequest, CancellationToken)”public Task<ModelResponse> CompleteAsync(ModelRequest request, CancellationToken cancellationToken)Parameters
| Name | Type | Description |
|---|---|---|
request |
ModelRequest | |
cancellationToken |
CancellationToken |
Returns: Task<ModelResponse>
Dispose()
Section titled “Dispose()”public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Refusal(AgentException)
Section titled “Refusal(AgentException)”protected virtual string? Refusal(AgentException failure)Why the account cannot use the model, when <code class=“paramref”>failure</code> is the provider refusing it; null for any other failure.
Parameters
| Name | Type | Description |
|---|---|---|
failure |
AgentException |
Returns: string
ResolveAsync(CancellationToken)
Section titled “ResolveAsync(CancellationToken)”protected abstract Task<IAgentModel?> ResolveAsync(CancellationToken cancellationToken)The model for the looked-up protocol, or null when the lookup could not be read.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: Task<IAgentModel>