Listing of which clojure.core functions are implemented #108
-
Is there a listing or source file I can check to see which (ns ai-poll
(:require ["openai" :as OpenAI]
[clojure.walk :as w]))
(def openai (OpenAI/OpenAI.))
(defn ^:async ask-ai [question temp]
(let [payload (clj->js {:messages [{:role "user", :content question}] :model "gpt-4", :temperature temp})
response (js/await (.chat.completions.create openai payload))
{{answer :content} :message} (first (:choices (w/keywordize-keys (js->clj response))))]
answer))
Context: I want to convert the response here from string map keys to keyword keys. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I should add both cherry and squint are super fun btw! It's so great to be able to just leverage the npm ecosystem but use s expressions! Love it. |
Beta Was this translation helpful? Give feedback.
-
We can add clojure.walk, it's currently not packaged. clojure.string is, but we can do clojure.walk in a similar fashion. Would you like to try a PR or would you like me to do it? |
Beta Was this translation helpful? Give feedback.
-
Just added |
Beta Was this translation helpful? Give feedback.
Just added
clojure.string
(it turned out it wasn't there yet) andclojure.walk