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
change copilot endpoint to follow pydantic-ai (#8481)
Shahmir Varqha911b46cb0687
diff --git a/frontend/src/components/app-config/ai-config.tsx b/frontend/src/components/app-config/ai-config.tsxindex b4db16f016..0133c91d7d 100644--- a/frontend/src/components/app-config/ai-config.tsx+++ b/frontend/src/components/app-config/ai-config.tsx@@ -983,7 +983,7 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({form={form}config={config}name="ai.github.base_url"- placeholder="https://api.githubcopilot.com/"+ placeholder="https://models.github.ai/inference"testId="ai-github-base-url-input"/></AccordionFormItem>diff --git a/marimo/_server/ai/config.py b/marimo/_server/ai/config.pyindex 3eeb797460..888c894418 100644--- a/marimo/_server/ai/config.py+++ b/marimo/_server/ai/config.py@@ -23,6 +23,9 @@ from marimo._server.ai.tools.tool_manager import get_tool_managerfrom marimo._server.ai.tools.types import ToolDefinitionfrom marimo._utils.http import HTTPStatus+# https://github.com/pydantic/pydantic-ai/blob/8b9ac2bde2355b0d431abea6cf210a36fffe0c43/pydantic_ai_slim/pydantic_ai/providers/github.py#L41C17-L41C51+GITHUB_COPILOT_BASE_URL = "https://models.github.ai/inference"+@dataclassclass AnyProviderConfig:@@ -115,8 +118,8 @@ class AnyProviderConfig:"github","GitHub",fallback_key=fallback_key,- # Default base URL for GitHub Copilot- fallback_base_url="https://api.githubcopilot.com/",+ # Default base URL for GitHub Copilot, taken from+ fallback_base_url=GITHUB_COPILOT_BASE_URL,require_key=True,)diff --git a/marimo/_smoke_tests/ai/github_model_check.py b/marimo/_smoke_tests/ai/github_model_check.pyindex fe17d0de69..4e7ebca41c 100644--- a/marimo/_smoke_tests/ai/github_model_check.py+++ b/marimo/_smoke_tests/ai/github_model_check.py@@ -42,7 +42,7 @@ def _(mo):@app.celldef _(api_key, httpx, openai, with_headers):client = openai.Client(- base_url="https://api.githubcopilot.com/",+ base_url="https://models.github.ai/inference",api_key=api_key.value,http_client=httpx.Client(verify=False),default_headers={diff --git a/tests/_server/ai/test_ai_config.py b/tests/_server/ai/test_ai_config.pyindex ee428dad12..cf21fae79a 100644--- a/tests/_server/ai/test_ai_config.py+++ b/tests/_server/ai/test_ai_config.py@@ -12,7 +12,9 @@ from marimo._config.config import (AiConfig,MarimoConfig,)+from marimo._dependencies.dependencies import DependencyManagerfrom marimo._server.ai.config import (+ GITHUB_COPILOT_BASE_URL,AnyProviderConfig,_get_ai_config,_get_base_url,@@ -145,14 +147,14 @@ class TestAnyProviderConfig:config: AiConfig = {"github": {"api_key": "test-github-key",- "base_url": "https://api.githubcopilot.com/",+ "base_url": "https://some-base-url",}}provider_config = AnyProviderConfig.for_github(config)assert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://api.githubcopilot.com/"+ assert provider_config.base_url == "https://some-base-url"def test_for_github_with_fallback_base_url(self):"""Test GitHub configuration uses fallback base URL when not specified."""@@ -165,7 +167,19 @@ class TestAnyProviderConfig:provider_config = AnyProviderConfig.for_github(config)assert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://api.githubcopilot.com/"+ assert provider_config.base_url == "https://models.github.ai/inference"++ @pytest.mark.skipif(+ not DependencyManager.pydantic_ai.has(),+ reason="pydantic-ai is not installed",+ )+ def test_github_default_base_url_matches_pydantic_ai(self):+ """Test GitHub configuration base URL matches pydantic-ai."""+ from pydantic_ai.providers.github import GitHubProvider++ assert (+ GitHubProvider(api_key="dummy").base_url == GITHUB_COPILOT_BASE_URL+ )def test_for_github_default_extra_headers(self):"""Test GitHub configuration includes default extra headers."""@@ -237,7 +251,7 @@ class TestAnyProviderConfig:# Note: copilot_settings is stored in config but not used by AnyProviderConfig# It's used by the frontend LSP clientassert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://api.githubcopilot.com/"+ assert provider_config.base_url == "https://models.github.ai/inference"def test_for_openrouter(self):"""Test OpenRouter configuration."""