[github] Add Github Copilot
This commit is contained in:
parent
831eb07945
commit
b161fa4f9a
@ -892,7 +892,9 @@ def status():
|
|||||||
p = getattr(config.providers, spec.name, None)
|
p = getattr(config.providers, spec.name, None)
|
||||||
if p is None:
|
if p is None:
|
||||||
continue
|
continue
|
||||||
if spec.is_local:
|
if spec.is_oauth:
|
||||||
|
console.print(f"{spec.label}: [green]✓ (OAuth)[/green]")
|
||||||
|
elif spec.is_local:
|
||||||
# Local deployments show api_base instead of api_key
|
# Local deployments show api_base instead of api_key
|
||||||
if p.api_base:
|
if p.api_base:
|
||||||
console.print(f"{spec.label}: [green]✓ {p.api_base}[/green]")
|
console.print(f"{spec.label}: [green]✓ {p.api_base}[/green]")
|
||||||
|
|||||||
@ -298,7 +298,9 @@ class Config(BaseSettings):
|
|||||||
if spec.is_oauth:
|
if spec.is_oauth:
|
||||||
continue
|
continue
|
||||||
p = getattr(self.providers, spec.name, None)
|
p = getattr(self.providers, spec.name, None)
|
||||||
if p and p.api_key:
|
if p is None:
|
||||||
|
continue
|
||||||
|
if p.api_key:
|
||||||
return p, spec.name
|
return p, spec.name
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,9 @@ class LiteLLMProvider(LLMProvider):
|
|||||||
# api_key / api_base are fallback for auto-detection.
|
# api_key / api_base are fallback for auto-detection.
|
||||||
self._gateway = find_gateway(provider_name, api_key, api_base)
|
self._gateway = find_gateway(provider_name, api_key, api_base)
|
||||||
|
|
||||||
|
# Detect GitHub Copilot (uses OAuth device flow, no API key)
|
||||||
|
self.is_github_copilot = "github_copilot" in default_model
|
||||||
|
|
||||||
# Configure environment variables
|
# Configure environment variables
|
||||||
if api_key:
|
if api_key:
|
||||||
self._setup_env(api_key, api_base, default_model)
|
self._setup_env(api_key, api_base, default_model)
|
||||||
@ -76,6 +79,10 @@ class LiteLLMProvider(LLMProvider):
|
|||||||
|
|
||||||
def _resolve_model(self, model: str) -> str:
|
def _resolve_model(self, model: str) -> str:
|
||||||
"""Resolve model name by applying provider/gateway prefixes."""
|
"""Resolve model name by applying provider/gateway prefixes."""
|
||||||
|
# GitHub Copilot models pass through directly
|
||||||
|
if self.is_github_copilot:
|
||||||
|
return model
|
||||||
|
|
||||||
if self._gateway:
|
if self._gateway:
|
||||||
# Gateway mode: apply gateway prefix, skip provider-specific prefixes
|
# Gateway mode: apply gateway prefix, skip provider-specific prefixes
|
||||||
prefix = self._gateway.litellm_prefix
|
prefix = self._gateway.litellm_prefix
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user