| 1 | (ns micro-blog.is-tech |
| 2 | (:require |
| 3 | [micro-blog.config :refer [config]] |
| 4 | [taoensso.telemere :as tel] |
| 5 | [clj-http.client :as client])) |
| 6 | |
| 7 | (defn is-tech? [post-text] |
| 8 | (let [url (str (:mistral-host @config) "/v1/conversations") |
| 9 | headers {"Content-Type" "application/json" |
| 10 | "Accept" "application/json" |
| 11 | "Authorization" (str "Bearer " (@config :mistral-api-key))} |
| 12 | body {:inputs post-text |
| 13 | :stream false |
| 14 | :agent_id (@config :mistral-agent-id)}] |
| 15 | (tel/log! {:level :info :data {:url url :agent_id (:agent_id body)}} "making request to mistral agent") |
| 16 | (-> |
| 17 | (client/post url {:headers headers |
| 18 | :form-params body |
| 19 | :content-type :json |
| 20 | :as :json}) |
| 21 | :body |
| 22 | :outputs |
| 23 | first |
| 24 | :content |
| 25 | (#(if (= "1" %) true false))))) |
| 26 |
travisshears / is_tech?
Last active 3 months ago
Revision e8ffa63797da9f301480edaacacf24e2b657ce10