File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 2121 :output-token-cost (/ 8.0 one-million)}
2222 " gpt-4.1" {:tools true
2323 :web-search true
24+ :max-output-tokens 32000
2425 :input-token-cost (/ 2.0 one-million)
2526 :output-token-cost (/ 8.0 one-million)}
2627 " claude-sonnet-4-0" {:tools true
2728 :web-search true
29+ :max-output-tokens 8196
2830 :input-token-cost (/ 3.0 one-million)
2931 :output-token-cost (/ 15.0 one-million)}
3032 " claude-opus-4-0" {:tools true
3133 :web-search true
34+ :max-output-tokens 8196
3235 :input-token-cost (/ 15.0 one-million)
3336 :output-token-cost (/ 75.0 one-million)}
3437 " claude-3-5-haiku-latest" {:tools true
3538 :web-search true
39+ :max-output-tokens 4096
3640 :input-token-cost (/ 0.8 one-million)
3741 :output-token-cost (/ 4.0 one-million)}} ; ; + ollama local models + custom provider models
3842 :mcp-clients {}})
Original file line number Diff line number Diff line change 8686 tools (when (:tools model-config)
8787 (mapv tool->llm-tool tools))
8888 web-search (:web-search model-config)
89+ max-output-tokens (:max-output-tokens model-config)
8990 custom-providers (:customProviders config)
9091 custom-models (set (mapcat (fn [[k v]]
9192 (map #(str (name k) " /" %) (:models v)))
103104 {:model model
104105 :instructions instructions
105106 :user-prompt user-prompt
107+ :max-output-tokens max-output-tokens
106108 :past-messages past-messages
107109 :tools tools
108110 :web-search web-search
117119 {:model model
118120 :instructions instructions
119121 :user-prompt user-prompt
122+ :max-output-tokens max-output-tokens
120123 :past-messages past-messages
121124 :tools tools
122125 :web-search web-search
148151 {:model model
149152 :instructions instructions
150153 :user-prompt user-prompt
154+ :max-output-tokens max-output-tokens
151155 :past-messages past-messages
152156 :web-search web-search
153157 :tools tools
Original file line number Diff line number Diff line change 7676 #(assoc-in % [:content 0 :cache_control ] {:type " ephemeral" })))
7777
7878(defn completion!
79- [{:keys [model user-prompt temperature instructions max-tokens
79+ [{:keys [model user-prompt temperature instructions max-output- tokens
8080 api-url api-key past-messages tools web-search]
81- :or {max-tokens 8192
82- temperature 1.0 }}
81+ :or {temperature 1.0 }}
8382 {:keys [on-message-received on-error on-prepare-tool-call on-tool-called]}]
8483 (let [messages (conj (past-messages->messages past-messages)
8584 {:role " user" :content [{:type :text
8685 :text user-prompt}]})
8786 body {:model model
8887 :messages (add-cache-to-last-message messages)
89- :max_tokens max-tokens
88+ :max_tokens max-output- tokens
9089 :temperature temperature
9190 ; ; TODO support :thinking
9291 :stream true
Original file line number Diff line number Diff line change 44 [clojure.java.io :as io]
55 [eca.llm-util :as llm-util]
66 [eca.logger :as logger]
7+ [eca.shared :refer [assoc-some]]
78 [hato.client :as http]))
89
910(set! *warn-on-reflection* true )
5455 msg))
5556 past-messages))
5657
57- (defn completion! [{:keys [model user-prompt instructions temperature api-key api-url past-messages tools web-search]
58+ (defn completion! [{:keys [model user-prompt instructions temperature api-key api-url
59+ max-output-tokens past-messages tools web-search]
5860 :or {temperature 1.0 }}
5961 {:keys [on-message-received on-error on-prepare-tool-call on-tool-called on-reason]}]
6062 (let [input (conj (past-messages->input past-messages)
6769 :instructions instructions
6870 :temperature temperature
6971 :tools tools
70- :stream true }
72+ :stream true
73+ :max_completion_tokens max-output-tokens}
7174 mcp-call-by-item-id* (atom {})
7275 on-response-fn
7376 (fn handle-response [event data]
You can’t perform that action at this time.
0 commit comments