Skip to content
Français

ModelContentBlock

import type { ModelContentBlock } from "@elie-laloum/outpost";

The fields below cover all variants; the signature specifies their allowed combinations.

  • typeRequired
    "text" | "tool-call" | "tool-result" | "reasoning"
    Block discriminator: text.
  • textVariant-dependent
    string | string | undefined
    Plain text of the block; empty text blocks are not sent to Anthropic.
  • idVariant-dependent
    string
    Service-issued call identifier that the matching tool result must reference.
  • nameVariant-dependent
    string
    Name of the requested tool, as declared in the request tools.
  • inputVariant-dependent
    unknown
    Parsed tool arguments. When the service returns invalid JSON, the raw string is kept so the caller can report the error to the model.
  • callIdVariant-dependent
    string
    Identifier of the tool call this result answers.
  • contentVariant-dependent
    string
    Text returned to the model for this call.
  • isErrorVariant-dependent
    boolean | undefined
    Marks the result as a failed tool execution. Only Anthropic transmits it, as is_error; OpenAI protocols send the content alone.
  • providerVariant-dependent
    string
    Identity of the provider that produced the block; other providers never receive it.
  • modelVariant-dependent
    string
    Model that produced the block; it is replayed only to the same model.
  • dataVariant-dependent
    unknown
    Opaque service payload: an Anthropic thinking or redacted_thinking block with its signature, or an OpenAI Responses reasoning item. Replay it unchanged.
export type ModelContentBlock =
  | ModelTextBlock
  | ModelToolCallBlock
  | ModelToolResultBlock
  | ModelReasoningBlock;