Skip to content

DelegatingModel

Namespace: E2E.OAuth

public abstract class DelegatingModel : IAgentModel, IDisposable

A 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

View source

protected DelegatingModel(string name, HttpClient http)

Parameters

Name Type Description
name string
http HttpClient

View source

protected abstract IAgentModel Fallback { get; }

The model to use until a lookup succeeds.

Value: IAgentModel

View source

protected HttpClient Http { get; }

Value: HttpClient

View source

public string Name { get; }

Provider and model id, printed in the run summary. Changing it does not miss the replay cache.

Value: string

View source

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>

View source

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View source

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

View source

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>

View source