Adding the GH Support - #179
Conversation
|
|
||
| - Add `github` as a valid `AZURE_FUNCTIONS_AGENTS_PROVIDER` value. | ||
| - Build GitHub Models clients through MAF's existing `OpenAIChatClient`. | ||
| - Authenticate with `GITHUB_MODELS_TOKEN`, falling back to `GITHUB_TOKEN` only when the |
There was a problem hiding this comment.
Why not just use GITHUB_TOKEN only? Why introduce a new variable?
| provider is explicitly `github`. | ||
| - Auto-detect GitHub Models from non-blank `GITHUB_MODELS_TOKEN` after all existing provider | ||
| signals, preserving existing selection precedence. | ||
| - Resolve models as requested model, then `GITHUB_MODELS_MODEL`, then |
There was a problem hiding this comment.
GITHUB_MODELS_MODEL is a mouthful, can we just do GITHUB_MODEL?
(Ideally I would not prefer adding any variables but given this is the norm so far, it would be cleaner to make it simple atleast).
|
|
||
| - Add GitHub repository, GitHub App, OAuth, or GitHub API integration. | ||
| - Provision tokens, models, billing, rate limits, or GitHub organization policy. | ||
| - Auto-detect from generic `GITHUB_TOKEN`, which may exist for unrelated GitHub operations. |
There was a problem hiding this comment.
Given we anyways select Github last from our provider list, is this really that big a deal? I think it gives users a clean experience if we conform to predefined constants.
| - bash: | | ||
| python -m pytest -m e2e tests/endtoend/test_github_models_agentic.py -v | ||
| displayName: 'Run GitHub Models live E2E test' | ||
| condition: and(succeeded(), ne(variables['GITHUB_MODELS_TOKEN'], '')) |
There was a problem hiding this comment.
Do we want this? It would require adding some GH token to the pipeline and that might need to be rotated every often (cc: hallvictoria )
| `GITHUB_MODELS_ENDPOINT` override for testing and future-compatible gateways. | ||
| - Report `provider=github` and the resolved model through existing inference-target | ||
| observability metadata. | ||
| - Include a minimal local-first chat sample using the built-in browser and HTTP endpoints. |
There was a problem hiding this comment.
Given its a small basic sample, I'm wondering if we can just retrofit one of the existing samples to use GitHub instead? It can actually be a stronger story to sell if the global config uses foundry and one specific agent can resolve to Github to showcase we're LLM agnostic.
| ) | ||
|
|
||
| @classmethod | ||
| def _build_github(cls, model: str) -> Any: |
There was a problem hiding this comment.
NIT: Make sure its strongly typed and not returning Any
| if requested: | ||
| return requested | ||
| runtime_model = runtime_env_value("AZURE_FUNCTIONS_AGENTS_MODEL") | ||
| if provider == "azure_openai": |
There was a problem hiding this comment.
Since you're touching this, can you make the providers an Enum or a StrEnum to make it more strongly typed please?
Purpose
AZURE_FUNCTIONS_AGENTS_PROVIDER=githubselection and dedicated-token auto-detection after all existing providers.GITHUB_MODELS_TOKEN, falling back toGITHUB_TOKENonly when GitHub Models is explicitly selected.GITHUB_MODELS_MODELandGITHUB_MODELS_ENDPOINT, defaulting toopenai/gpt-4.1-miniandhttps://models.github.ai/inference.samples/github-models-chatwith the built-in browser UI, JSON chat endpoint, and streaming endpoint.Does this introduce a breaking change?
```
[ ] Yes
[x] No
```
Existing explicit provider values and auto-detection precedence are preserved. Generic
GITHUB_TOKENdoes not participate in auto-detection, avoiding accidental selection in GitHub Actions and other GitHub-integrated environments.Pull Request Type
```
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:
```
How to Test
```bash
git clone https://github.com/Azure/azure-functions-agents-runtime.git
cd azure-functions-agents-runtime
git checkout swapnil/supportGHModel
python -m pip install -U -e .[dev]
```
```bash
python -m ruff check src tests
python -m mypy src
python -m pytest --cache-clear --cov=./src/azure_functions_agents --cov-report=xml --cov-branch tests
```
```powershell
cd samples/github-models-chat/src
Copy-Item local.settings.template.json local.settings.json
Replace in local.settings.json, then:
func start
```
Open
http://localhost:7071/agents/main/or run the requests insamples/github-models-chat/test.http.What to Check
provider=githubacceptsGITHUB_MODELS_TOKENand theGITHUB_TOKENfallback.GITHUB_MODELS_TOKENand remains lower precedence than Azure OpenAI, Foundry, and OpenAI.OpenAIChatClient.InferenceTargetor logs.Other Information
docs/frds/0008-github-models-provider.md.'@; gh pr create --base main --head swapnil/supportGHModel --title "feat: add GitHub Models provider and chat sample" --body $body