Skip to content

Commit e9386fe

Browse files
committed
move defaultModel to root
1 parent 4b7db15 commit e9386fe

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

integration-test/integration/chat/custom_provider_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
(eca/request! (fixture/initialize-request
2222
{:initializationOptions
2323
(merge fixture/default-init-options
24-
{:defaultModel "foo-1"
24+
{:defaultModel "myProvider/foo-1"
2525
:customProviders
2626
{"myProvider"
2727
{:api "openai-responses"
@@ -144,7 +144,7 @@
144144
(eca/request! (fixture/initialize-request
145145
{:initializationOptions
146146
(merge fixture/default-init-options
147-
{:defaultModel "deepseek-coder"
147+
{:defaultModel "myProvider/deepseek-coder"
148148
:customProviders
149149
{"myProvider"
150150
{:api "openai-chat"

integration-test/integration/initialize_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
:chatWelcomeMessage "Welcome to ECA!\n\nType '/' for commands\n\n"}
8383
(eca/request! (fixture/initialize-request
8484
{:initializationOptions (merge fixture/default-init-options
85-
{:defaultModel "bar-2"
85+
{:defaultModel "myCustom/bar-2"
8686
:customProviders
8787
{"myCustom" {:api "openai"
8888
:urlEnv "MY_CUSTOM_API_URL"

src/eca/handlers.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424
(fn [models [custom-provider {provider-models :models}]]
2525
(reduce
2626
(fn [m model]
27-
(let [known-model (get all-models model)]
27+
(let [known-model (get all-models model)
28+
full-model (str (name custom-provider) "/" model)]
2829
(assoc m
29-
(str (name custom-provider) "/" model)
30+
full-model
3031
{:tools (or (:tools known-model) true)
3132
:reason? (or (:reason? known-model) true)
3233
:web-search (or (:web-search known-model) true)
3334
:max-output-tokens (:max-output-tokens known-model)
3435
:custom-provider? true
35-
:default-model? (= model (:defaultModel config))})))
36+
:default-model? (= full-model (:defaultModel config))})))
3637
models
3738
provider-models))
3839
{}

src/eca/llm_api.clj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,8 @@
6363
- Anthropic default model."
6464
[db config]
6565
(let [[decision model]
66-
(or (when-let [custom-provider-default-model (first (keep (fn [[model config]]
67-
(when (and (:custom-provider? config)
68-
(:default-model? config))
69-
model))
70-
(:models db)))]
71-
[:custom-provider-default-model custom-provider-default-model])
66+
(or (when-let [config-default-model (:defaultModel config)]
67+
[:config-default-model config-default-model])
7268
(when (provider-api-key "anthropic" config)
7369
[:api-key-found "anthropic/claude-sonnet-4-20250514"])
7470
(when (provider-api-key "openai" config)

test/eca/llm_api_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
(deftest default-model-test
1111
(testing "Custom provider default-model? present"
1212
(with-redefs [config/get-env (constantly nil)]
13-
(let [db {:models {"my-provider/my-model" {:custom-provider? true :default-model? true}}}
14-
config {}]
13+
(let [db {}
14+
config {:defaultModel "my-provider/my-model"}]
1515
(is (= "my-provider/my-model" (llm-api/default-model db config))))))
1616

1717
(testing "Ollama running model present"

0 commit comments

Comments
 (0)