Skip to content

Commit b4c7a3c

Browse files
committed
Fix model names with slashes
1 parent 433f6e6 commit b4c7a3c

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/eca/handlers.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
full-model (str provider "/" model)
2626
model-capabilities (merge
2727
(or (get all-models full-model)
28-
;; we guess the capabilities from
29-
;; the first model with same name
28+
;; we guess the capabilities from
29+
;; the first model with same name
3030
(when-let [found-full-model (first (filter #(= model (second (string/split % #"/" 2)))
3131
(keys all-models)))]
3232
(get all-models found-full-model))

src/eca/models.clj

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
(defn ^:private models-dev* []
1212
(try
1313
(let [response (slurp "https://models.dev/api.json")
14-
data (json/parse-string response keyword)]
14+
data (json/parse-string response)]
1515
data)
1616
(catch Exception e
1717
(logger/error logger-tag " Error fetching models from models.dev:" (.getMessage e))
@@ -26,10 +26,10 @@
2626
"openai/gpt-5"
2727
"openai/gpt-5-mini"
2828
"openai/gpt-5-nano"
29-
"anthropic/claude-sonnet-4"
30-
"anthropic/claude-opus-4"
31-
"anthropic/claude-opus-4.1"
32-
"anthropic/claude-3.5-haiku"})
29+
"anthropic/claude-sonnet-4-20250514"
30+
"anthropic/claude-opus-4-20250514"
31+
"anthropic/claude-opus-4-1-20250805"
32+
"anthropic/claude-3-5-haiku-20241022"})
3333

3434
(defn all
3535
"Return all known existing models with their capabilities and configs."
@@ -39,24 +39,24 @@
3939
(merge m
4040
(reduce
4141
(fn [p [model model-config]]
42-
(let [provider-name (or (namespace model) (name provider))]
43-
(assoc p (str provider-name "/" (name model))
44-
(assoc-some
45-
{:provider provider-name
46-
:reason? (:reasoning model-config)
47-
;; TODO how to check for web-search mode dynamically
48-
:web-search (contains? models-with-web-search-support (name model))
49-
:tools (:tool_call model-config)
50-
:max-output-tokens (-> model-config :limit :output)}
51-
:input-token-cost (some-> (:input (:cost model-config)) float (/ one-million))
52-
:output-token-cost (some-> (:output (:cost model-config)) float (/ one-million))
53-
:input-cache-creation-token-cost (some-> (:cache_write (:cost model-config)) float (/ one-million))
54-
:input-cache-read-token-cost (some-> (:cache_read (:cost model-config)) float (/ one-million))))))
42+
(assoc p (str provider "/" model)
43+
(assoc-some
44+
{:reason? (get model-config "reasoning")
45+
;; TODO how to check for web-search mode dynamically,
46+
;; maybe fixed after web-search toolcall is implemented
47+
:web-search (contains? models-with-web-search-support (name model))
48+
:tools (get model-config "tool_call")
49+
:max-output-tokens (get-in model-config ["limit" "output"])}
50+
:input-token-cost (some-> (get-in model-config ["cost" "input"]) float (/ one-million))
51+
:output-token-cost (some-> (get-in model-config ["cost" "output"]) float (/ one-million))
52+
:input-cache-creation-token-cost (some-> (get-in model-config ["cost" "cache_write"]) float (/ one-million))
53+
:input-cache-read-token-cost (some-> (get-in model-config ["cost" "cache_read"]) float (/ one-million)))))
5554
{}
56-
(:models provider-config))))
55+
(get provider-config "models"))))
5756
{}
5857
(models-dev)))
5958

6059
(comment
6160
(require '[clojure.pprint :as pprint])
61+
(pprint/pprint (models-dev))
6262
(pprint/pprint (all)))

0 commit comments

Comments
 (0)