The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Add Claude Opus 5.5 and Sonnet 5.5 to Metabot (#83647)
Andrei Simionescu83f20bc0b599
diff --git a/docs/ai/providers.md b/docs/ai/providers.mdindex 712de864681..1f186b16105 100644--- a/docs/ai/providers.md+++ b/docs/ai/providers.md@@ -35,9 +35,11 @@ Supported models:| Claude Opus 4.7 | `claude-opus-4-7` | 1,000,000 || Claude Opus 4.8 | `claude-opus-4-8` | 1,000,000 || Claude Opus 5 | `claude-opus-5` | 1,000,000 |+| Claude Opus 5.5 | `claude-opus-5-5` | 1,000,000 || Claude Sonnet 4.5 | `claude-sonnet-4-5-20250929` | 200,000 || Claude Sonnet 4.6 | `claude-sonnet-4-6` | 1,000,000 || Claude Sonnet 5 | `claude-sonnet-5` | 1,000,000 |+| Claude Sonnet 5.5 | `claude-sonnet-5-5` | 1,000,000 |Credentials:@@ -214,8 +216,10 @@ Supported models:| Claude Haiku 4.5 | `anthropic/claude-haiku-4-5@20251001` || Claude Opus 4.6 | `anthropic/claude-opus-4-6` || Claude Opus 5 | `anthropic/claude-opus-5` |+| Claude Opus 5.5 | `anthropic/claude-opus-5-5` || Claude Sonnet 4.6 | `anthropic/claude-sonnet-4-6` || Claude Sonnet 5 | `anthropic/claude-sonnet-5` |+| Claude Sonnet 5.5 | `anthropic/claude-sonnet-5-5` || Gemini 3.5 Flash | `google/gemini-3.5-flash` || Gemini 3.6 Flash | `google/gemini-3.6-flash` || Gemini 3.7 Flash | `google/gemini-3.7-flash` |@@ -267,19 +271,21 @@ Credentials:Supported models:-| Model | Model ID | Context window (tokens) |-| -------------------- | ---------------------------- | ----------------------- |-| Claude Fable 5 | `anthropic.claude-fable-5` | 1,000,000 |-| Claude Haiku 4.5 | `anthropic.claude-haiku-4-5` | 200,000 |-| Claude Opus 4.7 | `anthropic.claude-opus-4-7` | 1,000,000 |-| Claude Opus 4.8 | `anthropic.claude-opus-4-8` | 1,000,000 |-| Claude Opus 5 | `anthropic.claude-opus-5` | 1,000,000 |-| Claude Sonnet 5 | `anthropic.claude-sonnet-5` | 1,000,000 |-| GPT-5.4 | `openai.gpt-5.4` | 272,000 |-| GPT-5.4 (2026-03-05) | `openai.gpt-5.4-2026-03-05` | 272,000 |-| GPT-5.5 | `openai.gpt-5.5` | 272,000 |-| GPT-5.5 (2026-04-23) | `openai.gpt-5.5-2026-04-23` | 272,000 |-| GPT-6 Astra | `openai.gpt-6-astra` | 922,000 |+| Model | Model ID | Context window (tokens) |+| -------------------- | ----------------------------- | ----------------------- |+| Claude Fable 5 | `anthropic.claude-fable-5` | 1,000,000 |+| Claude Haiku 4.5 | `anthropic.claude-haiku-4-5` | 200,000 |+| Claude Opus 4.7 | `anthropic.claude-opus-4-7` | 1,000,000 |+| Claude Opus 4.8 | `anthropic.claude-opus-4-8` | 1,000,000 |+| Claude Opus 5 | `anthropic.claude-opus-5` | 1,000,000 |+| Claude Opus 5.5 | `anthropic.claude-opus-5-5` | 1,000,000 |+| Claude Sonnet 5 | `anthropic.claude-sonnet-5` | 1,000,000 |+| Claude Sonnet 5.5 | `anthropic.claude-sonnet-5-5` | 1,000,000 |+| GPT-5.4 | `openai.gpt-5.4` | 272,000 |+| GPT-5.4 (2026-03-05) | `openai.gpt-5.4-2026-03-05` | 272,000 |+| GPT-5.5 | `openai.gpt-5.5` | 272,000 |+| GPT-5.5 (2026-04-23) | `openai.gpt-5.5-2026-04-23` | 272,000 |+| GPT-6 Astra | `openai.gpt-6-astra` | 922,000 |Credentials:diff --git a/src/metabase/llm/provider.clj b/src/metabase/llm/provider.cljindex 6340ce67a6b..6d3ce6bafe1 100644--- a/src/metabase/llm/provider.clj+++ b/src/metabase/llm/provider.clj@@ -215,8 +215,10 @@{:id "google/gemini-3.6-flash" :display_name "Gemini 3.6 Flash"}{:id "google/gemini-3.7-flash" :display_name "Gemini 3.7 Flash"}{:id "anthropic/claude-fable-5" :display_name "Claude Fable 5"}+ {:id "anthropic/claude-opus-5-5" :display_name "Claude Opus 5.5"}{:id "anthropic/claude-opus-5" :display_name "Claude Opus 5"}{:id "anthropic/claude-opus-4-6" :display_name "Claude Opus 4.6"}+ {:id "anthropic/claude-sonnet-5-5" :display_name "Claude Sonnet 5.5"}{:id "anthropic/claude-sonnet-5" :display_name "Claude Sonnet 5"}{:id "anthropic/claude-sonnet-4-6" :display_name "Claude Sonnet 4.6"}{:id "anthropic/claude-haiku-4-5@20251001" :display_name "Claude Haiku 4.5"}]diff --git a/src/metabase/metabot/agent/core.clj b/src/metabase/metabot/agent/core.cljindex 8f5643184b0..00b3b0c7af2 100644--- a/src/metabase/metabot/agent/core.clj+++ b/src/metabase/metabot/agent/core.clj@@ -21,6 +21,7 @@[metabase.metabot.schema :as metabot.schema][metabase.metabot.scope :as scope][metabase.metabot.self :as self]+ [metabase.metabot.self.schema :as self.schema][metabase.metabot.tools :as tools][metabase.util :as u][metabase.util.json :as json]@@ -265,16 +266,21 @@(update links-key links/invert-slack-links registry-map)))))parts)))+(defn- turn-input-parts+ "The AISDK parts for this call of the turn: what the previous call sent, exactly as sent, then the parts added since.+ Rebuilding the history fetches the viewing context again and inverts links against a registry that grows within+ the turn, and Claude Opus and Sonnet 5.5 reject a replayed thinking block once anything before it has changed."+ [sent-parts context memory link-registry]+ (into sent-parts+ (invert-links (subvec (messages/build-message-history context memory) (count sent-parts))+ link-registry)))+(defn- call-llm"Call the LLM and stream processed parts.- Builds AISDK parts from memory and passes them to the adapter which converts- them to its native wire format."- [memory context profile tools iteration tracking-opts link-registry-atom]+ Passes the AISDK `input-parts` to the adapter, which converts them to its native wire format."+ [memory profile tools system-msg iteration tracking-opts link-registry-atom input-parts](let [model (:model profile)- system-msg (messages/build-system-message context profile tools)- input-parts (-> (messages/build-message-history context memory)- (invert-links @link-registry-atom))llm-opts (cond-> {}(:required-tool-call? profile) (assoc :tool-choice "required"))](when *debug-log*@@ -476,7 +482,11 @@:type :metabot/permission-denied}))))(defn- init-agent- "Initialize agent state."+ "Initialize agent state.++ The system message and the tool declarations are rendered once for the whole turn. Both read settings or status+ that can change mid-turn, and a change would invalidate replayed thinking the same way an edited earlier message+ does (see [[turn-input-parts]])."[{:keys [messages state metabot-id profile-id context tracking-opts conversation-id]external-memory-atom :memory-atom}](let [context (assign-context-ids context)@@ -494,13 +504,15 @@(assoc :conversation-id conversation-id)(memory/add-client-ids (client-content-ids context)))memory-atom (doto (or external-memory-atom (atom nil)) (reset! memory))- tools (tools/wrap-tools-with-state base-tools memory-atom metabot-id profile-id)]+ tools (update-vals (tools/wrap-tools-with-state base-tools memory-atom metabot-id profile-id)+ #(assoc % :declaration (delay (self.schema/tool-function %))))](log/info "Starting agent" {:profile profile-id:tools (count tools):max-iter (:max-iterations profile):msgs (count messages)}){:profile profile:tools tools+ :system-msg (messages/build-system-message context profile tools):context context:memory-atom memory-atom:tracking-opts (merge {:profile-id profile-id@@ -519,7 +531,8 @@:result init:iteration 1:status :continue- :usage-atom usage-atom})+ :usage-atom usage-atom+ :sent-parts []})(defn- final-state-part [memory]{:type :data, :data-type "state", :version 1, :data (memory/get-state memory)})@@ -560,16 +573,17 @@Streams parts to the consumer as they arrive while simultaneously accumulatingthem for memory updates and control flow decisions."- [{:keys [agent rf result iteration usage-atom] :as loop-state}]+ [{:keys [agent rf result iteration usage-atom sent-parts] :as loop-state}](with-span :debug {:name :metabot.agent/loop-step:iteration iteration}- (let [{:keys [profile tools context memory-atom tracking-opts]} agent+ (let [{:keys [profile tools system-msg context memory-atom tracking-opts]} agentmax-iter (:max-iterations profile 15)terminal-tools (set (:terminal-tools profile))tracking-opts (assoc tracking-opts :iteration iteration)memory @memory-atomparts-atom (atom [])link-registry-atom (atom (get-in memory [:state :link-registry] {}))+ input-parts (turn-input-parts sent-parts context memory @link-registry-atom)xf (comp (accumulate-usage-xf usage-atom (:model profile))(u/tee-xf parts-atom));; We use `reduce` instead of `transduce` because rf is the outer reducing@@ -579,8 +593,8 @@;; `call-llm` runs inside the eval span so the request attrs it records attach here.result' (ait/with-llm-call {:ai/iteration iteration:ai/model (:model profile)}- (let [llm-call (call-llm memory context profile tools iteration- tracking-opts link-registry-atom)+ (let [llm-call (call-llm memory profile tools system-msg iteration+ tracking-opts link-registry-atom input-parts)reduced-result (reduce (xf rf) result llm-call)](when (ait/capture-active?)(ait/record! {:ai/output-text (collect-text-from-parts @parts-atom)@@ -625,7 +639,7 @@:result (rf result'' (final-state-part @memory-atom))))))(should-continue? iteration max-iter terminal-tools parts)- (assoc loop-state :result result' :iteration (inc iteration))+ (assoc loop-state :result result' :iteration (inc iteration) :sent-parts input-parts):else(let [reason (finish-reason iteration max-iter terminal-tools parts)]diff --git a/src/metabase/metabot/self/azure.clj b/src/metabase/metabot/self/azure.cljindex 284af0c926f..ea9809ae36b 100644--- a/src/metabase/metabot/self/azure.clj+++ b/src/metabase/metabot/self/azure.clj@@ -77,12 +77,14 @@GPT values are max input tokens (Microsoft's listed windows are input + output totals):https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure"{"claude-fable-5" 1000000+ "claude-opus-5-5" 1000000"claude-opus-5" 1000000"claude-opus-4-8" 1000000"claude-opus-4-7" 1000000"claude-opus-4-6" 1000000"claude-opus-4-5" 200000"claude-opus-4-1" 200000+ "claude-sonnet-5-5" 1000000"claude-sonnet-5" 1000000"claude-sonnet-4-6" 1000000"claude-sonnet-4-5" 200000diff --git a/src/metabase/metabot/self/bedrock.clj b/src/metabase/metabot/self/bedrock.cljindex 256a137f031..8de32c5c56c 100644--- a/src/metabase/metabot/self/bedrock.clj+++ b/src/metabase/metabot/self/bedrock.clj@@ -320,18 +320,20 @@`list-models` returns the intersection of this map with the mantle `/v1/models` catalog.Excludes `openai.gpt-oss*`, which are not invokable through the mantle `/openai/v1` routes.Context windows are from the per-model cards at https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards.html"- {"anthropic.claude-fable-5" {:display-name "Claude Fable 5" :context-window 1000000}- "anthropic.claude-opus-5" {:display-name "Claude Opus 5" :context-window 1000000}- "anthropic.claude-opus-4-8" {:display-name "Claude Opus 4.8" :context-window 1000000}- "anthropic.claude-opus-4-7" {:display-name "Claude Opus 4.7" :context-window 1000000}- "anthropic.claude-sonnet-5" {:display-name "Claude Sonnet 5" :context-window 1000000}- "anthropic.claude-haiku-4-5" {:display-name "Claude Haiku 4.5" :context-window 200000}+ {"anthropic.claude-fable-5" {:display-name "Claude Fable 5" :context-window 1000000}+ "anthropic.claude-opus-5-5" {:display-name "Claude Opus 5.5" :context-window 1000000}+ "anthropic.claude-opus-5" {:display-name "Claude Opus 5" :context-window 1000000}+ "anthropic.claude-opus-4-8" {:display-name "Claude Opus 4.8" :context-window 1000000}+ "anthropic.claude-opus-4-7" {:display-name "Claude Opus 4.7" :context-window 1000000}+ "anthropic.claude-sonnet-5-5" {:display-name "Claude Sonnet 5.5" :context-window 1000000}+ "anthropic.claude-sonnet-5" {:display-name "Claude Sonnet 5" :context-window 1000000}+ "anthropic.claude-haiku-4-5" {:display-name "Claude Haiku 4.5" :context-window 200000};; Astra's input window is its 1,050,000 token context minus up to 128,000 output tokens.- "openai.gpt-6-astra" {:display-name "GPT-6 Astra" :context-window 922000}- "openai.gpt-5.4" {:display-name "GPT-5.4" :context-window 272000}- "openai.gpt-5.4-2026-03-05" {:display-name "GPT-5.4 (2026-03-05)" :context-window 272000}- "openai.gpt-5.5" {:display-name "GPT-5.5" :context-window 272000}- "openai.gpt-5.5-2026-04-23" {:display-name "GPT-5.5 (2026-04-23)" :context-window 272000}})+ "openai.gpt-6-astra" {:display-name "GPT-6 Astra" :context-window 922000}+ "openai.gpt-5.4" {:display-name "GPT-5.4" :context-window 272000}+ "openai.gpt-5.4-2026-03-05" {:display-name "GPT-5.4 (2026-03-05)" :context-window 272000}+ "openai.gpt-5.5" {:display-name "GPT-5.5" :context-window 272000}+ "openai.gpt-5.5-2026-04-23" {:display-name "GPT-5.5 (2026-04-23)" :context-window 272000}})(mu/defn context-window-tokens :- [:maybe :int]"The input context window for `model`, or nil when it isn't one we know."diff --git a/src/metabase/metabot/self/claude.clj b/src/metabase/metabot/self/claude.cljindex e455e2ab65f..82e36c9ecb2 100644--- a/src/metabase/metabot/self/claude.clj+++ b/src/metabase/metabot/self/claude.clj@@ -348,12 +348,14 @@"Anthropic chat models offered in the Metabot model picker, keyed by model id.`list-models` returns the intersection of this map with the account's `/v1/models` catalog."{"claude-fable-5" {:display-name "Claude Fable 5" :max-tokens 128000 :context-window 1000000}+ "claude-opus-5-5" {:display-name "Claude Opus 5.5" :max-tokens 128000 :context-window 1000000}"claude-opus-5" {:display-name "Claude Opus 5" :max-tokens 128000 :context-window 1000000}"claude-opus-4-8" {:display-name "Claude Opus 4.8" :max-tokens 128000 :context-window 1000000}"claude-opus-4-7" {:display-name "Claude Opus 4.7" :max-tokens 128000 :context-window 1000000}"claude-opus-4-6" {:display-name "Claude Opus 4.6" :max-tokens 128000 :context-window 1000000}"claude-opus-4-5-20251101" {:display-name "Claude Opus 4.5" :max-tokens 64000 :context-window 200000}"claude-opus-4-1-20250805" {:display-name "Claude Opus 4.1" :max-tokens 32000 :context-window 200000}+ "claude-sonnet-5-5" {:display-name "Claude Sonnet 5.5" :max-tokens 128000 :context-window 1000000}"claude-sonnet-5" {:display-name "Claude Sonnet 5" :max-tokens 128000 :context-window 1000000}"claude-sonnet-4-6" {:display-name "Claude Sonnet 4.6" :max-tokens 128000 :context-window 1000000}"claude-sonnet-4-5-20250929" {:display-name "Claude Sonnet 4.5" :max-tokens 64000 :context-window 200000}@@ -392,12 +394,13 @@(get-in supported-models [(strip-vendor-prefix model) :context-window]))(defn- claude-model-version- "`[family major minor]` for a Claude opus/sonnet model id, or nil."+ "`[family major minor]` for a Claude opus/sonnet model id, or nil.+ The minor version is one or two digits, so a date suffix doesn't read as one: `claude-opus-5-20261005` is 5.0."[model];; the minor version accepts both separators: canonical ids are hyphenated (claude-opus-4-8);; but Azure admins name deployments freely, and the dotted display-name spelling;; (claude-opus-4.8) is the norm for the GPT family next to it- (when-let [[_ family major minor] (re-find #"^claude-(opus|sonnet)-(\d+)(?:[-.](\d+))?"+ (when-let [[_ family major minor] (re-find #"^claude-(opus|sonnet)-(\d+)(?:[-.](\d{1,2})(?!\d))?"(strip-vendor-prefix model))][family (parse-long major) (or (some-> minor parse-long) 0)]))@@ -417,6 +420,19 @@[model](not (model-current-gen? model)))+(defn- model-supports-forced-tool-choice?+ "Whether `model` accepts a forced `tool_choice` (`any`, or a named tool). Opus and Sonnet reject one from 5.5 on."+ [model]+ (if-let [[_ major minor] (claude-model-version model)]+ (or (< major 5) (and (= major 5) (< minor 5)))+ true))++(def ^:private unforced-structured-output-token-floor+ "Smallest `max_tokens` for structured output on a model that can't be forced to call the tool.+ It answers under `auto` after thinking first, which bills against the same cap. The value is the floor the other+ adapters give thinking-only models."+ 2048)+(defn- model-thinking-config"Thinking config that streams reasoning for `model`, or nil where we don't enableit (older budget-token models — off in v1)."@@ -438,7 +454,7 @@(def ^:private fast-mode-models"The models Anthropic documents fast mode for: https://code.claude.com/docs/en/fast-mode"- #{"claude-opus-4-8" "claude-opus-5"})+ #{"claude-opus-4-8" "claude-opus-5" "claude-opus-5-5"})(defn fast-mode-model?"Whether `model` supports Anthropic fast mode. Never through the AI proxy: fast mode is premium-priced,@@ -460,10 +476,12 @@restrictions, which the model-id-derived config and the suppression rules below cannot describe."[{:keys [model system input tools schema tool_choice temperature max-tokens reasoning? reasoning-config fast? ai-proxy?]:or {model default-model reasoning? true}} :- core/LLMRequestOpts]- (let [;; forced tool choice (structured output, or "required") is incompatible+ (let [forced? (and (or schema (= "required" (some-> tool_choice name)))+ (model-supports-forced-tool-choice? model))+ ;; forced tool choice (structured output, or "required") is incompatible;; with thinking — suppress it there.thinking (or reasoning-config- (when-not (or (not reasoning?) schema (= "required" (some-> tool_choice name)))+ (when (and reasoning? (not forced?))(model-thinking-config model)))fast? (and fast? (fast-mode-model? model ai-proxy?))input (cond->> input@@ -480,16 +498,21 @@:messages messages}system (assoc :system (system->cached-content-blocks system))all-tools (assoc :tools all-tools)- schema (assoc :tool_choice {:type "tool"- :name "structured_output"}+ schema (assoc :tool_choice (if forced?+ {:type "tool"+ :name "structured_output"}+ {:type "auto"}):tools [{:name "structured_output":description "Output structured data":input_schema schema}])+ (and schema max-tokens (not forced?))+ (update :max_tokens max unforced-structured-output-token-floor)+(and all-tools tool_choice)(assoc :tool_choice (case (name tool_choice)"auto" {:type "auto"}- "required" {:type "any"}))+ "required" (if forced? {:type "any"} {:type "auto"})))thinking (assoc :thinking thinking)diff --git a/src/metabase/metabot/self/core.clj b/src/metabase/metabot/self/core.cljindex a66e8b91147..edd2d967962 100644--- a/src/metabase/metabot/self/core.clj+++ b/src/metabase/metabot/self/core.clj@@ -76,6 +76,7 @@[:tool-name :string][:doc {:optional true} [:maybe :string]][:schema MalliSchema]+ [:declaration {:optional true} [:maybe [:fn delay?]]][:fn [:fn fn?]][:decode {:optional true} [:maybe [:fn fn?]]][:prompt {:optional true} [:maybe :string]]diff --git a/src/metabase/metabot/self/google/raw_predict.clj b/src/metabase/metabot/self/google/raw_predict.cljindex f873f8488b8..b5853bfa60e 100644--- a/src/metabase/metabot/self/google/raw_predict.clj+++ b/src/metabase/metabot/self/google/raw_predict.clj@@ -31,7 +31,7 @@(mu/defn request-body"Build the streamRawPredict request body for an LLM request on `model-id`."[model-id :- [:maybe :string] opts :- core/LLMRequestOpts]- (-> (claude/claude-request-body (assoc opts :model (direct-api-model-id model-id)))+ (-> (claude/claude-request-body (assoc opts :model (direct-api-model-id model-id) :fast? false))(dissoc :model)(assoc :anthropic_version anthropic-version)))diff --git a/src/metabase/metabot/self/schema.clj b/src/metabase/metabot/self/schema.cljindex 99552230b0e..148d6eb3921 100644--- a/src/metabase/metabot/self/schema.clj+++ b/src/metabase/metabot/self/schema.clj@@ -47,14 +47,17 @@`{:name ... :description ... :parameters <JSON Schema>}`. Adapters wrap this in their provider's envelope.Filters feature-gated properties from the parameter schema (see [[filter-schema-by-features]]) and strips the- `Inputs: ...` block that `mu/defn` appends to the docstring."- [{:keys [tool-name doc schema]}]- (let [[_:=> [_:cat params] _out] schema- params (filter-schema-by-features params)- doc (if (str/starts-with? (or doc "") "Inputs: ")- ;; Strip the text that mu/defn adds.- (second (str/split doc #"\n\n " 2))- doc)]- {:name tool-name- :description doc- :parameters (mjs/transform params {:additionalProperties false})}))+ `Inputs: ...` block that `mu/defn` appends to the docstring. An entry carrying a `:declaration` delay, which the+ agent creates once per turn, returns its value instead."+ [{:keys [tool-name doc schema declaration]}]+ (if declaration+ @declaration+ (let [[_:=> [_:cat params] _out] schema+ params (filter-schema-by-features params)+ doc (if (str/starts-with? (or doc "") "Inputs: ")+ ;; Strip the text that mu/defn adds.+ (second (str/split doc #"\n\n " 2))+ doc)]+ {:name tool-name+ :description doc+ :parameters (mjs/transform params {:additionalProperties false})})))diff --git a/test/metabase/llm/api/provider_test.clj b/test/metabase/llm/api/provider_test.cljindex d8ff9b0a493..4c1894bc279 100644--- a/test/metabase/llm/api/provider_test.clj+++ b/test/metabase/llm/api/provider_test.clj@@ -150,8 +150,10 @@{:id "google/gemini-3.6-flash" :display_name "Gemini 3.6 Flash"}{:id "google/gemini-3.7-flash" :display_name "Gemini 3.7 Flash"}{:id "anthropic/claude-fable-5" :display_name "Claude Fable 5"}+ {:id "anthropic/claude-opus-5-5" :display_name "Claude Opus 5.5"}{:id "anthropic/claude-opus-5" :display_name "Claude Opus 5"}{:id "anthropic/claude-opus-4-6" :display_name "Claude Opus 4.6"}+ {:id "anthropic/claude-sonnet-5-5" :display_name "Claude Sonnet 5.5"}{:id "anthropic/claude-sonnet-5" :display_name "Claude Sonnet 5"}{:id "anthropic/claude-sonnet-4-6" :display_name "Claude Sonnet 4.6"}{:id "anthropic/claude-haiku-4-5@20251001" :display_name "Claude Haiku 4.5"}]@@ -1263,8 +1265,10 @@{:id "google/gemini-3.6-flash" :display_name "Gemini 3.6 Flash"}{:id "google/gemini-3.7-flash" :display_name "Gemini 3.7 Flash"}{:id "anthropic/claude-fable-5" :display_name "Claude Fable 5"}+ {:id "anthropic/claude-opus-5-5" :display_name "Claude Opus 5.5"}{:id "anthropic/claude-opus-5" :display_name "Claude Opus 5"}{:id "anthropic/claude-opus-4-6" :display_name "Claude Opus 4.6"}+ {:id "anthropic/claude-sonnet-5-5" :display_name "Claude Sonnet 5.5"}{:id "anthropic/claude-sonnet-5" :display_name "Claude Sonnet 5"}{:id "anthropic/claude-sonnet-4-6" :display_name "Claude Sonnet 4.6"}{:id "anthropic/claude-haiku-4-5@20251001" :display_name "Claude Haiku 4.5"}]}]@@ -1284,7 +1288,7 @@:project-id "my-project":location "us-east5":probed-model "anthropic/claude-sonnet-4-6"})]]- (is (=? [{:key "claude-only" :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some?]}]+ (is (=? [{:key "claude-only" :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some? some? some?]}](mt/user-http-request :crowberto :get 200 "llm/models")))(is (= "anthropic/claude-sonnet-4-6" @probed)))))))@@ -1328,7 +1332,7 @@:project-id "my-project"})]](mt/with-temporary-raw-setting-values [llm-metabot-provider "wrong-model-google/anthropic/claude-opus-5"](is (=? [{:key "wrong-model-google"- :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some?]+ :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some? some? some?]:error "Google API error: model not found"}](mt/user-http-request :crowberto :get 200 "llm/models"))))))))@@ -1344,7 +1348,7 @@:project-id "my-project"})]](mt/with-temporary-raw-setting-values [llm-metabot-provider "forbidden-model-google/anthropic/claude-opus-5"](is (=? [{:key "forbidden-model-google"- :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some?]+ :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some? some? some?]:error "Google API error: PERMISSION_DENIED"}](mt/user-http-request :crowberto :get 200 "llm/models"))))))))@@ -1361,7 +1365,7 @@(is (=? [{:key "bad-key-google":name "bad-key-google":type "google"- :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some?]+ :models [{:id "google/gemini-3.5-flash"} some? some? some? some? some? some? some? some? some? some?]:error "Google API error: invalid authentication credentials"}](mt/user-http-request :crowberto :get 200 "llm/models")))))))diff --git a/test/metabase/metabot/agent/core_test.clj b/test/metabase/metabot/agent/core_test.cljindex 5a12627b22c..6aab4b461b3 100644--- a/test/metabase/metabot/agent/core_test.clj+++ b/test/metabase/metabot/agent/core_test.clj@@ -18,7 +18,9 @@[metabase.metabot.self :as self][metabase.metabot.self.claude :as claude][metabase.metabot.self.core :as self.core]+ [metabase.metabot.self.features :as features][metabase.metabot.self.openrouter :as openrouter]+ [metabase.metabot.settings :as metabot.settings][metabase.metabot.test-util :as mut][metabase.metabot.tools.search :as metabot-search][metabase.permissions.core :as perms]@@ -725,6 +727,46 @@(is (=? {:type :text :text "The orders table has what you need."}(last (filter #(= :text (:type %)) result)))))))))))+(deftest later-calls-resend-what-the-turn-already-sent-test+ (testing "edits made during a turn don't change the system prompt, tools or messages its earlier calls sent"+ (mt/with-temp [:model/Dashboard {dashboard-id :id} {:name "Ops original"}]+ (mt/as-admin+ (mt/with-premium-features #{:ai-controls}+ (mt/with-temporary-setting-values [llm-providers llm.tu/default-connections+ llm-metabot-provider "anthropic/claude-opus-5-5"+ metabot-chat-system-prompt "Use British spelling."]+ (let [requests (atom [])+ semantic-search (atom true)]+ (mt/with-dynamic-fn-redefs [features/feature-available? (fn [_] @semantic-search)+ claude/claude+ (fn [opts]+ (if (= 1 (count (swap! requests conj (claude/claude-request-body opts))))+ (do (t2/update! :model/Dashboard dashboard-id {:name "Ops updated"})+ (metabot.settings/metabot-chat-system-prompt! "Use American spelling.")+ (reset! semantic-search false)+ (mut/mock-llm-response [{:type :tool-input+ :id "call-1"+ :function "load_skill"+ :arguments {:ids ["read-resource"]}}]))+ (mut/mock-llm-response [{:type :text :text "Done."}])))]+ (into [] (agent/run-agent-loop+ {:messages [{:role :user :content "Help me with this dashboard."}]+ :state {}+ :profile-id :internal+ :context {:current_user_time "2026-10-05T12:00:00Z"+ :user_is_viewing [{:type "dashboard" :id dashboard-id}]}}))+ (let [[{system-1 :system tools-1 :tools messages-1 :messages}+ {system-2 :system tools-2 :tools messages-2 :messages}] @requests]+ (is (str/includes? (pr-str system-1) "Use British spelling."))+ (is (str/includes? (pr-str tools-1) "semantic_queries"))+ (is (str/includes? (pr-str messages-1) "Ops original"))+ (is (= system-1 system-2))+ (is (= tools-1 tools-2))+ (is (= messages-1 (take (count messages-1) messages-2)))+ (is (=? [{:role "assistant" :content [{:type "tool_use" :name "load_skill"}]}+ {:role "user" :content [{:type "tool_result"}]}]+ (drop (count messages-1) messages-2))))))))))))+(deftest eval-tracing-nesting-test(testing "capture-reducible over the real agent loop builds a turn -> llm -> tool span tree";; This exercises the cross-module wiring the ai-tracing docstrings promise: the turn/llm spansdiff --git a/test/metabase/metabot/self/azure_test.clj b/test/metabase/metabot/self/azure_test.cljindex 04e9e20de86..5941b8ed236 100644--- a/test/metabase/metabot/self/azure_test.clj+++ b/test/metabase/metabot/self/azure_test.clj@@ -215,6 +215,8 @@(deftest ^:parallel reasoning-model?-test(are [model expected] (= expected (azure/reasoning-model? model))+ "anthropic/claude-opus-5-5" true+ "anthropic/claude-sonnet-5-5" true"anthropic/claude-opus-5" true"anthropic/claude-opus-4-8" true;; dotted display-name spelling parses the same — deployment names are admin free textdiff --git a/test/metabase/metabot/self/bedrock_test.clj b/test/metabase/metabot/self/bedrock_test.cljindex fc3257af7fe..4dd8c52925c 100644--- a/test/metabase/metabot/self/bedrock_test.clj+++ b/test/metabase/metabot/self/bedrock_test.clj@@ -46,8 +46,9 @@(deftest ^:parallel supported-models-test(testing "whitelisted models are supported"- (doseq [id ["anthropic.claude-fable-5" "anthropic.claude-opus-5" "anthropic.claude-opus-4-8"- "anthropic.claude-sonnet-5" "openai.gpt-5.5" "openai.gpt-6-astra"]]+ (doseq [id ["anthropic.claude-fable-5" "anthropic.claude-opus-5-5" "anthropic.claude-opus-5"+ "anthropic.claude-opus-4-8" "anthropic.claude-sonnet-5-5" "anthropic.claude-sonnet-5"+ "openai.gpt-5.5" "openai.gpt-6-astra"]](is (contains? bedrock/supported-models id) id)))(testing "non-whitelisted models are not supported, even for supported vendors"(doseq [id ["anthropic.claude-3-5-sonnet" "openai.gpt-oss-120b"@@ -590,6 +591,7 @@(are [model reasoning? context-window] (= [reasoning? context-window][(bedrock/reasoning-model? model) (bedrock/context-window-tokens model)])"eu.anthropic.claude-sonnet-4-6" true 1000000+ "global.anthropic.claude-sonnet-5-5" true 1000000"global.anthropic.claude-haiku-4-5-20251001-v1:0" false 200000profile-arn true 1000000"arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abcdef123456" false nil))diff --git a/test/metabase/metabot/self/claude_test.clj b/test/metabase/metabot/self/claude_test.cljindex 47707a04c9b..a8429f83a67 100644--- a/test/metabase/metabot/self/claude_test.clj+++ b/test/metabase/metabot/self/claude_test.clj@@ -325,6 +325,7 @@(let [input [{:role :user :content "hi"}]speed #(:speed (claude/claude-request-body (merge {:input input} %)))](testing ":fast? requests fast mode on models that support it"+ (is (= "fast" (speed {:model "claude-opus-5-5" :fast? true})))(is (= "fast" (speed {:model "claude-opus-5" :fast? true})))(is (= "fast" (speed {:model "claude-opus-4-8" :fast? true}))))(testing "no speed without :fast?"@@ -645,6 +646,33 @@:tools [(metabot.tu/get-time-tool)]:tool_choice "required"})))))))+(deftest ^:parallel forced-tool-choice-test+ (let [schema {:type "object" :properties {:answer {:type "string"}}}+ tools [(metabot.tu/get-time-tool)]+ body #(claude/claude-request-body (merge {:input [{:role :user :content "hi"}]} %))]+ (testing "structured output and a required tool choice force the call, including on date-suffixed 5.0 names"+ (doseq [model ["claude-opus-5" "claude-sonnet-5" "claude-opus-5-20261005" "claude-sonnet-5-2026-10-05"]]+ (testing model+ (is (=? {:tool_choice {:type "tool" :name "structured_output"} :max_tokens 512}+ (body {:model model :schema schema :max-tokens 512})))+ (is (=? {:tool_choice {:type "any"}}+ (body {:model model :tools tools :tool_choice "required"}))))))+ (testing "Opus and Sonnet from 5.5 reject a forced tool choice, so they get auto and keep thinking"+ (doseq [model ["claude-opus-5-5" "claude-sonnet-5-5" "anthropic.claude-sonnet-5-5" "claude-opus-5.5"+ "claude-opus-5-5-20261005" "claude-sonnet-5-5-2026-10-05"]]+ (testing model+ (is (=? {:tool_choice {:type "auto"}+ :tools [{:name "structured_output"}]+ :thinking {:type "adaptive"}}+ (body {:model model :schema schema})))+ (is (=? {:tool_choice {:type "auto"} :thinking {:type "adaptive"}}+ (body {:model model :tools tools :tool_choice "required"}))))))+ (testing "their structured-output cap is floored, since the thinking bills against it"+ (are [expected opts] (= expected (:max_tokens (body (assoc opts :model "claude-opus-5-5"))))+ 2048 {:schema schema :max-tokens 512}+ 4096 {:schema schema :max-tokens 4096}+ 512 {:max-tokens 512}))))+(deftest ^:parallel every-supported-model-has-a-ceiling-test(doseq [[id {:keys [display-name max-tokens]}] @#'claude/supported-models](is (pos-int? max-tokens) id)@@ -816,7 +844,8 @@(deftest ^:parallel supported-models-test(testing "whitelisted models are supported"- (doseq [id ["claude-fable-5" "claude-opus-5" "claude-opus-4-8" "claude-sonnet-5" "claude-haiku-4-5-20251001"]]+ (doseq [id ["claude-fable-5" "claude-opus-5-5" "claude-opus-5" "claude-opus-4-8" "claude-sonnet-5-5" "claude-sonnet-5"+ "claude-haiku-4-5-20251001"]](is (contains? claude/supported-models id) id)))(testing "non-whitelisted models are not supported"(doseq [id ["claude-3-5-sonnet-20241022" "claude-opus-4-0" "claude-sonnet-4-20250514"]]@@ -839,13 +868,13 @@(deftest ^:parallel model-supports-temperature?-test(testing "models that accept an explicit temperature"(doseq [model ["claude-haiku-4-5" "claude-sonnet-4-6" "claude-sonnet-4-5"- "claude-opus-4-5" "claude-opus-4-6" "claude-opus-4-1"]]+ "claude-opus-4-5" "claude-opus-4-6" "claude-opus-4-1" "claude-opus-4-20250514"]](is (true? (#'claude/model-supports-temperature? model))model)))(testing "sampling parameters were removed starting with Opus 4.7, Sonnet 5, and on Fable models"(doseq [model ["claude-opus-4-7" "claude-opus-4-8" "claude-opus-4-8-20260415"- "claude-opus-5" "claude-opus-5-0"- "claude-sonnet-5" "claude-sonnet-5-0" "claude-sonnet-6"+ "claude-opus-5" "claude-opus-5-0" "claude-opus-5-5"+ "claude-sonnet-5" "claude-sonnet-5-0" "claude-sonnet-5-5" "claude-sonnet-6""claude-fable-5"]](is (false? (#'claude/model-supports-temperature? model))model))))diff --git a/test/metabase/metabot/self/google/raw_predict_test.clj b/test/metabase/metabot/self/google/raw_predict_test.cljindex 87155a58789..d30bd348c0a 100644--- a/test/metabase/metabot/self/google/raw_predict_test.clj+++ b/test/metabase/metabot/self/google/raw_predict_test.clj@@ -34,6 +34,13 @@{:system "You are terse.":input [{:role :user :content "hi"}]})))))+(deftest ^:parallel request-body-never-asks-for-fast-mode-test+ (testing "fast mode is only on the Claude API, so a request made with it on goes to the platform at standard speed"+ (is (not (contains? (raw-predict/request-body "claude-opus-5-5"+ {:fast? true+ :input [{:role :user :content "hi"}]})+ :speed)))))+(deftest ^:parallel request-body-dated-model-resolves-max-tokens-test(testing "a model dated in the platform's `@` spelling resolves to the same max_tokens ceiling as itsdirect-API `-` spelling, rather than falling back to the unknown-model default"diff --git a/test/metabase/metabot/self/google_test.clj b/test/metabase/metabot/self/google_test.cljindex 95263afa039..ebaf1dede8b 100644--- a/test/metabase/metabot/self/google_test.clj+++ b/test/metabase/metabot/self/google_test.clj@@ -80,8 +80,10 @@including when the platform dates it in the `@` spelling"(are [model window] (= window (google/context-window-tokens model))"anthropic/claude-fable-5" 1000000+ "anthropic/claude-opus-5-5" 1000000"anthropic/claude-opus-5" 1000000"anthropic/claude-opus-4-6" 1000000+ "anthropic/claude-sonnet-5-5" 1000000"anthropic/claude-sonnet-5" 1000000"anthropic/claude-sonnet-4-6" 1000000"anthropic/claude-haiku-4-5@20251001" 200000