-
Notifications
You must be signed in to change notification settings - Fork 248
Add GitHub Copilot LLM Backend Integration #5693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Overview
This PR adds GitHub Copilot as a new LLM backend for the Azure Developer CLI (azd) agent, enabling developers to use GitHub Copilot's language models for AI-assisted development workflows within azd.
Changes
Core Integration
pkg/llm/github_copilot.go
): Complete implementation of GitHub Copilot as an LLM backendAuthentication Flow
The implementation includes a complete OAuth device flow authentication system:
Technical Implementation Details
OpenAI API Reuse
We reuse the OpenAI model structure from langchaingo because:
Custom Headers for GitHub Copilot
The implementation applies specific headers required by GitHub Copilot:
Key headers applied:
copilot-integration-id: vscode-chat
- Identifies the integration as VS Code chat for proper request routingAuthorization: Bearer <copilot-token>
- Uses the exchanged Copilot session tokenUser-Agent: Azd/1.17.0
- Identifies azd as the requesting clientToken Management Strategy
~/.azd/gh-cp/gh
(JSON format)~/.azd/gh-cp/cp
(JSON format with expiration)Integration Points
cmd/container.go
): Registers the new provider as "github-copilot"internal/agent/agent_factory.go
): Updates context handling for authenticationcmd/init.go
): Enables GitHub Copilot for AI-assisted project initializationpkg/llm/model_factory.go
): Adds context parameter for authentication flowspkg/llm/manager.go
): Adds new LlmTypeGhCp constant and string representationSecurity Considerations
Benefits for azd Users
Resolves
Closes #5679 - Copilot integration
Testing
Configuration Example
Users can configure GitHub Copilot as their default LLM backend:
azd config set ai.model.type github-copilot
The first time they use an AI-assisted command, they'll be prompted to authenticate with GitHub, after which tokens are automatically managed.