Interface: CompletionGateway
Defined in: packages/agentos/src/api/runtime/completionGateway.ts:199
Methods
resolve()
resolve(
route,after?,failure?):Promise<CompletionResolution|null>
Defined in: packages/agentos/src/api/runtime/completionGateway.ts:208
The route's first hop that can start, or, given the hop that failed, the
next one. failure is the error that hop failed with: the walk reads it
as generateText's and streamText's walks do (a refusal passes over the
policy chain's Claude legs; a standing uncensored leg that failed on
availability is owed the next ranked model). Without it the hop counts
as an availability failure.
Parameters
route
after?
failure?
unknown
Returns
Promise<CompletionResolution | null>
schemaInstruction()?
optionalschemaInstruction(resolution,responseSchema,schemaName?):string|undefined
Defined in: packages/agentos/src/api/runtime/completionGateway.ts:236
The schema instructions, in generateObject's words, that a hop's system
prompt needs for responseSchema: the text when the hop's provider payload
carries no schema (no payload for the provider or model, or a JSON mode
without one), undefined when the payload carries it. A caller that puts
the text in its prompt itself passes schemaInPrompt to stream().
Parameters
resolution
responseSchema
schemaName?
string
Returns
string | undefined
stream()
stream(
resolution,messages,options,responseSchema?,schemaName?,schemaInPrompt?,onLateUsage?):CompletionAttempt
Defined in: packages/agentos/src/api/runtime/completionGateway.ts:209
Parameters
resolution
messages
ChatMessage[]
options
ModelCompletionOptions
responseSchema?
ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
schemaName?
string
schemaInPrompt?
boolean
True when messages already carry the schema's instructions (a structured
reply puts its own in the system prompt): a hop whose payload carries no
schema then gets no second copy.
onLateUsage?
(report) => void
Receives the usage the provider reports for this attempt after the caller's signal ended it (LateAttemptUsage), once the stream left running has ended. Without a listener, or when it throws, that usage is logged at warn level with its token counts.