Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix Metabot credential validation for mini-model metadata (#84047)

Stas Gavrylovd2f56ede4f0a
diff --git a/src/metabase/metabot/self/core.clj b/src/metabase/metabot/self/core.clj
index f55347e8b99..945d465452b 100644
--- a/src/metabase/metabot/self/core.clj
+++ b/src/metabase/metabot/self/core.clj
@@ -160,7 +160,8 @@
[:api-key {:optional true} [:maybe :string]]
[:base-url {:optional true} [:maybe :string]]
[:model-reasoning {:optional true} [:maybe [:or :boolean :string]]]
- [:probed-model {:optional true} [:maybe :string]]])
+ [:probed-model {:optional true} [:maybe :string]]
+ [:mini-model {:optional true} [:maybe :string]]])
(def ^:private AzureCredentials
"An Azure connection's config: the API-key pair plus the model family and deployment name its model is composed from."
@@ -168,7 +169,8 @@
[:api-key {:optional true} [:maybe :string]]
[:base-url {:optional true} [:maybe :string]]
[:model-family {:optional true} [:maybe :string]]
- [:deployment-name {:optional true} [:maybe :string]]])
+ [:deployment-name {:optional true} [:maybe :string]]
+ [:mini-model {:optional true} [:maybe :string]]])
(def ^:private BedrockCredentials
[:map {:closed true}
@@ -176,7 +178,8 @@
[:secret-access-key {:optional true} [:maybe :string]]
[:session-token {:optional true} [:maybe :string]]
[:region {:optional true} [:maybe :string]]
- [:model-id {:optional true} [:maybe :string]]])
+ [:model-id {:optional true} [:maybe :string]]
+ [:mini-model {:optional true} [:maybe :string]]])
(def ^:private GoogleCredentials
[:map {:closed true}
@@ -188,7 +191,8 @@
[:base-url {:optional true} [:maybe :string]]
[:endpoint-id {:optional true} [:maybe :string]]
;; recorded by the connect-time probe, not entered by the admin
- [:probed-model {:optional true} [:maybe :string]]])
+ [:probed-model {:optional true} [:maybe :string]]
+ [:mini-model {:optional true} [:maybe :string]]])
(def LLMCredentials
"A connection's credentials, in whichever provider shape it carries. Public so the adapter layer can say
diff --git a/test/metabase/metabot/self/adapter_test.clj b/test/metabase/metabot/self/adapter_test.clj
index 3d7f3525360..c35b6f5abe9 100644
--- a/test/metabase/metabot/self/adapter_test.clj
+++ b/test/metabase/metabot/self/adapter_test.clj
@@ -235,6 +235,28 @@
(is (= :allow-private (:network-policy-floor auth)))
(is (nil? (mr/explain adapter/Auth auth)))))))))
+(deftest ^:parallel credentials-accept-mini-model-metadata-test
+ (doseq [credentials [{:api-key "test-key" :base-url "https://api.anthropic.com"}
+ {:api-key "test-key" :model-family "openai" :deployment-name "parakeet"}
+ {:region "us-east-1" :model-id "anthropic.claude-sonnet-4-6"}
+ {:project-id "parakeet-project" :location "us-central1"}]]
+ (testing (str "Credential fields: " (keys credentials))
+ (is (nil? (mr/explain self.core/LLMCredentials credentials)))
+ (doseq [mini-model [nil "parakeet-mini"]]
+ (is (nil? (mr/explain self.core/LLMCredentials (assoc credentials :mini-model mini-model)))))
+ (is (some? (mr/explain self.core/LLMCredentials (assoc credentials :mini-model 42))))
+ (is (some? (mr/explain self.core/LLMCredentials
+ (assoc credentials :mini-model "parakeet-mini" :unexpected-field "value")))))))
+
+(deftest ^:parallel reasoning-capability-accepts-mini-model-metadata-test
+ (is (true? (claude/streams-reasoning? {:connection-key "anthropic"
+ :type "anthropic"
+ :model "claude-sonnet-4-6"
+ :credentials {:api-key "test-key"
+ :base-url "https://api.anthropic.com"
+ :mini-model "claude-haiku-4-5-20251001"}
+ :ai-proxy? false}))))
+
;;; ──────────────────────────────────────────────────────────────────
;;; Descriptor headers
;;; ──────────────────────────────────────────────────────────────────