Skip to content

support GPT frontier structured responses - #413

Merged
rapids-bot[bot] merged 3 commits into
release/2.2from
ajay/gpt-structured-output-compat
Aug 4, 2026
Merged

rapids-bot[bot] merged 3 commits into
release/2.2from
ajay/gpt-structured-output-compat

Conversation

@AjayThorve

@AjayThorve AjayThorve commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Overview

Some OpenAI-compatible frontier providers return the requested Pydantic contract as schema-valid JSON in ordinary assistant content instead of emitting the structured-output tool call. In deep research, that prevents SourceRoutingPlan, ResearchPlan, or ResearchNotes from reaching the persistence middleware and can leave the workflow retrying a completed stage.

This change:

  • promotes exact, schema-valid JSON assistant content to the requested structured response;
  • makes at most one tools-disabled corrective call for empty or invalid plain-text responses, so the fallback cannot spiral;
  • leaves native structured responses and ordinary tool calls unchanged;
  • applies the compatibility middleware only at the source-router, planner, and researcher structured-response boundaries; and
  • updates the existing frontier profile to use the direct OpenAI provider with OPENAI_API_KEY: GPT Sol for orchestration, planning, and writing, and GPT Luna for source routing and research.

The default Ultra profile is unchanged.

DCO sign-off for the squash commit

Signed-off-by: Ajay Thorve athorve@nvidia.com

Validation

  • uv run ruff check .
  • uv run pytest -q — 2022 passed, 13 skipped
  • Focused post-format run — 183 passed
  • uv run nat validate --config_file configs/config_frontier_models.yml
  • uv run nat validate --config_file configs/config_web_default_llamaindex.yml
  • GPT Sol/Luna semantic smoke advanced through routing, planning, research, and writing with a non-sentinel cited report.
  • Deterministic 20-task GPT DRB-II pilot completed with 20/20 generation and 20/20 official judge coverage.
  • Patched-runtime Ultra regression smoke completed a DRB-II task with a 24.6k-character cited report, 1/1 clean collection, and no fallback correction. Harbor used one internal retry before the successful attempt.
  • I added or updated tests for behavior changes.
  • Documentation changes are not required; the user-facing frontier example config is updated directly.
  • I confirmed this PR does not include secrets, credentials, internal endpoints, or internal-only data.
  • I certify this contribution under the Developer Certificate of Origin (DCO) and signed my commit with git commit -s.
  • I replaced the DCO sign-off placeholder with my GitHub commit identity and kept the required angle brackets around the email address.

The remaining all-files Markdown-link and dependency-audit failures are release-branch-wide CI issues unrelated to this diff and are addressed separately by #415.

Where should reviewers start?

Start with StructuredResponseTextFallbackMiddleware in custom_middleware.py, then its three placements in factory.py, and finally the direct-OpenAI Sol/Luna role split in config_frontier_models.yml.

Related Issues

  • Relates to the model endpoint deprecation migration.

Summary by CodeRabbit

  • New Features

    • Improved deep-research reliability by automatically correcting responses that do not match the expected structured format.
    • Preserved valid structured responses while retrying invalid responses without tool calls.
  • Configuration

    • Updated frontier-model workflows to use GPT Sol and GPT Luna for orchestration, planning, writing, routing, and research.
    • Updated model inference settings and token limits.
  • Tests

    • Added coverage for structured-response recovery, retry behavior, middleware integration, and frontier-model configuration.

@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 84000a66-8257-4d15-bf19-a447ded170b0

📥 Commits

Reviewing files that changed from the base of the PR and between 14cc75f and de58436.

📒 Files selected for processing (2)
  • configs/config_frontier_models.yml
  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Pytest and Coverage
  • GitHub Check: Script Validation
  • GitHub Check: Lint and Hooks
🧰 Additional context used
📓 Path-based instructions (5)
configs/**/*.y{a,}ml

📄 CodeRabbit inference engine (AGENTS.md)

Use _type values derived from the registered configuration class names in workflow YAML configuration.

