File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -188,4 +188,20 @@ log.error('Error!');
188188log .message (' Hello, World' , { symbol: color .cyan (' ~' ) });
189189```
190190
191+
192+ ### Stream
193+
194+ When interacting with dynamic LLMs or other streaming message providers, use the ` stream ` APIs to log messages from an iterable, even an async one.
195+
196+ ``` js
197+ import { stream } from ' @clack/prompts' ;
198+
199+ stream .info ((function * () { yield ' Info!' ; })());
200+ stream .success ((function * () { yield ' Success!' ; })());
201+ stream .step ((function * () { yield ' Step!' ; })());
202+ stream .warn ((function * () { yield ' Warn!' ; })());
203+ stream .error ((function * () { yield ' Error!' ; })());
204+ stream .message ((function * () { yield ' Hello' ; yield " , World" })(), { symbol: color .cyan (' ~' ) });
205+ ```
206+
191207[ clack-log-prompts] ( https://github.com/natemoo-re/clack/blob/main/.github/assets/clack-logs.png )
You can’t perform that action at this time.
0 commit comments