Skip to content
8 min read · 1,584 words

Function: buildAnthropicMessagesHistory()

ts
function buildAnthropicMessagesHistory(input: {
  bucketOrder: ChatCompletionsBucketOrder;
  cacheBreakpoints: AnthropicCacheBreakpoints;
  cacheTtl?: AnthropicCacheTtl;
  filterThoughts: (
    thoughts: Iterable<Thought>,
    mode: "all-self" | "latest-self" | "all",
    selfIdentity: string,
    replayCompatibility: readonly string[],
  ) => Thought[];
  memories: Iterable<Memory>;
  messages: Iterable<Message>;
  model: string;
  renderAnthropicSegmentedSystemPrompt: (input: {
    bucketOrder: ChatCompletionsBucketOrder;
    cacheBreakpoints: AnthropicCacheBreakpoints;
    cacheTtl?: AnthropicCacheTtl;
    memories: Iterable<Memory>;
    renderFirstPartyRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
    ) => Promise<string>;
    renderMemories: (
      items: Iterable<{
        attrs: MemoryAttrs;
        memory: Memory;
      }>,
    ) => string;
    renderRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderFirstPartyRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
        ) => Promise<string>;
        renderRetrievableSafetyDirective: () => string;
        renderThirdPartyPrivateRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
          deps: {
            renderUntrustedContent: (
              content: string,
              attrs: UntrustedContentAttrs,
            ) => string;
          },
        ) => Promise<string>;
        renderThirdPartyPublicRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
          deps: {
            renderUntrustedContent: (
              content: string,
              attrs: UntrustedContentAttrs,
            ) => string;
          },
        ) => Promise<string>;
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderRetrievableSafetyDirective: () => string;
    renderStandingInstructions: (
      items: Iterable<Tokenizable>,
      attrs?: StandingInstructionAttrs,
    ) => string;
    renderThirdPartyPrivateRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderThirdPartyPublicRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderUntrustedContent: (
      content: string,
      attrs: UntrustedContentAttrs,
    ) => string;
    retrievables: Iterable<Retrievable>;
    standingInstructions: Iterable<Tokenizable>;
    systemPrompt: Tokenizable;
    warn?: (msg: string) => void;
  }) => Promise<TextBlockParam[]>;
  renderAnthropicThinkingBlocks: (input: {
    model: string;
    prefixFingerprint: string;
    replayCompatibility: readonly string[];
    thought: Thought;
    warn?: (msg: string) => void;
  }) => ContentBlockParam[];
  renderAnthropicTimelineMessage: (input: {
    message: Message;
    renderAnthropicMediaBlocks: (input: {
      media: Media;
      renderTrustedContent: (
        content: string,
        attrs: TrustedContentAttrs,
      ) => string;
      renderUntrustedContent: (
        content: string,
        attrs: UntrustedContentAttrs,
      ) => string;
      unsupportedMediaPolicy: UnsupportedMediaPolicy;
      warn?: (msg: string) => void;
    }) => Promise<ContentBlockParam[]>;
    selfIdentity: string;
    unsupportedMediaPolicy: UnsupportedMediaPolicy;
    warn?: (msg: string) => void;
  }) => Promise<MessageParam | null>;
  renderAnthropicToolCallResult: (input: {
    renderAnthropicMediaBlocks: (input: {
      media: Media;
      renderTrustedContent: (
        content: string,
        attrs: TrustedContentAttrs,
      ) => string;
      renderUntrustedContent: (
        content: string,
        attrs: UntrustedContentAttrs,
      ) => string;
      unsupportedMediaPolicy: UnsupportedMediaPolicy;
      warn?: (msg: string) => void;
    }) => Promise<ContentBlockParam[]>;
    renderTrustedContent: (
      content: string,
      attrs: TrustedContentAttrs,
    ) => string;
    renderUntrustedContent: (
      content: string,
      attrs: UntrustedContentAttrs,
    ) => string;
    results:
      | Tokenizable
      | SpooledArtifact
      | Media
      | Media[]
      | SpooledArtifact[];
    tool: Tool<SpooledArtifact> | ArtifactTool | undefined;
    toolCall: ToolCall;
    unsupportedMediaPolicy: UnsupportedMediaPolicy;
    warn?: (msg: string) => void;
  }) => Promise<ToolResultBlockParam>;
  renderChatCompletionsSystemPrompt: (input: {
    bucketOrder: ChatCompletionsBucketOrder;
    memories: Iterable<Memory>;
    renderFirstPartyRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
    ) => Promise<string>;
    renderMemories: (
      items: Iterable<{
        attrs: MemoryAttrs;
        memory: Memory;
      }>,
    ) => string;
    renderRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderFirstPartyRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
        ) => Promise<string>;
        renderRetrievableSafetyDirective: () => string;
        renderThirdPartyPrivateRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
          deps: {
            renderUntrustedContent: (
              content: string,
              attrs: UntrustedContentAttrs,
            ) => string;
          },
        ) => Promise<string>;
        renderThirdPartyPublicRetrievables: (
          items: Iterable<{
            attrs: RetrievableAttrs;
            retrievable: Retrievable;
          }>,
          deps: {
            renderUntrustedContent: (
              content: string,
              attrs: UntrustedContentAttrs,
            ) => string;
          },
        ) => Promise<string>;
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderRetrievableSafetyDirective: () => string;
    renderStandingInstructions: (
      items: Iterable<Tokenizable>,
      attrs?: StandingInstructionAttrs,
    ) => string;
    renderThirdPartyPrivateRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderThirdPartyPublicRetrievables: (
      items: Iterable<{
        attrs: RetrievableAttrs;
        retrievable: Retrievable;
      }>,
      deps: {
        renderUntrustedContent: (
          content: string,
          attrs: UntrustedContentAttrs,
        ) => string;
      },
    ) => Promise<string>;
    renderUntrustedContent: (
      content: string,
      attrs: UntrustedContentAttrs,
    ) => string;
    retrievables: Iterable<Retrievable>;
    standingInstructions: Iterable<Tokenizable>;
    systemPrompt: Tokenizable;
  }) => Promise<string>;
  renderedToolCallResults: Map<string, ToolResultBlockParam>;
  renderFirstPartyRetrievables: (
    items: Iterable<{
      attrs: RetrievableAttrs;
      retrievable: Retrievable;
    }>,
  ) => Promise<string>;
  renderMemories: (
    items: Iterable<{
      attrs: MemoryAttrs;
      memory: Memory;
    }>,
  ) => string;
  renderRetrievables: (
    items: Iterable<{
      attrs: RetrievableAttrs;
      retrievable: Retrievable;
    }>,
    deps: {
      renderFirstPartyRetrievables: (
        items: Iterable<{
          attrs: RetrievableAttrs;
          retrievable: Retrievable;
        }>,
      ) => Promise<string>;
      renderRetrievableSafetyDirective: () => string;
      renderThirdPartyPrivateRetrievables: (
        items: Iterable<{
          attrs: RetrievableAttrs;
          retrievable: Retrievable;
        }>,
        deps: {
          renderUntrustedContent: (
            content: string,
            attrs: UntrustedContentAttrs,
          ) => string;
        },
      ) => Promise<string>;
      renderThirdPartyPublicRetrievables: (
        items: Iterable<{
          attrs: RetrievableAttrs;
          retrievable: Retrievable;
        }>,
        deps: {
          renderUntrustedContent: (
            content: string,
            attrs: UntrustedContentAttrs,
          ) => string;
        },
      ) => Promise<string>;
      renderUntrustedContent: (
        content: string,
        attrs: UntrustedContentAttrs,
      ) => string;
    },
  ) => Promise<string>;
  renderRetrievableSafetyDirective: () => string;
  renderStandingInstructions: (
    items: Iterable<Tokenizable>,
    attrs?: StandingInstructionAttrs,
  ) => string;
  renderThirdPartyPrivateRetrievables: (
    items: Iterable<{
      attrs: RetrievableAttrs;
      retrievable: Retrievable;
    }>,
    deps: {
      renderUntrustedContent: (
        content: string,
        attrs: UntrustedContentAttrs,
      ) => string;
    },
  ) => Promise<string>;
  renderThirdPartyPublicRetrievables: (
    items: Iterable<{
      attrs: RetrievableAttrs;
      retrievable: Retrievable;
    }>,
    deps: {
      renderUntrustedContent: (
        content: string,
        attrs: UntrustedContentAttrs,
      ) => string;
    },
  ) => Promise<string>;
  renderThought: (
    content: string,
    attrs: ThoughtAttrs,
    payload?: unknown,
  ) => string;
  renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
  renderUntrustedContent: (
    content: string,
    attrs: UntrustedContentAttrs,
  ) => string;
  replayCompatibility: readonly string[];
  retrievables: Iterable<Retrievable>;
  selfIdentity: string;
  standingInstructions: Iterable<Tokenizable>;
  systemPrompt: Tokenizable;
  thoughts: Iterable<Thought>;
  thoughtSurfacing: "all-self" | "latest-self" | "all";
  toolCalls: Iterable<ToolCall>;
  tools: ToolRegistry;
  unsupportedMediaPolicy: UnsupportedMediaPolicy;
  warn?: (msg: string) => void;
}): Promise<{
  messages: MessageParam[];
  system?: string | TextBlockParam[];
  tools?: Tool[];
}>;

