Models & interaction
Support · Recommended implementations & strategies · Back to layer index
| Symbol | Kind | Purpose |
|---|---|---|
chatCompletionFunctionOptions | function | Build the tool-selection request fields for a function-calling stage. The adapter expects exactly one function call per response, so tool use is required and parallel calls are disabled. |
chatCompletionMessages | function | Map Core and provider messages to chat-completions message payloads. Only declared message fields are sent. Assistant tool declarations become nested tool_calls, and tool results become tool_call_id; both are rewritten explicitly rather than forwarded as-is. Messages with images become a content-block array; images are accepted only on user messages and only as http(s) or data:image URLs. |
chatCompletionParts | function | Convert one streamed choice.delta into Core model parts. Text is emitted only when non-empty; each tool-call fragment carries its index so Core can reassemble arguments that arrive across chunks. |
CompatibleModelConfig | interface | Configuration of one OpenAI-compatible endpoint. |
CompatibleModelPorts | interface | Adapter ports the App may override without replacing the provider. |
CompatibleModelProvider | class | HTTP/SSE lifecycle shared by hosts. Apps supply config and user-visible error mapping only. A static configuration is validated and frozen in the constructor. A configuration function is called once per request instead, so credentials and models may rotate between calls. |
CompatibleModelProviderOptions | interface | Construction options for a compatible provider. |
CompletionFailure | type | Build the classified failure a policy throws; the provider records it like its own failures. |
CompletionPolicy | interface | Decision whether a finished stream satisfies the request. |
completionPolicyCatalog | constant | |
CompletionRequestFacts | interface | Facts the provider reads from the request it actually sends. functions reports the Core call options and keeps the default policy equivalent to the behavior that existed before policies were configurable. toolChoice is the effective field of the serialized body, so a host override, or a field dropped for being undefined, is visible exactly as the upstream receives it. |
CompletionSession | interface | Per-request completion state observed by one policy. |
createJsonTransport | function | Create a typed JSON transport without a capability-selection envelope. The transport embeds the JSON Schema in the instruction and requires the response to be one complete JSON value. The returned response parser rejects native call events and invalid JSON, then validates the value through the supplied schema. |
createModelStrategy | function | Compose runner options in precedence order: budget preset, selected model, declared reasoning, exact budget, then explicit Core fields. The result is validated through the same Core binding rules but creates no runner and spends no calls. |
createProviderObservationScope | function | Bind provider observations to a caller-owned destination across diagnostic child spans. attach returns a scoped diagnostic context; contexts that were not attached through this scope produce no observations. Child contexts inherit the owner and a parent/child span path. |
createReplyPreview | function | Create a model-output event handler that publishes preview bubbles. The handler resets on model.start, ignores other invocations, disables itself on unexpected output, and clears the preview when a call ends unsuccessfully. Rules are snapshotted at creation, and only explicitly registered prose fields are projected. |
createReplyPreviewRules | function | Generate frozen preview rules from capability and stage declarations. Capabilities without preview metadata are skipped even when their stage opts in. Default paths are text and bubbles[*], each kept only when the capability schema declares it. |
createSessionModelTransport | function | Create a session transport. |
createStageModelTransport | function | Build a transport that projects a capability source through declared stage references. |
createTextTransport | function | Create a plain-text transport that trims the assembled response. |
defaultCompletionPolicy | constant | |
defineModelTools | function | Build a sealed capability catalog from typed declarations. |
modelBudgetStrategies | constant | |
ModelBudgetStrategy | type | Preset name, or an explicit partial set of Core runner settings. |
ModelChildrenOptions | interface | Group options: worker count, extra cancellation and accept/commit hooks. |
ModelChildTask | interface | One child call in a group: its own limits plus the work to run with the child runner. |
ModelChoiceIndex | interface | Minimal selector shape used while filtering the provider response choices. |
modelInteractionCatalog | constant | |
ModelProviderErrorCode | type | Stable failure classification reported by the compatible provider adapter. |
ModelProviderFailure | interface | Failure detail passed to the App's error factory. |
ModelStageTransportRegistration | interface | Stage IDs and capability references are App-owned; this adapter only compiles their relation. |
ModelStrategyOptions | type | Input of createModelStrategy: model selection, optional reasoning and budget plus explicit Core overrides. Explicit Core fields win over every generated value. |
PreparedSessionTransport | interface | Prepared session transport handed to the runner. |
prepareSessionFunctions | function | Build the session policy for one stage. |
PreviewTool | interface | A model tool with an explicit, presentation-only streaming preview contract. |
ProviderAssistantMessage | interface | Assistant turn; content may be empty when the turn is only a tool declaration. |
ProviderErrorCapture | interface | Captured upstream error body and whether it had to be truncated. |
ProviderEventDescriptor | interface | Provider event name plus its content class. |
ProviderEventName | type | Union of provider event names. |
ProviderEventPayloads | interface | Payload of each provider event. Content-bearing events are accepted explicitly. |
ProviderMessage | type | Message list a host may pass to the compatible provider directly. |
ProviderObservation | type | One observation: event name with its payload. |
ProviderObserver | interface | The caller can correlate each observation using the original, request-local model options. |
ProviderReasoningLevel | type | Supplier wire shape is explicit; levels express requested effort, not measured quality. |
ProviderReasoningStrategy | type | How a reasoning level is translated into request fields. requestBody entries override generated fields, so a host can correct a provider that expects a different shape. |
ProviderSystemMessage | interface | System instruction turn; text only, so the union rejects images and tool fields here. |
ProviderToolCall | type | One tool call the assistant declared, in wire order; aliases the Core shape. |
ProviderToolMessage | interface | Tool result answering one declared call. |
ProviderUserMessage | interface | User turn; the only message type that may carry images, and never tool calls. |
ReplyPreviewOptions | interface | Settings for createReplyPreview; sink receives every bubble list and is required. |
ReplyPreviewRule | interface | One projection rule: which stage/capability it matches and which prose fields may be shown. A rule without toolId may only match a registered plain-text stage. |
ReplyPreviewStage | interface | Stage declaration: which tools it exposes and whether it previews text or arguments. |
ReplyPreviewTool | interface | Capability declaration used to derive preview rules. Omitted preview means the capability never previews, so previewing is an explicit opt-in. |
ResolvedSessionCall | interface | One completed call with host-facing resolution; unknown tools and bad JSON stay non-fatal. |
ResolvedSessionResult | interface | Complete result of one session response after host-facing resolution. |
runChildren | function | Run child tasks concurrently and return their values in declaration order. The first failure aborts the remaining group, but an already in-flight commit is still awaited because cancellation does not mean the write was rolled back. |
sessionCompletionPolicy | constant | |
SessionFunctionOptions | interface | Options a session transport may pass through to provider options. |
SessionModelTransportRegistration | interface | Registration for one session transport. |