Skip to content

Commit 4bcc93d

Browse files
committed
add github-copilot support
1 parent af37c8f commit 4bcc93d

3 files changed

Lines changed: 43 additions & 6 deletions

File tree

src/aks-sreclaw/azext_aks_sreclaw/sreclaw/k8s/aks_sreclaw_manager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
from abc import ABC, abstractmethod
1111
from typing import Dict, List, Optional, Tuple, Union
1212

13-
from azext_aks_sreclaw._consts import (
14-
AGENT_NAMESPACE,
15-
AKS_SRECLAW_LABEL_SELECTOR,
16-
)
13+
from azext_aks_sreclaw._consts import AGENT_NAMESPACE, AKS_SRECLAW_LABEL_SELECTOR
1714
from azext_aks_sreclaw.sreclaw.k8s.helm_manager import HelmManager
1815
from azext_aks_sreclaw.sreclaw.llm_config_manager import LLMConfigManager
1916
from azext_aks_sreclaw.sreclaw.llm_providers import LLMProvider
@@ -229,7 +226,7 @@ def _populate_api_keys_from_secret(self):
229226
)
230227

231228
if not secret.data:
232-
logger.warning("Secret '%s' exists but has no data", self.llm_secret_name)
229+
logger.debug("Secret '%s' exists but has no data", self.llm_secret_name)
233230
return
234231

235232
# Decode secret data (base64 encoded)
@@ -969,6 +966,7 @@ def _create_helm_values(self):
969966
},
970967
"serviceAccount": {
971968
"create": False,
969+
"role": "",
972970
"name": self.sreclaw_service_account_name
973971
},
974972
"azureWorkloadIdentity": {
@@ -987,9 +985,10 @@ def _create_helm_values(self):
987985
for provider_name, provider_config in self.llm_config_manager.model_list.items():
988986
provider_entry = {
989987
"name": provider_name,
990-
"apiKeySecretKey": f"{provider_name}-key",
991988
"models": provider_config.get("models", [])
992989
}
990+
if provider_name != "github-copilot":
991+
provider_entry["apiKeySecretKey"] = f"{provider_name}-key"
993992

994993
if "api_base" in provider_config:
995994
provider_entry["apiBase"] = provider_config["api_base"]

src/aks-sreclaw/azext_aks_sreclaw/sreclaw/llm_providers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
from .anthropic_provider import AnthropicProvider
1212
from .azure_provider import AzureProvider
1313
from .base import LLMProvider
14+
from .github_copilot_provider import GitHubCopilotProvider
1415
from .openai_provider import OpenAIProvider
1516

1617
console = Console()
1718

1819
_PROVIDER_CLASSES: List[LLMProvider] = [
1920
AzureProvider,
21+
GitHubCopilotProvider,
2022
OpenAIProvider,
2123
AnthropicProvider,
2224
# Add new providers here
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
6+
7+
from typing import Tuple
8+
9+
from .base import LLMProvider, non_empty
10+
11+
12+
class GitHubCopilotProvider(LLMProvider):
13+
@property
14+
def readable_name(self) -> str:
15+
return "GitHub Copilot"
16+
17+
@property
18+
def name(self) -> str:
19+
return "github-copilot"
20+
21+
@property
22+
def parameter_schema(self):
23+
return {
24+
"models": {
25+
"secret": False,
26+
"default": "claude-opus-4.6",
27+
"hint": "comma-separated model names, e.g., claude-opus-4.6",
28+
"validator": non_empty
29+
},
30+
}
31+
32+
def validate_connection(self, params: dict) -> Tuple[str, str]:
33+
models_str = params.get("models")
34+
if not models_str:
35+
return "Missing required GitHub Copilot parameters.", "retry_input"
36+
return None, "save"

0 commit comments

Comments
 (0)