Skip to content

Commit 1aa5ab7

Browse files
committed
Improve model capabilities for providers which model name has slash
1 parent c31bbf5 commit 1aa5ab7

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Improve read-file summary to show final range properly.
6+
- Improve model capabilities for providers which model name has slash: `my-provider/anthropic/my-model`
67

78
## 0.87.0
89

src/eca/llm_providers/openai_chat.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@
229229
(defn ^:private valid-message?
230230
"Check if a message should be included in the final output."
231231
[{:keys [role content tool_calls reasoning_content] :as _msg}]
232-
(and (or (= role "tool") ; Never remove tool messages
233-
(seq tool_calls) ; Keep messages with tool calls
234-
(seq reasoning_content) ; Keep messages with reasoning_content (DeepSeek)
235-
(and (string? content)
236-
(not (string/blank? content)))
237-
(sequential? content))))
232+
(or (= role "tool") ; Never remove tool messages
233+
(seq tool_calls) ; Keep messages with tool calls
234+
(seq reasoning_content) ; Keep messages with reasoning_content (DeepSeek)
235+
(and (string? content)
236+
(not (string/blank? content)))
237+
(sequential? content)))
238238

239239
(defn ^:private normalize-messages
240240
"Converts ECA message format to OpenAI API format (also used by compatible providers).

src/eca/models.clj

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@
9292
(or (get all-models full-real-model)
9393
;; we guess the capabilities from
9494
;; the first model with same name
95-
(when-let [found-full-model (first (filter #(= (shared/normalize-model-name real-model-name)
96-
(shared/normalize-model-name (second (string/split % #"/" 2))))
95+
(when-let [found-full-model (first (filter #(or (= (shared/normalize-model-name (string/replace-first real-model-name
96+
#"(.+/)"
97+
""))
98+
(shared/normalize-model-name (second (string/split % #"/" 2))))
99+
(= (shared/normalize-model-name real-model-name)
100+
(shared/normalize-model-name (second (string/split % #"/" 2)))))
97101
(keys all-models)))]
98102
(get all-models found-full-model))
99103
{:tools true
@@ -129,4 +133,9 @@
129133
(comment
130134
(require '[clojure.pprint :as pprint])
131135
(pprint/pprint (models-dev))
132-
(pprint/pprint (all)))
136+
(pprint/pprint (all))
137+
(require '[eca.db :as db])
138+
(sync-models! db/db*
139+
(config/all @db/db*)
140+
(fn [new-models]
141+
(pprint/pprint new-models))))

0 commit comments

Comments
 (0)