Defined in: src/batteries/llm/anthropic_messages/helpers.ts:493

Assembles Anthropic system content, messages, tools, and safely replayable thinking.

Parameters

ParameterType
input{ bucketOrder: ChatCompletionsBucketOrder; cacheBreakpoints: AnthropicCacheBreakpoints; cacheTtl?: AnthropicCacheTtl; filterThoughts: (thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[]; memories: Iterable<Memory>; messages: Iterable<Message>; model: string; renderAnthropicSegmentedSystemPrompt: (input: { bucketOrder: ChatCompletionsBucketOrder; cacheBreakpoints: AnthropicCacheBreakpoints; cacheTtl?: AnthropicCacheTtl; memories: Iterable<Memory>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; warn?: (msg: string) => void; }) => Promise<TextBlockParam[]>; renderAnthropicThinkingBlocks: (input: { model: string; prefixFingerprint: string; replayCompatibility: readonly string[]; thought: Thought; warn?: (msg: string) => void; }) => ContentBlockParam[]; renderAnthropicTimelineMessage: (input: { message: Message; renderAnthropicMediaBlocks: (input: { media: Media; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ContentBlockParam[]>; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<MessageParam | null>; renderAnthropicToolCallResult: (input: { renderAnthropicMediaBlocks: (input: { media: Media; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ContentBlockParam[]>; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; results: | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[]; tool: | Tool<SpooledArtifact> | ArtifactTool | undefined; toolCall: ToolCall; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ToolResultBlockParam>; renderChatCompletionsSystemPrompt: (input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string>; renderedToolCallResults: Map<string, ToolResultBlockParam>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThought: (content: string, attrs: ThoughtAttrs, payload?: unknown) => string; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; replayCompatibility: readonly string[]; retrievables: Iterable<Retrievable>; selfIdentity: string; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; thoughts: Iterable<Thought>; thoughtSurfacing: "all-self" | "latest-self" | "all"; toolCalls: Iterable<ToolCall>; tools: ToolRegistry; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }
input.bucketOrderChatCompletionsBucketOrder
input.cacheBreakpointsAnthropicCacheBreakpoints
input.cacheTtl?AnthropicCacheTtl
input.filterThoughts(thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[]
input.memoriesIterable<Memory>
input.messagesIterable<Message>
input.modelstring
input.renderAnthropicSegmentedSystemPrompt(input: { bucketOrder: ChatCompletionsBucketOrder; cacheBreakpoints: AnthropicCacheBreakpoints; cacheTtl?: AnthropicCacheTtl; memories: Iterable<Memory>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; warn?: (msg: string) => void; }) => Promise<TextBlockParam[]>
input.renderAnthropicThinkingBlocks(input: { model: string; prefixFingerprint: string; replayCompatibility: readonly string[]; thought: Thought; warn?: (msg: string) => void; }) => ContentBlockParam[]
input.renderAnthropicTimelineMessage(input: { message: Message; renderAnthropicMediaBlocks: (input: { media: Media; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ContentBlockParam[]>; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<MessageParam | null>
input.renderAnthropicToolCallResult(input: { renderAnthropicMediaBlocks: (input: { media: Media; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ContentBlockParam[]>; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; results: | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[]; tool: | Tool<SpooledArtifact> | ArtifactTool | undefined; toolCall: ToolCall; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<ToolResultBlockParam>
input.renderChatCompletionsSystemPrompt(input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string>
input.renderedToolCallResultsMap<string, ToolResultBlockParam>
input.renderFirstPartyRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>
input.renderMemories(items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string
input.renderRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderRetrievableSafetyDirective() => string
input.renderStandingInstructions(items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string
input.renderThirdPartyPrivateRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderThirdPartyPublicRetrievables(items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>
input.renderThought(content: string, attrs: ThoughtAttrs, payload?: unknown) => string
input.renderTrustedContent(content: string, attrs: TrustedContentAttrs) => string
input.renderUntrustedContent(content: string, attrs: UntrustedContentAttrs) => string
input.replayCompatibilityreadonly string[]
input.retrievablesIterable<Retrievable>
input.selfIdentitystring
input.standingInstructionsIterable<Tokenizable>
input.systemPromptTokenizable
input.thoughtsIterable<Thought>
input.thoughtSurfacing"all-self" | "latest-self" | "all"
input.toolCallsIterable<ToolCall>
input.toolsToolRegistry
input.unsupportedMediaPolicyUnsupportedMediaPolicy
input.warn?(msg: string) => void

Returns

Promise<{ messages: MessageParam[]; system?: string | TextBlockParam[]; tools?: Tool[]; }>