A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feat: add Weights & Biases as an AI provider (#7053)
Myles Scolnick8c1c1a094897
diff --git a/.github/workflows/test_schemas.yaml b/.github/workflows/test_schemas.yamlindex 03593ed56f..725edf50a9 100644--- a/.github/workflows/test_schemas.yaml+++ b/.github/workflows/test_schemas.yaml@@ -3,8 +3,8 @@ name: Schema Breaking Changes Checkon:pull_request:paths:- - 'marimo/_schemas/**/*.yaml'- - 'packages/openapi/api.yaml'+ - "marimo/_schemas/**/*.yaml"+ - "packages/openapi/api.yaml"permissions:contents: readdiff --git a/Makefile b/Makefileindex f9193a1fe8..7146bbaef1 100644--- a/Makefile+++ b/Makefile@@ -106,7 +106,7 @@ fe-typecheck:.PHONY: fe-codegen# 🔄 Generate frontend APIfe-codegen:- uv run ./marimo development openapi > packages/openapi/api.yaml+ uv run --python=3.12 ./marimo development openapi > packages/openapi/api.yamlpnpm run codegenpnpm format packages/openapi/diff --git a/docs/guides/configuration/llm_providers.md b/docs/guides/configuration/llm_providers.mdindex d788a0cfc1..2271e86698 100644--- a/docs/guides/configuration/llm_providers.md+++ b/docs/guides/configuration/llm_providers.md@@ -62,6 +62,7 @@ You can configure the following providers:* Ollama* OpenAI* OpenRouter+* Weights & Biases* Together AI* Vercel v0* and any OpenAI-compatible provider@@ -85,6 +86,7 @@ edit_model = "openai/gpt-4o"[ai.open_ai]# Get an API key at https://platform.openai.com/account/api-keysapi_key = "sk-proj-..."+project = "proj_..." # Optional, specify a project ID for tracking and organization```!!! note "OpenAI-compatible providers"@@ -265,6 +267,31 @@ base_url = "https://openrouter.ai/api/v1/"See available models at `https://openrouter.ai/models`. Make sure to prepend `openrouter/` to the model slug (e.g., `openrouter/deepseek/deepseek-chat`, `openrouter/meta-llama/llama-3.1-8b-instruct`).+### Weights & Biases++Access hosted AI models through Weights & Biases Weave for ML development and inference.++**Requirements**++* Create an API key: [Weights & Biases Settings](https://wandb.ai/authorize)+* `pip install openai` or `uv add openai` (Weights & Biases is OpenAI‑compatible)++**Configuration**++```toml title="marimo.toml"+[ai.models]+# Use wandb/ prefix for Weights & Biases models. Examples:+chat_model = "wandb/meta-llama/llama-3-70b-instruct"+edit_model = "wandb/gpt-4o"++[ai.wandb]+api_key = "your-wandb-api-key"+base_url = "https://api.inference.wandb.ai/v1/" # Optional, this is the default+project = "my-project" # Optional, specify a project for tracking+```++See available models at the [Weights & Biases documentation](https://docs.wandb.ai/inference). Make sure to prepend `wandb/` to the model name.+### Local models with Ollama { #using-ollama }Run open-source LLMs locally and connect via an OpenAI‑compatible API.diff --git a/frontend/src/components/ai/ai-provider-icon.tsx b/frontend/src/components/ai/ai-provider-icon.tsxindex 3385506145..01c1a01bac 100644--- a/frontend/src/components/ai/ai-provider-icon.tsx+++ b/frontend/src/components/ai/ai-provider-icon.tsx@@ -9,6 +9,7 @@ import GeminiIcon from "@marimo-team/llm-info/icons/googlegemini.svg?inline";import OllamaIcon from "@marimo-team/llm-info/icons/ollama.svg?inline";import OpenAIIcon from "@marimo-team/llm-info/icons/openai.svg?inline";import OpenRouterIcon from "@marimo-team/llm-info/icons/openrouter.svg?inline";+import WandbIcon from "@marimo-team/llm-info/icons/weightsandbiases.svg?inline";import { BotIcon } from "lucide-react";import * as React from "react";import type { ProviderId } from "@/core/ai/ids/ids";@@ -30,6 +31,7 @@ const icons: Record<ProviderId | Aliases, string> = {deepseek: DeepseekIcon,github: GitHubIcon,openrouter: OpenRouterIcon,+ wandb: WandbIcon,marimo: marimoIcon,};diff --git a/frontend/src/components/app-config/ai-config.tsx b/frontend/src/components/app-config/ai-config.tsxindex 7f28b9aef7..e845258a55 100644--- a/frontend/src/components/app-config/ai-config.tsx+++ b/frontend/src/components/app-config/ai-config.tsx@@ -763,6 +763,62 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({/></AccordionFormItem>+ <AccordionFormItem+ title="Weights & Biases"+ provider="wandb"+ isConfigured={hasValue("ai.wandb.api_key")}+ >+ <ApiKey+ form={form}+ config={config}+ name="ai.wandb.api_key"+ placeholder="your-wandb-api-key"+ testId="ai-wandb-api-key-input"+ description={+ <>+ Your Weights & Biases API key from{" "}+ <ExternalLink href="https://wandb.ai/authorize">+ wandb.ai+ </ExternalLink>+ .+ </>+ }+ />+ <BaseUrl+ form={form}+ config={config}+ name="ai.wandb.base_url"+ placeholder="https://api.inference.wandb.ai/v1/"+ testId="ai-wandb-base-url-input"+ />+ <FormField+ control={form.control}+ name="ai.wandb.project"+ render={({ field }) => (+ <div className="flex flex-col space-y-1">+ <FormItem className={formItemClasses}>+ <FormLabel>Project</FormLabel>+ <FormControl>+ <Input+ data-testid="ai-wandb-project-input"+ rootClassName="flex-1"+ className="m-0 inline-flex h-7"+ placeholder="my-project"+ {...field}+ value={asStringOrUndefined(field.value)}+ />+ </FormControl>+ <FormMessage />+ <IsOverridden userConfig={config} name="ai.wandb.project" />+ </FormItem>+ <FormDescription>+ Optional: Specify a project for tracking.+ </FormDescription>+ </div>+ )}+ />+ </AccordionFormItem>+<AccordionFormItemtitle="Azure"provider="azure"diff --git a/frontend/src/components/ui/links.tsx b/frontend/src/components/ui/links.tsxindex 7433f023ee..9e506ec468 100644--- a/frontend/src/components/ui/links.tsx+++ b/frontend/src/components/ui/links.tsx@@ -13,6 +13,7 @@ export const ExternalLink = ({| `https://docs.python.org/${string}`| `https://marimo.io/${string}`| `https://links.marimo.app/${string}`+ | `https://wandb.ai/${string}`| `https://portal.azure.com/${string}`;children: React.ReactNode;}) => {diff --git a/frontend/src/core/ai/ids/ids.ts b/frontend/src/core/ai/ids/ids.tsindex 90fc5f33b5..e426a2e9e4 100644--- a/frontend/src/core/ai/ids/ids.ts+++ b/frontend/src/core/ai/ids/ids.ts@@ -12,6 +12,7 @@ export const PROVIDERS = ["azure","github","openrouter",+ "wandb","marimo",] as const;export type ProviderId = (typeof PROVIDERS)[number];diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.tsindex 4e486e57a7..1bb28d17df 100644--- a/frontend/src/core/config/config-schema.ts+++ b/frontend/src/core/config/config-schema.ts@@ -51,6 +51,7 @@ const AiConfigSchema = z.object({api_key: z.string().optional(),base_url: z.string().optional(),+ project: z.string().optional(),}).loose();@@ -161,6 +162,7 @@ export const UserConfigSchema = zgoogle: AiConfigSchema.optional(),ollama: AiConfigSchema.optional(),openrouter: AiConfigSchema.optional(),+ wandb: AiConfigSchema.optional(),open_ai_compatible: AiConfigSchema.optional(),azure: AiConfigSchema.optional(),bedrock: zdiff --git a/marimo/_config/config.py b/marimo/_config/config.pyindex 0fed76dc6d..d275dfdbfe 100644--- a/marimo/_config/config.py+++ b/marimo/_config/config.py@@ -275,6 +275,7 @@ class AiConfig(TypedDict, total=False):- `ollama`: the Ollama config- `github`: the GitHub config- `openrouter`: the OpenRouter config+ - `wandb`: the Weights & Biases config- `open_ai_compatible`: the OpenAI-compatible config"""@@ -293,6 +294,7 @@ class AiConfig(TypedDict, total=False):ollama: OpenAiConfiggithub: GitHubConfigopenrouter: OpenAiConfig+ wandb: OpenAiConfigopen_ai_compatible: OpenAiConfig@@ -304,6 +306,7 @@ class OpenAiConfig(TypedDict, total=False):- `api_key`: the OpenAI API key- `base_url`: the base URL for the API+ - `project`: the project ID for the OpenAI API- `ssl_verify` : Boolean argument for httpx passed to open ai client. httpx defaults to true, but some use cases to let users override to False in some testing scenarios- `ca_bundle_path`: custom ca bundle to be used for verifying SSL certificates. Used to create custom SSL context for httpx client- `client_pem` : custom path of a client .pem cert used for verifying identity of client server@@ -312,6 +315,7 @@ class OpenAiConfig(TypedDict, total=False):api_key: strbase_url: NotRequired[str]+ project: NotRequired[str]ssl_verify: NotRequired[bool]ca_bundle_path: NotRequired[str]client_pem: NotRequired[str]diff --git a/marimo/_server/ai/config.py b/marimo/_server/ai/config.pyindex e7a95579d1..08cfb5715c 100644--- a/marimo/_server/ai/config.py+++ b/marimo/_server/ai/config.py@@ -30,6 +30,7 @@ class AnyProviderConfig:base_url: Optional[str]api_key: str+ project: Optional[str] = Nonessl_verify: Optional[bool] = Noneca_bundle_path: Optional[str] = Noneclient_pem: Optional[str] = None@@ -108,6 +109,19 @@ class AnyProviderConfig:require_key=True,)+ @classmethod+ def for_wandb(cls, config: AiConfig) -> AnyProviderConfig:+ fallback_key = cls.os_key("WANDB_API_KEY")+ return cls._for_openai_like(+ config,+ "wandb",+ "Weights & Biases",+ fallback_key=fallback_key,+ # Default base URL for Weights & Biases+ fallback_base_url="https://api.inference.wandb.ai/v1/",+ require_key=True,+ )+@classmethoddef _for_openai_like(cls,@@ -132,6 +146,7 @@ class AnyProviderConfig:kwargs: dict[str, Any] = {"base_url": _get_base_url(ai_config) or fallback_base_url,"api_key": key,+ "project": ai_config.get("project", None),"ssl_verify": ai_config.get("ssl_verify", True),"ca_bundle_path": ca_bundle_path,"client_pem": ai_config.get("client_pem", None),@@ -205,6 +220,8 @@ class AnyProviderConfig:return cls.for_github(config)elif model_id.provider == "openrouter":return cls.for_openrouter(config)+ elif model_id.provider == "wandb":+ return cls.for_wandb(config)elif model_id.provider == "openai_compatible":return cls.for_openai_compatible(config)else:diff --git a/marimo/_server/ai/providers.py b/marimo/_server/ai/providers.pyindex 36733131ee..3ce7b2124e 100644--- a/marimo/_server/ai/providers.py+++ b/marimo/_server/ai/providers.py@@ -534,11 +534,13 @@ class OpenAIProvider(# if client is created, either with a custom context or with verify=False, use it as the http_client object in `AsyncOpenAI`extra_headers = extra_headers or {}+ project = config.project or Noneif client:return AsyncOpenAI(default_headers={"api-key": key, **extra_headers},api_key=key,base_url=base_url,+ project=project,http_client=client,)@@ -547,6 +549,7 @@ class OpenAIProvider(default_headers={"api-key": key, **extra_headers},api_key=key,base_url=base_url,+ project=project,)async def stream_completion(diff --git a/packages/llm-info/data/models.yml b/packages/llm-info/data/models.ymlindex a3d5ad6718..2c0d48a941 100644--- a/packages/llm-info/data/models.yml+++ b/packages/llm-info/data/models.yml@@ -419,3 +419,61 @@roles: [chat]thinking: false+# Weights & Biases Models++- name: Meta Llama 3.1 8B (W&B)+ model: meta-llama/Llama-3.1-8B-Instruct+ description: Efficient conversational model optimized for responsive multilingual chatbot interactions+ providers: [wandb]+ roles: [chat, edit]+ thinking: false++- name: OpenAI GPT OSS 120B+ model: openai/gpt-oss-120b+ description: Efficient Mixture-of-Experts model designed for high-reasoning, agentic and general-purpose use cases+ providers: [wandb]+ roles: [chat, edit]+ thinking: true++- name: OpenAI GPT OSS 20B+ model: openai/gpt-oss-20b+ description: Lower latency Mixture-of-Experts model trained on OpenAI's Harmony response format with reasoning capabilities+ providers: [wandb]+ roles: [chat, edit]+ thinking: true++- name: DeepSeek V3-0324+ model: deepseek-ai/DeepSeek-V3-0324+ description: Robust Mixture-of-Experts model tailored for high-complexity language processing and comprehensive document analysis+ providers: [wandb]+ roles: [chat, edit]+ thinking: false++- name: Meta Llama 3.3 70B (W&B)+ model: meta-llama/Llama-3.3-70B-Instruct+ description: Multilingual model excelling in conversational tasks, detailed instruction-following, and coding+ providers: [wandb]+ roles: [chat, edit]+ thinking: false++- name: DeepSeek R1-0528+ model: deepseek-ai/DeepSeek-R1-0528+ description: Optimized for precise reasoning tasks including complex coding, math, and structured document analysis+ providers: [wandb]+ roles: [chat, edit]+ thinking: true++- name: MoonshotAI Kimi K2+ model: moonshotai/Kimi-K2-Instruct+ description: Mixture-of-Experts model optimized for complex tool use, reasoning, and code synthesis+ providers: [wandb]+ roles: [chat, edit]+ thinking: true++- name: Z.AI GLM 4.5+ model: zai-org/GLM-4.5+ description: Mixture-of-Experts model with user-controllable thinking/non-thinking modes for strong reasoning, code generation, and agent alignment+ providers: [wandb]+ roles: [chat, edit]+ thinking: true+diff --git a/packages/llm-info/data/providers.yml b/packages/llm-info/data/providers.ymlindex 4c84eaac16..040a43a7b7 100644--- a/packages/llm-info/data/providers.yml+++ b/packages/llm-info/data/providers.yml@@ -72,3 +72,8 @@id: xaidescription: xAI's API for GPT models.url: https://x.ai/++- name: Weights & Biases+ id: wandb+ description: Weights & Biases' hosted models for ML development and AI inference.+ url: https://wandb.ai/diff --git a/packages/llm-info/icons/weightsandbiases.svg b/packages/llm-info/icons/weightsandbiases.svgnew file mode 100644index 0000000000..4f42a27c78--- /dev/null+++ b/packages/llm-info/icons/weightsandbiases.svg@@ -0,0 +1 @@+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Weights & Biases</title><path d="M2.48 0a1.55 1.55 0 1 0 0 3.1 1.55 1.55 0 0 0 0-3.1zm19.04 0a1.55 1.55 0 1 0 0 3.101 1.55 1.55 0 0 0 0-3.101zM12 2.295a1.55 1.55 0 1 0 0 3.1 1.55 1.55 0 0 0 0-3.1zM2.48 5.272a2.48 2.48 0 1 0 0 4.96 2.48 2.48 0 0 0 0-4.96zm19.04 0a2.48 2.48 0 1 0 0 4.96 2.48 2.48 0 0 0 0-4.96zM12 8.496a1.55 1.55 0 1 0 0 3.1 1.55 1.55 0 0 0 0-3.1zm-9.52 3.907a1.55 1.55 0 1 0 0 3.1 1.55 1.55 0 0 0 0-3.1zm19.04 0a1.55 1.55 0 1 0 0 3.102 1.55 1.55 0 0 0 0-3.102zM12 13.767a2.48 2.48 0 1 0 0 4.962 2.48 2.48 0 0 0 0-4.962zm-9.52 3.907a2.48 2.48 0 1 0 .001 4.962 2.48 2.48 0 0 0 0-4.962zm19.04.93a1.55 1.55 0 1 0 0 3.102 1.55 1.55 0 0 0 0-3.101zM12 20.9a1.55 1.55 0 1 0 0 3.1 1.55 1.55 0 0 0 0-3.1Z"/></svg>\ No newline at end of filediff --git a/packages/openapi/api.yaml b/packages/openapi/api.yamlindex 125c8abba6..ca50d00d1d 100644--- a/packages/openapi/api.yaml+++ b/packages/openapi/api.yaml@@ -95,8 +95,9 @@ components:\ OpenAI config\n - `anthropic`: the Anthropic config\n - `google`:\\ the Google AI config\n - `bedrock`: the Bedrock config\n - `azure`:\\ the Azure config\n - `ollama`: the Ollama config\n - `github`: the\- \ GitHub config\n - `openrouter`: the OpenRouter config\n - `open_ai_compatible`:\- \ the OpenAI-compatible config"+ \ GitHub config\n - `openrouter`: the OpenRouter config\n - `wandb`:\+ \ the Weights & Biases config\n - `open_ai_compatible`: the OpenAI-compatible\+ \ config"properties:anthropic:$ref: '#/components/schemas/AnthropicConfig'@@ -129,6 +130,8 @@ components:$ref: '#/components/schemas/OpenAiConfig'rules:type: string+ wandb:+ $ref: '#/components/schemas/OpenAiConfig'required: []title: AiConfigtype: object@@ -2444,13 +2447,14 @@ components:OpenAiConfig:description: "Configuration options for OpenAI or OpenAI-compatible services.\n\\n **Keys.**\n\n - `api_key`: the OpenAI API key\n - `base_url`:\- \ the base URL for the API\n - `ssl_verify` : Boolean argument for httpx\- \ passed to open ai client. httpx defaults to true, but some use cases to\- \ let users override to False in some testing scenarios\n - `ca_bundle_path`:\- \ custom ca bundle to be used for verifying SSL certificates. Used to create\- \ custom SSL context for httpx client\n - `client_pem` : custom path of\- \ a client .pem cert used for verifying identity of client server\n - `extra_headers`:\- \ extra headers to be passed to the OpenAI client"+ \ the base URL for the API\n - `project`: the project ID for the OpenAI\+ \ API\n - `ssl_verify` : Boolean argument for httpx passed to open ai client.\+ \ httpx defaults to true, but some use cases to let users override to False\+ \ in some testing scenarios\n - `ca_bundle_path`: custom ca bundle to be\+ \ used for verifying SSL certificates. Used to create custom SSL context for\+ \ httpx client\n - `client_pem` : custom path of a client .pem cert used\+ \ for verifying identity of client server\n - `extra_headers`: extra headers\+ \ to be passed to the OpenAI client"properties:api_key:type: string@@ -2466,6 +2470,8 @@ components:type: objectmodel:type: string+ project:+ type: stringssl_verify:type: booleanrequired: []diff --git a/packages/openapi/src/api.ts b/packages/openapi/src/api.tsindex ef7ade333e..74f70a0f97 100644--- a/packages/openapi/src/api.ts+++ b/packages/openapi/src/api.ts@@ -2836,6 +2836,7 @@ export interface components {* - `ollama`: the Ollama config* - `github`: the GitHub config* - `openrouter`: the OpenRouter config+ * - `wandb`: the Weights & Biases config* - `open_ai_compatible`: the OpenAI-compatible config*/AiConfig: {@@ -2854,6 +2855,7 @@ export interface components {open_ai_compatible?: components["schemas"]["OpenAiConfig"];openrouter?: components["schemas"]["OpenAiConfig"];rules?: string;+ wandb?: components["schemas"]["OpenAiConfig"];};/** AiInlineCompletionRequest */AiInlineCompletionRequest: {@@ -4086,6 +4088,7 @@ export interface components {** - `api_key`: the OpenAI API key* - `base_url`: the base URL for the API+ * - `project`: the project ID for the OpenAI API* - `ssl_verify` : Boolean argument for httpx passed to open ai client. httpx defaults to true, but some use cases to let users override to False in some testing scenarios* - `ca_bundle_path`: custom ca bundle to be used for verifying SSL certificates. Used to create custom SSL context for httpx client* - `client_pem` : custom path of a client .pem cert used for verifying identity of client server@@ -4100,6 +4103,7 @@ export interface components {[key: string]: string;};model?: string;+ project?: string;ssl_verify?: boolean;};/** OpenTutorialRequest */diff --git a/tests/_server/ai/test_ai_config.py b/tests/_server/ai/test_ai_config.pyindex 1fc78fdd27..af2431b941 100644--- a/tests/_server/ai/test_ai_config.py+++ b/tests/_server/ai/test_ai_config.py@@ -195,6 +195,61 @@ class TestAnyProviderConfig:assert provider_config.api_key == "test-openrouter-key"assert provider_config.base_url == "https://openrouter.ai/api/v1/"+ def test_for_wandb(self):+ """Test Weights & Biases configuration."""+ config: AiConfig = {+ "wandb": {+ "api_key": "test-wandb-key",+ "base_url": "https://api.inference.wandb.ai/v1/",+ }+ }++ provider_config = AnyProviderConfig.for_wandb(config)++ assert provider_config.api_key == "test-wandb-key"+ assert provider_config.base_url == "https://api.inference.wandb.ai/v1/"++ def test_for_wandb_with_fallback_base_url(self):+ """Test Weights & Biases configuration uses fallback base URL when not specified."""+ config: AiConfig = {+ "wandb": {+ "api_key": "test-wandb-key",+ }+ }++ provider_config = AnyProviderConfig.for_wandb(config)++ assert provider_config.api_key == "test-wandb-key"+ assert provider_config.base_url == "https://api.inference.wandb.ai/v1/"++ def test_for_wandb_with_project(self):+ """Test Weights & Biases configuration with project field."""+ config: AiConfig = {+ "wandb": {+ "api_key": "test-wandb-key",+ "project": "my-project",+ }+ }++ provider_config = AnyProviderConfig.for_wandb(config)++ assert provider_config.api_key == "test-wandb-key"+ assert provider_config.project == "my-project"++ def test_for_openai_with_project(self):+ """Test OpenAI configuration with project field."""+ config: AiConfig = {+ "open_ai": {+ "api_key": "test-openai-key",+ "project": "my-openai-project",+ }+ }++ provider_config = AnyProviderConfig.for_openai(config)++ assert provider_config.api_key == "test-openai-key"+ assert provider_config.project == "my-openai-project"+def test_for_anthropic(self):"""Test Anthropic configuration."""config: AiConfig = {@@ -287,6 +342,15 @@ class TestAnyProviderConfig:assert provider_config.api_key == "test-openrouter-key"assert provider_config.base_url == "https://openrouter.ai/api/v1/"+ def test_for_model_wandb(self) -> None:+ """Test for_model with Weights & Biases model."""+ config: AiConfig = {"wandb": {"api_key": "test-wandb-key"}}++ provider_config = AnyProviderConfig.for_model("wandb/llama-3", config)++ assert provider_config.api_key == "test-wandb-key"+ assert provider_config.base_url == "https://api.inference.wandb.ai/v1/"+def test_for_model_unknown_defaults_to_ollama(self) -> None:"""Test for_model with unknown provider defaults to Ollama."""config: AiConfig = {"ollama": {"api_key": "test-key"}}@@ -574,6 +638,32 @@ class TestProviderConfigWithFallback:exc_info.value.detail)+ @patch.dict(os.environ, {"WANDB_API_KEY": "env-wandb-token"})+ def test_for_wandb_with_fallback_key(self) -> None:+ """Test Weights & Biases config uses fallback key when config is missing api_key."""+ config: AiConfig = {"wandb": {}}+ provider_config = AnyProviderConfig.for_wandb(config)+ assert provider_config.api_key == "env-wandb-token"++ @patch.dict(os.environ, {"WANDB_API_KEY": "env-wandb-token"})+ def test_for_wandb_config_key_takes_precedence(self) -> None:+ """Test Weights & Biases config key takes precedence over environment variable."""+ config: AiConfig = {"wandb": {"api_key": "config-wandb-token"}}+ provider_config = AnyProviderConfig.for_wandb(config)+ assert provider_config.api_key == "config-wandb-token"++ @patch.dict(os.environ, {}, clear=True)+ def test_for_wandb_no_fallback_available(self) -> None:+ """Test Weights & Biases config fails when no config key and no env var."""+ config: AiConfig = {"wandb": {}}+ with pytest.raises(HTTPException) as exc_info:+ AnyProviderConfig.for_wandb(config)++ assert exc_info.value.status_code == HTTPStatus.BAD_REQUEST+ assert "Weights & Biases API key not configured" in str(+ exc_info.value.detail+ )+class TestGetKey:"""Tests for _get_key function."""