b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
59 lines
2.0 KiB
Python
59 lines
2.0 KiB
Python
"""Copilot / GitHub Models provider profile.
|
|
|
|
Copilot uses per-model api_mode routing:
|
|
- GPT-5+ / Codex models → codex_responses
|
|
- Claude models → anthropic_messages
|
|
- Everything else → chat_completions (this profile covers that subset)
|
|
|
|
Key quirks for the chat_completions subset:
|
|
- Editor attribution headers (via copilot_default_headers())
|
|
- GitHub Models reasoning extra_body (model-catalog gated)
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
from providers import register_provider
|
|
from providers.base import ProviderProfile
|
|
|
|
|
|
class CopilotProfile(ProviderProfile):
|
|
"""GitHub Copilot / GitHub Models — editor headers + reasoning."""
|
|
|
|
def build_api_kwargs_extras(
|
|
self,
|
|
*,
|
|
model: str | None = None,
|
|
reasoning_config: dict | None = None,
|
|
supports_reasoning: bool = False,
|
|
**ctx,
|
|
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
extra_body: dict[str, Any] = {}
|
|
if supports_reasoning and model:
|
|
try:
|
|
from hermes_cli.models import github_model_reasoning_efforts
|
|
|
|
supported_efforts = github_model_reasoning_efforts(model)
|
|
if supported_efforts and reasoning_config:
|
|
effort = reasoning_config.get("effort", "medium")
|
|
# Normalize stronger generic levels to the nearest supported.
|
|
if effort in {"xhigh", "max", "ultra"}:
|
|
effort = "high"
|
|
if effort in supported_efforts:
|
|
extra_body["reasoning"] = {"effort": effort}
|
|
elif supported_efforts:
|
|
extra_body["reasoning"] = {"effort": "medium"}
|
|
except Exception:
|
|
pass
|
|
return extra_body, {}
|
|
|
|
|
|
copilot = CopilotProfile(
|
|
name="copilot",
|
|
aliases=("github-copilot", "github-models", "github-model", "github"),
|
|
env_vars=("COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"),
|
|
base_url="https://api.githubcopilot.com",
|
|
auth_type="copilot",
|
|
)
|
|
|
|
register_provider(copilot)
|