← All @molecule/* packages · App templates
@molecule/api-ai-summarization-llmProvider bond · ai-summarization · API (Node) · v1.0.1 · Apache-2.0
LLM-backed summarization provider for molecule.dev — composes the swappable ai chat bond to condense text into a summary
npm install @molecule/api-ai-summarization-llmnpm · Source on GitHub · Implements @molecule/api-ai-summarization
@molecule/api-ai-summarization-llm is a provider bond on the API (Node) side: it implements the ai-summarization core interface (@molecule/api-ai-summarization) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { provider as anthropic } from '@molecule/api-ai-anthropic'
import { requireProvider } from '@molecule/api-ai-summarization'
import { provider as summarization } from '@molecule/api-ai-summarization-llm'
import { bond } from '@molecule/api-bond'
// Wire the AI chat provider this composes, then bond the summarizer.
bond('ai', anthropic)
bond('ai-summarization', summarization)
// Use anywhere after startup.
const { summary, usage } = await requireProvider().summarize({
text: longArticle,
format: 'bullets',
maxLength: 60,
focus: 'the financial impact',
})Works with: @molecule/api-ai, @molecule/api-ai-summarization, @molecule/api-i18n
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Default (llm) AI summarization provider for molecule.dev.
Turns a block of text into a concise summary over whatever LLM the app has
bonded. It has no vendor of its own — it composes the swappable ai chat
bond (@molecule/api-ai) with a summarizer system prompt built from the
requested format / length / focus, so swapping the LLM swaps the summarizer.
import { provider as anthropic } from '@molecule/api-ai-anthropic'
import { requireProvider } from '@molecule/api-ai-summarization'
import { provider as summarization } from '@molecule/api-ai-summarization-llm'
import { bond } from '@molecule/api-bond'
// Wire the AI chat provider this composes, then bond the summarizer.
bond('ai', anthropic)
bond('ai-summarization', summarization)
// Use anywhere after startup.
const { summary, usage } = await requireProvider().summarize({
text: longArticle,
format: 'bullets',
maxLength: 60,
focus: 'the financial impact',
})
provider
npm install @molecule/api-ai-summarization-llm @molecule/api-ai @molecule/api-ai-summarization @molecule/api-i18n
providerDefault AI summarization provider.
Composes the bonded ai chat provider (@molecule/api-ai) — an AI provider
MUST be bonded first (bond('ai', <provider>)), or summarize() throws. Bond
it with bond('ai-summarization', provider); swap in a custom
AISummarizationProvider to replace it without touching call sites.
const provider: AISummarizationProvider
Implements @molecule/api-ai-summarization interface.
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-ai-summarization'
import { provider } from '@molecule/api-ai-summarization-llm'
export function setupAiSummarizationLlm(): void {
setProvider(provider)
}
Peer dependencies:
@molecule/api-ai ^1.0.1@molecule/api-ai-summarization ^1.0.1@molecule/api-i18n ^1.0.1@molecule/api-ai@molecule/api-ai-summarization@molecule/api-i18nComposes the swappable ai bond: an ai provider MUST be bonded first
(bond('ai', <provider>)) or summarize() throws (a missing AI provider
throws at summarize() time, not at import). Pass provider on the input to
target a specific named ai provider. Because it is just prompt orchestration
over the bonded LLM, swapping the ai provider swaps the model behind every
summary without touching call sites.
Integration checklist — drive the real UI (live preview, no mocks), adapt each item to this app's actual screens/flows, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip:
maxLength (approx target words) produces a shorter summary than a larger
one, and switching format between 'paragraph', 'bullets', and 'tldr'
visibly changes the structure (bullets render as a list, tldr is terser).
If the app exposes only some of these, verify the ones it exposes.