Files:

  • configs/config_frontier_models.yml
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Keep changes inside this repository, avoid editing adjacent repositories, and scope changes to the smallest relevant independent package, especially under sources/.
Run the narrowest relevant validation command first and broaden to the full suite only when a change crosses shared boundaries.
Keep pull requests scoped, exclude unrelated files and generated artifacts, never include secrets, and provide validation commands and results.

**/*: Do not include secrets, credentials, private hostnames, internal-only logs, customer data, or generated local artifacts.
Add or update tests for behavior changes.

Files:

  • configs/config_frontier_models.yml
  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
**/*.{yaml,yml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

For deployment changes, run the relevant Helm or Compose validation and describe the environment used.

Files:

  • configs/config_frontier_models.yml
{deploy/**,configs/**}

⚙️ CodeRabbit configuration file

{deploy/**,configs/**}: Review deployment and config changes for secret separation, safe defaults, local-vs-production behavior, Helm and
Docker portability, and documentation parity. Flag committed credentials, environment-specific NVIDIA internals in
public defaults, and changes that make examples diverge from CI-tested paths.

Files:

  • configs/config_frontier_models.yml
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Format and lint Python with Ruff using a 120-character line length, Python 3.11 target, rules E/F/W/I/PL/UP, and single-line imports; avoid reformatting unrelated code.
Never print or log secret values, including through tool output or error messages.

**/*.py: Run uv run ruff check . and uv run ruff format --check . for root Python changes.
Run uv run pytest for root project Python changes.

Files:

  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
🔇 Additional comments (5)
tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py (2)

69-79: Add the missing clarifier mapping assertion.

The configuration changes functions.clarifier_agent.llm to gpt_sol_agent_llm, but this test checks only deep_research_agent. Add an assertion for the clarifier mapping so a later regression fails the test.

As per coding guidelines, “Add or update tests for behavior changes.”

Source: Coding guidelines


48-68: LGTM!

configs/config_frontier_models.yml (3)

5-5: 📐 Maintainability & Code Quality

Document all required credentials.

The configuration still defines NIM-backed entries that use NVIDIA_API_KEY, including summary_llm. The updated description mentions only OPENAI_API_KEY. If those entries remain reachable, document both requirements or isolate the NIM entries from this profile.

As per path instructions, “Review deployment and config changes for secret separation, safe defaults, local-vs-production behavior, Helm and Docker portability, and documentation parity.”

Source: Path instructions


148-148: LGTM!

Also applies to: 169-173


75-97: 🗄️ Data Integrity & Integration

No stale references exist in configs/config_frontier_models.yml.

The removed profile keys are not referenced in that configuration. Matches in other files are self-contained configurations and are unaffected.

			> Likely an incorrect or invalid review comment.

Walkthrough

The PR replaces frontier model profiles with GPT Sol and GPT Luna configurations. It adds schema-based structured-response fallback middleware to deep-research agents. Tests cover promotion, one-time correction, tool handling, middleware wiring, and runtime configuration.

Changes

Frontier model configuration

Layer / File(s) Summary
Model profiles and role mapping
configs/config_frontier_models.yml, tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
The frontier profile defines GPT Sol and GPT Luna settings. Clarifier and deep-research roles use the new profiles. Runtime tests verify model parameters and role assignments.

Structured response fallback

Layer / File(s) Summary
Fallback middleware and agent wiring
src/aiq_agent/agents/deep_researcher/custom_middleware.py, src/aiq_agent/agents/deep_researcher/factory.py
StructuredResponseTextFallbackMiddleware promotes valid schema JSON and performs one tool-free correction request for eligible invalid responses. The middleware is added to researcher, source-router, and planner stacks.
Fallback behavior validation
tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py, tests/aiq_agent/agents/deep_researcher/test_factory.py
Tests cover valid promotion, correction limits, invalid responses, native structured responses, tool calls, and middleware composition.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ResearcherRunnable
  participant StructuredResponseTextFallbackMiddleware
  participant AIModel
  participant PydanticSchema
  ResearcherRunnable->>StructuredResponseTextFallbackMiddleware: process response
  StructuredResponseTextFallbackMiddleware->>PydanticSchema: validate JSON text
  PydanticSchema-->>StructuredResponseTextFallbackMiddleware: validation result
  StructuredResponseTextFallbackMiddleware->>AIModel: request corrected schema JSON without tools
  AIModel-->>StructuredResponseTextFallbackMiddleware: corrected response
  StructuredResponseTextFallbackMiddleware->>PydanticSchema: validate corrected JSON
  StructuredResponseTextFallbackMiddleware-->>ResearcherRunnable: structured or original response
Loading

Possibly related PRs


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Title check ❌ Error The title describes the main change but does not follow Conventional Commits format because it lacks a valid type prefix. Rename it using a valid format, such as feat: support GPT frontier structured responses.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes all required sections, a valid DCO sign-off, detailed validation results, reviewer guidance, and related issue context.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ajay/gpt-structured-output-compat

Comment @coderabbitai help to get the list of available commands.

@AjayThorve
AjayThorve marked this pull request as ready for review August 4, 2026 05:00
@AjayThorve
AjayThorve requested a review from a team August 4, 2026 05:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py`:
- Around line 70-80: Extend the assertions in the deep-research runtime test to
validate the changed clarifier_agent model mapping as well as the existing
deep_research_agent mappings. Read the clarifier configuration from the relevant
config structure and assert its llm value against the expected model, while
preserving the current deep-research assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c13f94cd-3021-487c-8f09-48ba0d814004

📥 Commits

Reviewing files that changed from the base of the PR and between 9c1de32 and 37c088d.

📒 Files selected for processing (6)
  • configs/config_frontier_models.yml
  • src/aiq_agent/agents/deep_researcher/custom_middleware.py
  • src/aiq_agent/agents/deep_researcher/factory.py
  • tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py
  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
  • tests/aiq_agent/agents/deep_researcher/test_factory.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Lint and Hooks
  • GitHub Check: Pytest and Coverage
🧰 Additional context used
📓 Path-based instructions (7)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Format and lint Python with Ruff using a 120-character line length, Python 3.11 target, rules E/F/W/I/PL/UP, and single-line imports; avoid reformatting unrelated code.
Never print or log secret values, including through tool output or error messages.

**/*.py: Run uv run ruff check . and uv run ruff format --check . for root Python changes.
Run uv run pytest for root project Python changes.

Files:

  • src/aiq_agent/agents/deep_researcher/factory.py
  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
  • tests/aiq_agent/agents/deep_researcher/test_factory.py
  • src/aiq_agent/agents/deep_researcher/custom_middleware.py
  • tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py
src/aiq_agent/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/aiq_agent/**/*.py: Register new data sources in data_source_registry so the UI can toggle them.
Missing-secret paths must degrade gracefully by stubbing or skipping rather than crashing or leaking information.
Respect authenticated data sources by honoring requires_auth, passing through per-user tokens, using backend token validators, and applying owner guardrails before loading protected report or artifact context into an agent.
Do not weaken or bypass AuthMiddleware, token validators, or authentication gating without prior design discussion.

Files:

  • src/aiq_agent/agents/deep_researcher/factory.py
  • src/aiq_agent/agents/deep_researcher/custom_middleware.py
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Keep changes inside this repository, avoid editing adjacent repositories, and scope changes to the smallest relevant independent package, especially under sources/.
Run the narrowest relevant validation command first and broaden to the full suite only when a change crosses shared boundaries.
Keep pull requests scoped, exclude unrelated files and generated artifacts, never include secrets, and provide validation commands and results.

**/*: Do not include secrets, credentials, private hostnames, internal-only logs, customer data, or generated local artifacts.
Add or update tests for behavior changes.

Files:

  • src/aiq_agent/agents/deep_researcher/factory.py
  • tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py
  • tests/aiq_agent/agents/deep_researcher/test_factory.py
  • src/aiq_agent/agents/deep_researcher/custom_middleware.py
  • configs/config_frontier_models.yml
  • tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py
src/aiq_agent/agents/**/*

⚙️ CodeRabbit configuration file

src/aiq_agent/agents/**/*: Review agent changes for research workflow correctness, graph state transitions, prompt/tool contracts,
HITL behavior, and failure handling. Flag changes that weaken source attribution, report generation,
async cancellation, checkpointing, or data-source selection without focused tests and docs.

Files:

  • src/aiq_agent/agents/deep_researcher/factory.py
  • src/aiq_agent/agents/deep_researcher/custom_middleware.py
configs/**/*.y{a,}ml

📄 CodeRabbit inference engine (AGENTS.md)

Use _type values derived from the registered configuration class names in workflow YAML configuration.

Files:

  • configs/config_frontier_models.yml
**/*.{yaml,yml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

For deployment changes, run the relevant Helm or Compose validation and describe the environment used.

Files:

  • configs/config_frontier_models.yml
{deploy/**,configs/**}

⚙️ CodeRabbit configuration file

{deploy/**,configs/**}: Review deployment and config changes for secret separation, safe defaults, local-vs-production behavior, Helm and
Docker portability, and documentation parity. Flag committed credentials, environment-specific NVIDIA internals in
public defaults, and changes that make examples diverge from CI-tested paths.

Files:

  • configs/config_frontier_models.yml
🪛 ast-grep (0.45.0)
src/aiq_agent/agents/deep_researcher/custom_middleware.py

[info] 107-107: use jsonify instead of json.dumps for JSON output
Context: json.dumps(schema.model_json_schema(), separators=(",", ":"), ensure_ascii=False)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py

[info] 84-84: use jsonify instead of json.dumps for JSON output
Context: json.dumps(payload)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 98-98: use jsonify instead of json.dumps for JSON output
Context: json.dumps(payload)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 118-118: use jsonify instead of json.dumps for JSON output
Context: json.dumps(payload)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 178-178: use jsonify instead of json.dumps for JSON output
Context: json.dumps(self._routing())
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🔇 Additional comments (11)
configs/config_frontier_models.yml (4)

1-5: LGTM!


75-100: LGTM!


151-151: LGTM!


172-176: LGTM!

tests/aiq_agent/agents/deep_researcher/test_deepagents_runtime.py (1)

48-69: LGTM!

src/aiq_agent/agents/deep_researcher/custom_middleware.py (2)

35-36: LGTM!

Also applies to: 103-133, 143-159


135-141: 🎯 Functional Correctness

Verify that ModelRequest.override clears disabled fields.

The tests verify arguments passed to override, but MagicMock does not verify framework behavior. Confirm that response_format=None and tool_choice=None clear inherited values in the installed dependency set. If either value is retained, the corrective request can still use the original structured-output strategy.

Add a request-level integration test that records the effective tools, tool choice, and response format. As per coding guidelines, “Add or update tests for behavior changes.”

Source: Coding guidelines

src/aiq_agent/agents/deep_researcher/factory.py (2)

57-57: LGTM!

Also applies to: 390-390


462-462: 🗄️ Data Integrity & Integration

Verify that fallback promotion completes before persistence.

StructuredResponseTextFallbackMiddleware is placed before SourceRoutingPersistenceMiddleware and PlanPersistenceMiddleware. Confirm that the middleware stack promotes a corrected response before either persistence middleware reads or stores it. If a persistence middleware observes the raw invalid response first, it can persist an incomplete contract or fail before the fallback runs.

Add an integration test that sends invalid text followed by valid JSON and verifies that persistence receives only the promoted structured response. As per path instructions, “Review agent changes for research workflow correctness, graph state transitions, prompt/tool contracts, HITL behavior, and failure handling.” As per coding guidelines, “Add or update tests for behavior changes.”

Also applies to: 493-493

Sources: Coding guidelines, Path instructions

tests/aiq_agent/agents/deep_researcher/test_custom_middleware.py (1)

29-29: LGTM!

Also applies to: 48-53, 69-191

tests/aiq_agent/agents/deep_researcher/test_factory.py (1)

36-36: LGTM!

Also applies to: 267-277, 527-527

Signed-off-by: Ajay Thorve <athorve@nvidia.com>
@AjayThorve
AjayThorve force-pushed the ajay/gpt-structured-output-compat branch from 37c088d to 14cc75f Compare August 4, 2026 05:44
@AjayThorve AjayThorve added this to the v2.2 milestone Aug 4, 2026
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Comment thread configs/config_frontier_models.yml Resolved

@cdgamarose-nv cdgamarose-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor clarification, otherwise lgtm

rapids-bot Bot pushed a commit that referenced this pull request Aug 4, 2026
## Summary

- keep repository-wide Markdown link validation, but skip `build.nvidia.com` because NVIDIA Build returns HTTP 202 for valid pages and the checker treats that response as dead
- update the isolated MCP release lock from `aiohttp` 3.14.1 to 3.14.3 and from `cryptography` 48.0.1 to 50.0.0, resolving the newly published advisories blocking every PR
- preserve fail-closed runtime dependency validation with exact compatibility exceptions for `langchain-litellm`, `nvidia-nat-core`, and `oci`
- update the MCP security documentation and compatibility tests to match the audited release profile

## Root cause

PR #413 exposed two release-branch-wide CI failures unrelated to its GPT compatibility diff:

1. NVIDIA Build began returning HTTP 202 for valid public model and documentation pages. `markdown-link-check` classified every such page as dead.
2. New `aiohttp` and `cryptography` advisories were published after the current MCP release lock was created. The required production audit correctly rejected the vulnerable versions.

## Validation

- full `pre-commit run --all-files`
- MCP suite: 238 passed, 18 skipped
- CI script test harness: 11 passed, 0 failed
- production-only MCP sync and runtime import canary
- production vulnerability gate: 308 packages audited, 0 vulnerabilities
- CycloneDX SBOM and license inventory generation
- MCP wheel build and license-file assertion

The local Docker daemon was not running, so the Compose health/protocol smoke was not reproduced locally; GitHub Actions will exercise that boundary.



## Summary by CodeRabbit

* **Documentation**
  * Updated MCP release and security guidance for `cryptography` 50.0.0.
  * Clarified Linux x86_64 with CPython 3.13 support, container usage, and development-only platforms.
  * Documented unsupported macOS and 32-bit Windows configurations.

* **Chores**
  * Updated dependency resolution and validation rules for the new security baseline.
  * Excluded NVIDIA Build URLs from automated Markdown link checking.

* **Tests**
  * Expanded coverage for dependency compatibility and platform policy consistency.

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Tanner Leach (https://github.com/tanleach)

URL: #415
@AjayThorve

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 8a4b316 into release/2.2 Aug 4, 2026
11 checks passed
rapids-bot Bot pushed a commit that referenced this pull request Aug 5, 2026
#### Overview

Update AIQ 2.2 for the August model-deprecation wave while preserving the existing intent and shallow-research behavior until Nano 3.5 is publicly available:

- retain Nemotron 3 Super 120B A12B, with its existing aliases and generation profiles, for intent classification and shallow research;
- use Nemotron 3 Ultra 550B A55B for clarification and every default deep-research role;
- preserve the GPT Sol/Luna deep-role topology introduced by #413 in `config_frontier_models.yml`, while retaining Super for its intent/shallow fast path;
- replace the summary, embedding, and VLM defaults with Gemma 4 31B IT, Nemotron 3 Embed 1B, and Nemotron 3 Nano Omni respectively; and
- keep public configs on canonical Build model identifiers and NAT's standard `https://integrate.api.nvidia.com/v1` endpoint.

The Super exception is intentionally narrow and temporary. Nano 3.5 is excluded because its GA date is August 11. The intent/shallow switch, benchmarked shallow profile, and tool-first runtime guard are isolated in stacked draft #419 so this migration can merge without depending on a not-yet-public endpoint.

The migration covers shipping configs, benchmark profiles, knowledge-layer defaults, agent-skill assets, README/docs, launchable examples, and executable notebook config cells. Repository-wide regression tests enforce the Super intent/shallow and Ultra deep-role boundary while rejecting every other replaced model identifier and private inference endpoint reference.

This PR also makes persisted embedding stores fail closed when their model metadata is absent, incompatible, or owned by a different logical collection. Chroma and OpenSearch users receive explicit re-ingestion errors instead of silently querying vectors generated by a different embedding model; Azure AI Search already isolates and validates model/dimension compatibility.

The branch is rebased on #412. Its updated Brev getting-started notebook is preserved, with only the targeted model references and deep-role configuration changed here.

#### DCO sign-off for the squash commit

Signed-off-by: Ajay Thorve <athorve@nvidia.com>

#### Validation

- [x] `uv run pytest` — 2052 passed, 13 skipped
- [x] `uv run pre-commit run --all-files` — all hooks passed, including Ruff, YAML, secrets, agent-skill validation, notebook output clearing, and Markdown link checking
- [x] Focused knowledge-layer and default-profile tests — 64 passed
- [x] Shipping and FreshQA intent/shallow profiles match `release/2.2` exactly
- [x] All three changed notebooks parse as valid JSON after output clearing
- [x] `git diff --check`
- [x] All commits are DCO-signed and have verified GPG signatures
- [x] No Nano 3.5 identifier, private inference endpoint, secret, or credential is included

#### Where should reviewers start?

Start with `tests/aiq_agent/test_default_model_profiles.py` for the enforced model invariants, the shipping configs for the role mapping, and `sources/knowledge_layer/src/{llamaindex,opensearch}/adapter.py` for the embedding compatibility and ownership guards.

#### Related Issues

- Builds on the frontier-model compatibility work merged in #413.
- Preserves the Brev notebook update merged in #412.
- Relates to the August model endpoint deprecation migration.


## Summary by CodeRabbit

* **New Features**
  * Added role-specific Nemotron Ultra and Ultra Writer configurations for clarification, deep research, orchestration, and writing.
  * Retained the existing Nemotron Super profiles for intent classification and shallow research.
  * Updated default models for summaries, embeddings, and vision processing.
  * Added validation to detect incompatible, legacy, or incorrectly owned embedding indexes and collections before ingestion or search.

* **Documentation**
  * Refreshed setup guides, examples, notebooks, hardware guidance, and troubleshooting for the updated model lineup.
  * Added collection-safe migration guidance for embedding indexes and collections.

* **Tests**
  * Expanded coverage for model assignments, embedding compatibility, ownership checks, and fail-before-request behavior.

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Soumili Nandi (https://github.com/soumilinandi)

URL: #414
cdgamarose-nv pushed a commit to cdgamarose-nv/aiq that referenced this pull request Aug 10, 2026
## Summary

- keep repository-wide Markdown link validation, but skip `build.nvidia.com` because NVIDIA Build returns HTTP 202 for valid pages and the checker treats that response as dead
- update the isolated MCP release lock from `aiohttp` 3.14.1 to 3.14.3 and from `cryptography` 48.0.1 to 50.0.0, resolving the newly published advisories blocking every PR
- preserve fail-closed runtime dependency validation with exact compatibility exceptions for `langchain-litellm`, `nvidia-nat-core`, and `oci`
- update the MCP security documentation and compatibility tests to match the audited release profile

## Root cause

PR NVIDIA-AI-Blueprints#413 exposed two release-branch-wide CI failures unrelated to its GPT compatibility diff:

1. NVIDIA Build began returning HTTP 202 for valid public model and documentation pages. `markdown-link-check` classified every such page as dead.
2. New `aiohttp` and `cryptography` advisories were published after the current MCP release lock was created. The required production audit correctly rejected the vulnerable versions.

## Validation

- full `pre-commit run --all-files`
- MCP suite: 238 passed, 18 skipped
- CI script test harness: 11 passed, 0 failed
- production-only MCP sync and runtime import canary
- production vulnerability gate: 308 packages audited, 0 vulnerabilities
- CycloneDX SBOM and license inventory generation
- MCP wheel build and license-file assertion

The local Docker daemon was not running, so the Compose health/protocol smoke was not reproduced locally; GitHub Actions will exercise that boundary.



## Summary by CodeRabbit

* **Documentation**
  * Updated MCP release and security guidance for `cryptography` 50.0.0.
  * Clarified Linux x86_64 with CPython 3.13 support, container usage, and development-only platforms.
  * Documented unsupported macOS and 32-bit Windows configurations.

* **Chores**
  * Updated dependency resolution and validation rules for the new security baseline.
  * Excluded NVIDIA Build URLs from automated Markdown link checking.

* **Tests**
  * Expanded coverage for dependency compatibility and platform policy consistency.

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Tanner Leach (https://github.com/tanleach)

URL: NVIDIA-AI-Blueprints#415
cdgamarose-nv pushed a commit to cdgamarose-nv/aiq that referenced this pull request Aug 10, 2026
#### Overview

Some OpenAI-compatible frontier providers return the requested Pydantic contract as schema-valid JSON in ordinary assistant content instead of emitting the structured-output tool call. In deep research, that prevents `SourceRoutingPlan`, `ResearchPlan`, or `ResearchNotes` from reaching the persistence middleware and can leave the workflow retrying a completed stage.

This change:

- promotes exact, schema-valid JSON assistant content to the requested structured response;
- makes at most one tools-disabled corrective call for empty or invalid plain-text responses, so the fallback cannot spiral;
- leaves native structured responses and ordinary tool calls unchanged;
- applies the compatibility middleware only at the source-router, planner, and researcher structured-response boundaries; and
- updates the existing frontier profile to use the direct OpenAI provider with `OPENAI_API_KEY`: GPT Sol for orchestration, planning, and writing, and GPT Luna for source routing and research.

The default Ultra profile is unchanged.

#### DCO sign-off for the squash commit

Signed-off-by: Ajay Thorve <athorve@nvidia.com>

#### Validation

- [x] `uv run ruff check .`
- [x] `uv run pytest -q` — 2022 passed, 13 skipped
- [x] Focused post-format run — 183 passed
- [x] `uv run nat validate --config_file configs/config_frontier_models.yml`
- [x] `uv run nat validate --config_file configs/config_web_default_llamaindex.yml`
- [x] GPT Sol/Luna semantic smoke advanced through routing, planning, research, and writing with a non-sentinel cited report.
- [x] Deterministic 20-task GPT DRB-II pilot completed with 20/20 generation and 20/20 official judge coverage.
- [x] Patched-runtime Ultra regression smoke completed a DRB-II task with a 24.6k-character cited report, 1/1 clean collection, and no fallback correction. Harbor used one internal retry before the successful attempt.
- [x] I added or updated tests for behavior changes.
- [x] Documentation changes are not required; the user-facing frontier example config is updated directly.
- [x] I confirmed this PR does not include secrets, credentials, internal endpoints, or internal-only data.
- [x] I certify this contribution under the Developer Certificate of Origin (DCO) and signed my commit with `git commit -s`.
- [x] I replaced the DCO sign-off placeholder with my GitHub commit identity and kept the required angle brackets around the email address.

The remaining all-files Markdown-link and dependency-audit failures are release-branch-wide CI issues unrelated to this diff and are addressed separately by NVIDIA-AI-Blueprints#415.

#### Where should reviewers start?

Start with `StructuredResponseTextFallbackMiddleware` in `custom_middleware.py`, then its three placements in `factory.py`, and finally the direct-OpenAI Sol/Luna role split in `config_frontier_models.yml`.

#### Related Issues

- Relates to the model endpoint deprecation migration.



## Summary by CodeRabbit

* **New Features**
  * Improved deep-research reliability by automatically correcting responses that do not match the expected structured format.
  * Preserved valid structured responses while retrying invalid responses without tool calls.

* **Configuration**
  * Updated frontier-model workflows to use GPT Sol and GPT Luna for orchestration, planning, writing, routing, and research.
  * Updated model inference settings and token limits.

* **Tests**
  * Added coverage for structured-response recovery, retry behavior, middleware integration, and frontier-model configuration.

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Chantal D Gama Rose (https://github.com/cdgamarose-nv)

URL: NVIDIA-AI-Blueprints#413
cdgamarose-nv pushed a commit to cdgamarose-nv/aiq that referenced this pull request Aug 10, 2026
)

#### Overview

Update AIQ 2.2 for the August model-deprecation wave while preserving the existing intent and shallow-research behavior until Nano 3.5 is publicly available:

- retain Nemotron 3 Super 120B A12B, with its existing aliases and generation profiles, for intent classification and shallow research;
- use Nemotron 3 Ultra 550B A55B for clarification and every default deep-research role;
- preserve the GPT Sol/Luna deep-role topology introduced by NVIDIA-AI-Blueprints#413 in `config_frontier_models.yml`, while retaining Super for its intent/shallow fast path;
- replace the summary, embedding, and VLM defaults with Gemma 4 31B IT, Nemotron 3 Embed 1B, and Nemotron 3 Nano Omni respectively; and
- keep public configs on canonical Build model identifiers and NAT's standard `https://integrate.api.nvidia.com/v1` endpoint.

The Super exception is intentionally narrow and temporary. Nano 3.5 is excluded because its GA date is August 11. The intent/shallow switch, benchmarked shallow profile, and tool-first runtime guard are isolated in stacked draft NVIDIA-AI-Blueprints#419 so this migration can merge without depending on a not-yet-public endpoint.

The migration covers shipping configs, benchmark profiles, knowledge-layer defaults, agent-skill assets, README/docs, launchable examples, and executable notebook config cells. Repository-wide regression tests enforce the Super intent/shallow and Ultra deep-role boundary while rejecting every other replaced model identifier and private inference endpoint reference.

This PR also makes persisted embedding stores fail closed when their model metadata is absent, incompatible, or owned by a different logical collection. Chroma and OpenSearch users receive explicit re-ingestion errors instead of silently querying vectors generated by a different embedding model; Azure AI Search already isolates and validates model/dimension compatibility.

The branch is rebased on NVIDIA-AI-Blueprints#412. Its updated Brev getting-started notebook is preserved, with only the targeted model references and deep-role configuration changed here.

#### DCO sign-off for the squash commit

Signed-off-by: Ajay Thorve <athorve@nvidia.com>

#### Validation

- [x] `uv run pytest` — 2052 passed, 13 skipped
- [x] `uv run pre-commit run --all-files` — all hooks passed, including Ruff, YAML, secrets, agent-skill validation, notebook output clearing, and Markdown link checking
- [x] Focused knowledge-layer and default-profile tests — 64 passed
- [x] Shipping and FreshQA intent/shallow profiles match `release/2.2` exactly
- [x] All three changed notebooks parse as valid JSON after output clearing
- [x] `git diff --check`
- [x] All commits are DCO-signed and have verified GPG signatures
- [x] No Nano 3.5 identifier, private inference endpoint, secret, or credential is included

#### Where should reviewers start?

Start with `tests/aiq_agent/test_default_model_profiles.py` for the enforced model invariants, the shipping configs for the role mapping, and `sources/knowledge_layer/src/{llamaindex,opensearch}/adapter.py` for the embedding compatibility and ownership guards.

#### Related Issues

- Builds on the frontier-model compatibility work merged in NVIDIA-AI-Blueprints#413.
- Preserves the Brev notebook update merged in NVIDIA-AI-Blueprints#412.
- Relates to the August model endpoint deprecation migration.


## Summary by CodeRabbit

* **New Features**
  * Added role-specific Nemotron Ultra and Ultra Writer configurations for clarification, deep research, orchestration, and writing.
  * Retained the existing Nemotron Super profiles for intent classification and shallow research.
  * Updated default models for summaries, embeddings, and vision processing.
  * Added validation to detect incompatible, legacy, or incorrectly owned embedding indexes and collections before ingestion or search.

* **Documentation**
  * Refreshed setup guides, examples, notebooks, hardware guidance, and troubleshooting for the updated model lineup.
  * Added collection-safe migration guidance for embedding indexes and collections.

* **Tests**
  * Expanded coverage for model assignments, embedding compatibility, ownership checks, and fail-before-request behavior.

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Soumili Nandi (https://github.com/soumilinandi)

URL: NVIDIA-AI-Blueprints#414
@coderabbitai coderabbitai Bot mentioned this pull request Aug 12, 2026
8 tasks done
@AjayThorve
AjayThorve deleted the ajay/gpt-structured-output-compat branch September 2, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants