Last active 1755323272

Revision 86cd84dc5b21f1a7f9362409a59fe3adb1bf6d49

is_tech.clj Raw
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