Skip to content
2 min read · 446 words

Variable: defaultRenderAnthropicSegmentedSystemPrompt

ts
const defaultRenderAnthropicSegmentedSystemPrompt: (input: {
  bucketOrder: ChatCompletionsBucketOrder;
  cacheBreakpoints: AnthropicCacheBreakpoints;
  cacheTtl?: "5m" | "1h";
  memories: Iterable<Memory>;
  renderCtx?: unknown;
  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[]> = renderAnthropicSegmentedSystemPrompt;

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

Default segmented system renderer.

Renders system buckets as separate text blocks and places up to three cache breakpoints.

Parameters

ParameterType
input{ bucketOrder: ChatCompletionsBucketOrder; cacheBreakpoints: AnthropicCacheBreakpoints; cacheTtl?: "5m" | "1h"; memories: Iterable<Memory>; renderCtx?: unknown; 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; }
input.bucketOrderChatCompletionsBucketOrder
input.cacheBreakpointsAnthropicCacheBreakpoints
input.cacheTtl?"5m" | "1h"
input.memoriesIterable<Memory>
input.renderCtx?unknown
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.renderUntrustedContent(content: string, attrs: UntrustedContentAttrs) => string
input.retrievablesIterable<Retrievable>
input.standingInstructionsIterable<Tokenizable>
input.systemPromptTokenizable
input.warn?(msg: string) => void

Returns

Promise<TextBlockParam[]>