Interface: ChatHelpersCommon
Defined in: batteries/llm/chat_common/types.ts:278
The wire-shape-agnostic subset of a Chat-family battery's translation helpers — every helper that produces a plain string (or JSON Schema / tool-definition wire, which is identical across the family) rather than a battery-specific message object.
Remarks
Both ChatCompletionsHelpers (OpenAI battery) and OllamaHelpers (Ollama battery) extend this contract and add their own wire-specific members (timeline-message rendering, tool-call-result rendering, history assembly, and — for OpenAI — streaming tool-call delta accumulation). Helpers that compose other helpers receive their dependents via explicit deps arguments typed against THIS contract (never against a battery-specific bag), so the shared implementations carry no import edge back to any individual battery.
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
descriptionToChatCompletionsJsonSchema | (d: DescriptionLike) => JsonSchema | Converts a validator describe() envelope into the Chat-Completions JSON-Schema subset. | batteries/llm/chat_common/types.ts:280 |
filterThoughts | (thoughts: Iterable<Thought>, mode: "all-self" | "latest-self" | "all", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[] | Selects which thoughts to surface, by surfacing mode, self identity, and replay compatibility. | batteries/llm/chat_common/types.ts:322 |
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> | Assembles the system-prompt message from its constituent buckets in ChatCompletionsBucketOrder. | batteries/llm/chat_common/types.ts:334 |
renderFirstPartyRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string> | Renders first-party (trusted) retrievables into a single prompt block. | batteries/llm/chat_common/types.ts:295 |
renderMemories | (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string | Renders memories (each with its attribute bag) into a single prompt block. | batteries/llm/chat_common/types.ts:291 |
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> | Assembles the full retrievables block: safety directive plus the trust-tiered sub-renderers. | batteries/llm/chat_common/types.ts:309 |
renderRetrievableSafetyDirective | () => string | Renders the safety directive that precedes any retrievable content. | batteries/llm/chat_common/types.ts:293 |
renderStandingInstructions | (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string | Renders standing instructions into a single prompt block. | batteries/llm/chat_common/types.ts:286 |
renderThirdPartyPrivateRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string> | Renders third-party private retrievables, wrapping each in the untrusted-content envelope. | batteries/llm/chat_common/types.ts:304 |
renderThirdPartyPublicRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string> | Renders third-party public retrievables, wrapping each in the untrusted-content envelope. | batteries/llm/chat_common/types.ts:299 |
renderThought | (content: string, attrs: ThoughtAttrs, payload?: unknown) => string | Renders a single thought into its prompt block, optionally carrying an opaque replay payload. | batteries/llm/chat_common/types.ts:320 |
renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string | Wraps trusted (first-party) text in the trusted-content trust envelope. | batteries/llm/chat_common/types.ts:284 |
renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string | Wraps untrusted (third-party) text in the untrusted-content trust envelope. | batteries/llm/chat_common/types.ts:282 |
toolsToChatCompletionsTools | (tools: readonly ( | Tool<SpooledArtifact> | ArtifactTool)[], deps: { descriptionToChatCompletionsJsonSchema: (d: DescriptionLike) => JsonSchema; }) => ChatCompletionsTool[] | Translates the tool registry into the function-tool wire array advertised to the model. | batteries/llm/chat_common/types.ts:329 |