Documentation
¶
Overview ¶
Package model composes a typed coding configuration and credential store into an existing provider-neutral language model.
Index ¶
Constants ¶
const RetryBudget = 10
RetryBudget is the retry budget for one model request in a Coding run: ten replays of a failure that produced nothing, the bound current agent frontends converge on. The backoff doubles from 500ms with full jitter, capped at 30s, and a provider Retry-After wins when it is longer.
Coding also hands this value to the Agent loop's stream recovery as its replay allowance, so a stream that failed after producing only reasoning — nothing a consumer has to retract — earns the same budget as a request that produced nothing at all. One value keeps the two owners from drifting apart.
const RetryWindowFloor = 10 * time.Minute
RetryWindowFloor is the shortest wall clock one model request may spend replaying, whatever the transport's idle bound is. The window bounds a whole replay episode rather than one attempt, so a short idle bound must not shrink it to where a brief outage exhausts it.
Variables ¶
var ErrInvalid = errors.New("coding model: invalid configuration")
ErrInvalid means the resolved model or credential store is invalid.
Functions ¶
func New ¶
func New( ctx context.Context, resolved modelcatalog.ResolvedModel, store credential.Store, ) (ai.LanguageModel, error)
New constructs a native or compatible provider adapter from one complete immutable resolved snapshot.
func RetryWindowFor ¶ added in v0.1.8
RetryWindowFor returns the wall clock one model request may spend replaying a failure that produced nothing, for a transport whose streaming idle bound is streamIdleTimeout: max(RetryWindowFloor, 2×idle). Zero selects ai.DefaultStreamIdleTimeout, the bound an unconfigured adapter applies, so an unset idle keeps the twenty-minute window Coding has always shipped.
The window bounds the scheduling of attempts, never one already in flight: a provider that has gone silent can spend a whole idle window on the attempt that is running, so the worst case is the window plus that attempt. It is also what the Agent loop's recovery episode is bounded by, through agent.WithStreamRecoveryWindow — one value feeds both owners.
Types ¶
This section is empty.