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
fix(openai): empty tool list error for openai compatible endpoints (#5482)
Joaquin Coromina64a13ee6c956
diff --git a/marimo/_server/ai/providers.py b/marimo/_server/ai/providers.pyindex cff32e6555..fb05d43e8a 100644--- a/marimo/_server/ai/providers.py+++ b/marimo/_server/ai/providers.py@@ -123,14 +123,23 @@ class AnyProviderConfig:detail="OpenAI config not found",)key = _get_key(config["open_ai"], "OpenAI")- return AnyProviderConfig(- base_url=_get_base_url(config["open_ai"]),- api_key=key,- ssl_verify=config["open_ai"].get("ssl_verify", True),- ca_bundle_path=config["open_ai"].get("ca_bundle_path", None),- client_pem=config["open_ai"].get("client_pem", None),- tools=_get_tools(config.get("mode", "manual")),- )++ kwargs: dict[str, Any] = {+ "base_url": _get_base_url(config["open_ai"]),+ "api_key": key,+ "ssl_verify": config["open_ai"].get("ssl_verify", True),+ "ca_bundle_path": config["open_ai"].get("ca_bundle_path", None),+ "client_pem": config["open_ai"].get("client_pem", None),+ }++ # Only include tools if they are available+ # Empty tools list causes an error with deepseek+ # https://discord.com/channels/1059888774789730424/1387766267792068821+ tools = _get_tools(config.get("mode", "manual"))+ if len(tools) > 0:+ kwargs["tools"] = tools++ return AnyProviderConfig(**kwargs)@staticmethoddef for_anthropic(config: AiConfig) -> AnyProviderConfig: