Stream a chat completion from whichever provider the user has configured.
let summary = '';for await (const d of chat({ messages: [{ role: 'user', content: [{ type: 'text', text }] }] })) { if (d.type === 'text-delta') summary += d.text;} Copy
let summary = '';for await (const d of chat({ messages: [{ role: 'user', content: [{ type: 'text', text }] }] })) { if (d.type === 'text-delta') summary += d.text;}
Requires the llm:chat capability. If no provider is bound the host fails the stream into the SP-7 connect-me prompt (the user adds a key) — the generator throws with code: 'auth-required'; an un-granted call throws forbidden.
llm:chat
code: 'auth-required'
forbidden
Stream a chat completion from whichever provider the user has configured.
Requires the
llm:chatcapability. If no provider is bound the host fails the stream into the SP-7 connect-me prompt (the user adds a key) — the generator throws withcode: 'auth-required'; an un-granted call throwsforbidden.