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
docs - ai providers updates (#82376)
Jeff Bruemmer72e2e9b23468
diff --git a/docs/ai/providers.md b/docs/ai/providers.mdindex a3150ddb6a5..66f30afb843 100644--- a/docs/ai/providers.md+++ b/docs/ai/providers.md@@ -257,6 +257,38 @@ Credentials:- **Region**. Pick one from the dropdown in **Admin > AI**. Defaults to `us-east-1`. You can also set it with the environment variable `MB_LLM_BEDROCK_REGION`.- **Session token** (advanced). Only together with **Access key ID** and **Secret access key**. Only needed for temporary credentials. You can also set it with the environment variable `MB_LLM_BEDROCK_SESSION_TOKEN`.+### IAM permissions for Bedrock++Metabase talks to Bedrock through the mantle endpoint, `https://bedrock-mantle.{region}.api.aws`, not through `bedrock-runtime`. Mantle is a separate IAM namespace with its own actions, so a policy written against the `bedrock` prefix won't grant access. Metabase lists models and runs conversations, so it needs `bedrock-mantle:ListModels` and `bedrock-mantle:CreateInference`.++Here's a least-privilege policy that grants both:++```json+{+ "Version": "2012-10-17",+ "Statement": [+ {+ "Effect": "Allow",+ "Action": ["bedrock-mantle:ListModels", "bedrock-mantle:CreateInference"],+ "Resource": "arn:aws:bedrock-mantle:*:*:project/*"+ }+ ]+}+```++The AWS managed policy [AmazonBedrockMantleInferenceAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockMantleInferenceAccess.html) also covers both actions (along with permissions Metabase doesn't use).++If Metabase reports "AWS Bedrock credentials lack permission for this model or action", check that your policy uses the `bedrock-mantle` prefix.++### The Bedrock models you can pick depend on the region++The table above lists the models Metabase can use. The **Models** card only offers the ones Bedrock serves in the connection's region, so what you can pick depends on the region. The mantle catalog has no cross-region inference profiles, so a model that isn't served in your region can't be reached from that region at all.++If the model list is empty or shorter than you expect after connecting:++- **Check the region**: the **Region** dropdown lists every AWS region, including regions where Bedrock serves none of these models. The [AWS model cards](https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards.html) show where each model is available. For example, the GPT models are only served in US regions.+- **Check your account's data retention setting**: Bedrock marks a model unavailable when your account's data retention mode doesn't meet what that model requires. For example, [Claude Fable 5](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-anthropic-claude-fable-5.html) requires the `aws_review` data retention mode.+## vLLM- Provider key: `vllm`diff --git a/docs/ai/settings.md b/docs/ai/settings.mdindex b02b40688fe..357672c472d 100644--- a/docs/ai/settings.md+++ b/docs/ai/settings.md@@ -58,7 +58,7 @@ To connect a provider with your own credentials:1. Go to **Admin > AI**.2. Click **Add a provider**.3. Pick your provider.-4. Fill in its credentials. The **Where do I find this?** links open the provider's key management pages in a new tab.+4. Enter your credentials. Most providers only need an **API key**. The **Where do I find this?** link opens your provider's key management page in a new tab. For what each provider needs, see [AI providers](./providers.md).5. Click **Connect**.If you've already copied a key, one neat thing: just paste the key anywhere on the provider grid, and Metabase selects the matching provider and fills in the key for you. Check to make sure the provider matches.diff --git a/docs/configuring-metabase/environment-variables.md b/docs/configuring-metabase/environment-variables.mdindex 05d7ca83701..1f4bc2cff34 100644--- a/docs/configuring-metabase/environment-variables.md+++ b/docs/configuring-metabase/environment-variables.md@@ -1419,7 +1419,7 @@ Backed by the bedrock connection in the admin AI settings provider list: reads aThe AWS region for Amazon Bedrock (e.g. us-east-1).-Backed by the bedrock connection in the admin AI settings provider list: reads and writes go through the llm-providers connection list, and a value set by this environment variable shadows this one field of that connection. On a self-hosted Metabase, setting only the region enables Bedrock with the AWS default credentials chain, with no access keys configured.+Backed by the bedrock connection in the admin AI settings provider list: reads and writes go through the llm-providers connection list, and a value set by this environment variable shadows this one field of that connection. On a self-hosted Metabase, setting only the region enables Bedrock with the AWS default credentials chain, with no access keys configured. [The Bedrock models you can pick depend on the region](../ai/providers.md#the-bedrock-models-you-can-pick-depend-on-the-region).### `MB_LLM_BEDROCK_SECRET_ACCESS_KEY`diff --git a/e2e/runner/cypress-runner-backend.js b/e2e/runner/cypress-runner-backend.jsindex bc52c776870..92a9278b96e 100755--- a/e2e/runner/cypress-runner-backend.js+++ b/e2e/runner/cypress-runner-backend.js@@ -1,6 +1,6 @@#!/usr/bin/env node-const { execSync, spawn } = require("child_process");+const { spawn } = require("child_process");const fs = require("fs");const os = require("os");const path = require("path");@@ -10,8 +10,21 @@ const { waitUntilReady, shell } = require("./cypress-runner-utils");const tempDbPath = path.join(os.tmpdir(), `metabase-test-${process.pid}.db`);function getJvmOptsFromDepsEdn(alias = "e2e") {- const cmd = `clojure -Sdeps '{:deps {}}' -M -e '(->> (-> "deps.edn" slurp clojure.edn/read-string :aliases :${alias} :jvm-opts) (clojure.string/join " ") println)'`;- return execSync(cmd, { encoding: "utf8" }).trim().toString();+ const depsEdnPath = path.resolve(__dirname, "../../deps.edn");+ const depsEdn = fs.readFileSync(depsEdnPath, "utf8");+ const aliasBlockPattern = new RegExp(+ `:${alias}\\s*\\n\\s*\\{:jvm-opts\\s*\\[([\\s\\S]*?)\\]\\s*\\}`,+ "m",+ );+ const aliasBlock = depsEdn.match(aliasBlockPattern)?.[1];+ if (!aliasBlock) {+ throw new Error(`Could not find :jvm-opts for alias :${alias} in deps.edn`);+ }++ const jvmOpts = [...aliasBlock.matchAll(/"((?:\\.|[^"\\])*)"/g)].map(+ ([, option]) => JSON.parse(`"${option}"`),+ );+ return jvmOpts.join(" ");}// Ensure that the only two required env vars have valuesdiff --git a/src/metabase/cmd/ai_provider_dox.clj b/src/metabase/cmd/ai_provider_dox.cljindex 2976f6ad8ae..9a520bc7c92 100644--- a/src/metabase/cmd/ai_provider_dox.clj+++ b/src/metabase/cmd/ai_provider_dox.clj@@ -18,10 +18,11 @@(def ^:private intro-resource "metabase/cmd/resources/ai-provider-intro.md")(def ^:private provider-notes-resources- "Hand-written prose appended to a provider type's section, keyed by type. Only the managed provider has an entry: its- section is otherwise a models table, and what an admin needs to know about it — that it's a Metabase Cloud offering,- how it's billed, how it authenticates — is prose rather than anything the registry holds."- {"metabase" "metabase/cmd/resources/ai-provider-metabase.md"})+ "Hand-written prose appended to a provider type's section, keyed by type, for what an admin needs to know that the+ registry doesn't hold. The managed provider's covers that it's a Metabase Cloud offering, how it's billed, and how it+ authenticates. Bedrock's covers the IAM actions the mantle endpoint needs and why the model picker is region-scoped."+ {"metabase" "metabase/cmd/resources/ai-provider-metabase.md"+ "bedrock" "metabase/cmd/resources/ai-provider-bedrock.md"})(def ^:private dynamic-catalog-types"Provider types that serve whatever models the operator loaded, so there is no list to publish."diff --git a/src/metabase/cmd/resources/ai-provider-bedrock.md b/src/metabase/cmd/resources/ai-provider-bedrock.mdnew file mode 100644index 00000000000..c9ffafee9d1--- /dev/null+++ b/src/metabase/cmd/resources/ai-provider-bedrock.md@@ -0,0 +1,31 @@+### IAM permissions for Bedrock++Metabase talks to Bedrock through the mantle endpoint, `https://bedrock-mantle.{region}.api.aws`, not through `bedrock-runtime`. Mantle is a separate IAM namespace with its own actions, so a policy written against the `bedrock` prefix won't grant access. Metabase lists models and runs conversations, so it needs `bedrock-mantle:ListModels` and `bedrock-mantle:CreateInference`.++Here's a least-privilege policy that grants both:++```json+{+ "Version": "2012-10-17",+ "Statement": [+ {+ "Effect": "Allow",+ "Action": ["bedrock-mantle:ListModels", "bedrock-mantle:CreateInference"],+ "Resource": "arn:aws:bedrock-mantle:*:*:project/*"+ }+ ]+}+```++The AWS managed policy [AmazonBedrockMantleInferenceAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockMantleInferenceAccess.html) also covers both actions (along with permissions Metabase doesn't use).++If Metabase reports "AWS Bedrock credentials lack permission for this model or action", check that your policy uses the `bedrock-mantle` prefix.++### The Bedrock models you can pick depend on the region++The table above lists the models Metabase can use. The **Models** card only offers the ones Bedrock serves in the connection's region, so what you can pick depends on the region. The mantle catalog has no cross-region inference profiles, so a model that isn't served in your region can't be reached from that region at all.++If the model list is empty or shorter than you expect after connecting:++- **Check the region**: the **Region** dropdown lists every AWS region, including regions where Bedrock serves none of these models. The [AWS model cards](https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards.html) show where each model is available. For example, the GPT models are only served in US regions.+- **Check your account's data retention setting**: Bedrock marks a model unavailable when your account's data retention mode doesn't meet what that model requires. For example, [Claude Fable 5](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-anthropic-claude-fable-5.html) requires the `aws_review` data retention mode.diff --git a/src/metabase/llm/settings.clj b/src/metabase/llm/settings.cljindex 929697925fc..205d0440210 100644--- a/src/metabase/llm/settings.clj+++ b/src/metabase/llm/settings.clj@@ -347,7 +347,7 @@:export? false:getter (connection-field-getter :llm-bedrock-region):setter (connection-field-setter :llm-bedrock-region)- :doc "Backed by the bedrock connection in the admin AI settings provider list: reads and writes go through the llm-providers connection list, and a value set by this environment variable shadows this one field of that connection. On a self-hosted Metabase, setting only the region enables Bedrock with the AWS default credentials chain, with no access keys configured.")+ :doc "Backed by the bedrock connection in the admin AI settings provider list: reads and writes go through the llm-providers connection list, and a value set by this environment variable shadows this one field of that connection. On a self-hosted Metabase, setting only the region enables Bedrock with the AWS default credentials chain, with no access keys configured. [The Bedrock models you can pick depend on the region](../ai/providers.md#the-bedrock-models-you-can-pick-depend-on-the-region).");;; ----------------------------------------------- Microsoft Azure ---------------------------------------------