Interface: ChatHelpersCommon
Defined in: src/batteries/llm/chat_common/types.ts:476
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. | src/batteries/llm/chat_common/types.ts:478 |
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. | src/batteries/llm/chat_common/types.ts:541 |
renderArtifactHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Renders the directions-bearing "handle" body for a non-inlined @nhtio/adk!SpooledArtifact tool result: metadata (callId/kind/byteLength/lineCount) plus the forged artifact_* tools the model should call to read it incrementally. Remarks Optional override seam. When omitted the battery uses the shared defaultRenderArtifactHandleBody. A consumer overrides it to change WHICH reader the model is steered toward first — e.g. promoting the JSON content-readers (artifact_json_get / artifact_json_keys) ahead of the metadata-only artifact_json_type for a small model that grabs the first listed tool. The tool list itself comes from the artifact's constructor.toolMethods; an override typically reorders or re-annotates that list before delegating to the default renderer. | src/batteries/llm/chat_common/types.ts:530 |
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. | src/batteries/llm/chat_common/types.ts:553 |
renderFirstPartyRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>) => Promise<string> | Renders first-party (trusted) retrievables into a single prompt block. | src/batteries/llm/chat_common/types.ts:493 |
renderMemories | (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string | Renders memories (each with its attribute bag) into a single prompt block. | src/batteries/llm/chat_common/types.ts:489 |
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. | src/batteries/llm/chat_common/types.ts:507 |
renderRetrievableSafetyDirective | () => string | Renders the safety directive that precedes any retrievable content. | src/batteries/llm/chat_common/types.ts:491 |
renderStandingInstructions | (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string | Renders standing instructions into a single prompt block. | src/batteries/llm/chat_common/types.ts:484 |
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. | src/batteries/llm/chat_common/types.ts:502 |
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. | src/batteries/llm/chat_common/types.ts:497 |
renderThought | (content: string, attrs: ThoughtAttrs, payload?: unknown) => string | Renders a single thought into its prompt block, optionally carrying an opaque replay payload. | src/batteries/llm/chat_common/types.ts:539 |
renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string | Wraps trusted (first-party) text in the trusted-content trust envelope. | src/batteries/llm/chat_common/types.ts:482 |
renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string | Wraps untrusted (third-party) text in the untrusted-content trust envelope. | src/batteries/llm/chat_common/types.ts:480 |
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. | src/batteries/llm/chat_common/types.ts:548 |