Fork me on GitHub
#missionary
<
2023-12-22
>
joshcho10:12:21

llms + missionary is 🔥

(let [chan (api/create-chat-completion
            {:model       "gpt-4-1106-preview"
             :messages    [#_{:role "system" :content "empty"}
                           {:role "user" :content s}]
             :temperature 0
             :stream      true
             })]
  (->> (channel-flow chan)
    (m/eduction (take-while #(not= :done %))
                (map #(get-in % [:choices 0 :delta :content])))
    (m/reductions str)
    (m/relieve {})))

👍 3