Message stream events as data, and the fold that turns them back into the message a non-streaming call would have returned.
Message stream events as data, and the fold that turns them back into the message a non-streaming call would have returned.
(accumulate)(accumulate message)(accumulate message {:keys [type index] :as event})A reducing function that folds event payloads into a message. Use it with reduce and an init of nil, or with transduce. Unknown event types are ignored.
A reducing function that folds event payloads into a message. Use it with reduce and an init of nil, or with transduce. Unknown event types are ignored.
Fold a content block delta into its block. Dispatches on the delta's :type; a type with no method leaves the block unchanged.
Fold a content block delta into its block. Dispatches on the delta's :type; a type with no method leaves the block unchanged.
(payloads)A transducer from the lines of a Messages SSE stream to event payloads such as {:type "content_block_delta" :index 0 :delta {...}}. Pings are dropped, and an error event is thrown as the ex-info it describes.
A transducer from the lines of a Messages SSE stream to event payloads
such as {:type "content_block_delta" :index 0 :delta {...}}. Pings are
dropped, and an error event is thrown as the ex-info it describes.(text-deltas)A transducer from event payloads to the pieces of text they carry, in order. Everything that is not a text delta is dropped.
(run! print (eduction (text-deltas) (cl4cl.core/stream client body)))
A transducer from event payloads to the pieces of text they carry, in order. Everything that is not a text delta is dropped. (run! print (eduction (text-deltas) (cl4cl.core/stream client body)))
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |