Skip to content

Adding two new notebooks to the forgebook for model migration code updates - #66

Merged
nicholasdbrady merged 5 commits into
microsoft-foundry:mainfrom
meerakurup:main
Jul 14, 2026
Merged

Adding two new notebooks to the forgebook for model migration code updates#66
nicholasdbrady merged 5 commits into
microsoft-foundry:mainfrom
meerakurup:main

Conversation

@meerakurup

Copy link
Copy Markdown
Contributor

Description

This PR adds two new model-migration recipes to the Forgebook cookbook and registers a new author (Meera Kurup).

  • migrate-gpt-4o-mini-to-gpt-5-1 — the minimal, mechanical code diff to port a Chat Completions app from gpt-4o-mini to the gpt-5.1 reasoning model: rename max_completion_tokens, drop the sampling params gpt-5.1 rejects, add reasoning_effort/verbosity, and account for reasoning_tokens. Includes a compatibility shim for incremental migration and a live demonstration of the 400 a naive port produces.
  • migrate-gpt-5-5-to-claude-opus-4-8 — a cross-provider migration behind one provider-neutral adapter, with tool-schema translation, post-hoc structured-output validation/retry, streaming normalization, eval-gate promotion checks, and a staged rollout plan.
  • authors.yaml — adds meerakurup (name + title) so both recipes are credited.

Review focus

  • Product accuracy for Claude on Foundry in migrate-gpt-5-5-to-claude-opus-4-8: endpoint shape, SDK (AnthropicFoundry), Marketplace/CCU billing, and especially the Entra audience https://ai.cognitiveservices.com/.default used for keyless Anthropic calls — please confirm this against the Foundry Claude docs, since a wrong audience 401s every call.
  • Whether the side-by-side-then-flip migration framing and the eval-gate thresholds (schema parity, retry rate, quality, P90 latency) are positioned correctly.
  • Metadata/card display: titles ≤60 chars, descriptions ≤200 chars, tags valid.

Checklist

Notebook contributions

  • Recipe author is an approved Microsoft Forgebook author, or this contribution has maintainer approval
  • Recipe was drafted or validated through the internal authoring workflow
  • Foundry PM, engineering, or DX reviewer has checked product accuracy and positioning
  • Notebook added to notebooks/ directory
  • Entry added to registry.yaml with all required fields (slug, path, title, authors)
  • Approved author entry exists in authors.yaml (with at least name and title)
  • Tags are from the allowed list in tags.yaml
  • Registry validation passes: cd scripts && npx tsx validate-registry.ts
  • Notebook runs cleanly end-to-end
  • Cell outputs cleared before committing
  • No site-specific metadata inside the notebook
  • No secrets, tenant-specific values, or private endpoints are committed
  • Images stored in notebooks/media/<slug>/ with descriptive alt text
  • Data files stored in notebooks/data/<slug>/ when applicable

Site changes

Only notebooks changed — no site code touched, so this section is N/A.

  • Site builds without errors: cd site && npm run build
  • No TypeScript errors: cd site && npx astro check

@meerakurup
meerakurup requested a review from a team as a code owner July 7, 2026 20:19
nicholasdbrady added a commit that referenced this pull request Jul 8, 2026
…tributors (#67)

* Fix fork PR preview deploy via workflow_run split, gated to forgebook-contributors

Fork-based PRs always get a read-only GITHUB_TOKEN on pull_request events,
regardless of the author's actual repo/team write access, causing the
gh-pages deploy step to 403 (seen on PR #63 and #66).

- preview.yml: trimmed to unprivileged build/validate/test; uploads the
  built site and PR metadata as artifacts instead of deploying directly.
- preview-deploy.yml (new): workflow_run consumer with write access; only
  ever touches the pre-built static artifact, never PR code. Gates the
  actual gh-pages deploy + preview comment on forgebook-contributors team
  membership, via a maintainer-owned PAT (FORGEBOOK_TEAM_READ_TOKEN secret)
  since the default GITHUB_TOKEN can't read team membership.
- preview-cleanup.yml (new): moved the PR-close cleanup job here on
  pull_request_target, since it has the same fork-token problem but is safe
  to run privileged (no PR code execution, just deletes a directory on the
  maintainer-controlled gh-pages branch).
- CONTRIBUTING.md: note that auto-deployed previews require team
  membership; others still get build/test signal plus a comment.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Fix CodeQL code-injection findings: pass step outputs via env, not inline template

github-script steps interpolated step outputs directly into the JS source
via ${{ }} template expressions, which CodeQL flags as a code-injection
risk since the value flows from a workflow_run artifact. Switched all
occurrences (pr_number and author) to pass through env: and read via
process.env instead, which is the standard mitigation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@nicholasdbrady nicholasdbrady reopened this Jul 8, 2026
@nicholasdbrady nicholasdbrady reopened this Jul 8, 2026
nicholasdbrady

This comment was marked as resolved.

Meera Kurup added 2 commits July 13, 2026 15:33
- Fix token audience: use `cognitiveservices.azure.com/.default` for OpenAI and `ai.azure.com/.default` for Anthropic on Foundry
- Add `minimal` as a valid `reasoning_effort` value for gpt-5.1
- Narrow the request translator to target gpt-5.1 explicitly instead of a broad reasoning-model prefix list
- Add credential-free unit tests for request translation and Anthropic message conversion
- Add helper functions for Anthropic message translation and tool-contract validation
- Complete the Claude tool round-trip example cell
- Harden eval harness: catch adapter exceptions and validate tool arguments against JSON Schema
- Remove empty code cell from the gpt-5.5→Claude notebook

@nicholasdbrady nicholasdbrady left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes approved

@nicholasdbrady
nicholasdbrady enabled auto-merge (squash) July 13, 2026 22:59
@nicholasdbrady
nicholasdbrady disabled auto-merge July 14, 2026 22:04
@nicholasdbrady
nicholasdbrady merged commit 40f30b4 into microsoft-foundry:main Jul 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants