refactor(models): migrate models consumers to typed ModelsClient - #1491
Open
maxdubrinsky wants to merge 5 commits into
Open
refactor(models): migrate models consumers to typed ModelsClient#1491maxdubrinsky wants to merge 5 commits into
maxdubrinsky wants to merge 5 commits into
Conversation
…ent compat layer Add 8 new typed HTTP clients in nemo_platform_plugin, following the proven files/models pattern (types.py + endpoints.py + client.py): - workspaces: WorkspacesClient (workspace + members CRUD) - guardrail: GuardrailClient (config CRUD + check) - projects: ProjectsClient (CRUD) - agents: AgentsClient (agent + deployment CRUD + invoke) - auditor: AuditorClient (config/target CRUD + submit + job list/get) - iron_swarm: IronSwarmClient (manifest CRUD + refresh + run CRUD + validate_model) - evaluator: EvaluatorClient (submit jobs + results + metrics CRUD) - data_designer: DataDesignerClient (preview stream + job CRUD) Add convenience properties to BaseNemoClient so sdk.files, sdk.models, sdk.workspaces, etc. each return the corresponding typed client via from_client(self). Add _InferenceNamespace compat shim dispatching sdk.inference.providers/deployments/virtual_models to the existing ModelsClient/VirtualModelsClient. Add NemoResponse.__getattr__ proxy delegating unknown attribute access to the parsed body, so callers use result.name instead of result.data().name (eliminates .data() unwrapping at ~980 call sites during consumer migration). Purely additive: no existing code changed, only additions. The Stainless SDK remains in place; this builds the landing pad for the per-area consumer migration PRs. AIRCORE-1058 Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
…lient Add _client property (returns the underlying httpx transport) and default_headers property (returns the default headers dict) to BaseNemoClient. Plugin SDK resources (auditor, evaluator, anonymizer, data-designer, customizer, safe-synthesizer, insights) access platform._client and platform.default_headers to make raw HTTP calls. These properties let them work with NemoClient after the spine flip. AIRCORE-1058 Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Add __getattr__ to BaseNemoClient that mirrors NeMoPlatform's plugin SDK discovery: discovers plugin SDK resources via entry points (discover_sdk) and instantiates them with self as the platform. Handles sdk.auditor, sdk.evaluator, sdk.agents, sdk.iron_swarm, sdk.anonymizer, sdk.customizer, and any other plugin-level resource not covered by convenience properties. Combined with the _client property (previous commit), this lets plugin SDK resources work with NemoClient after the spine flip without any changes to the plugin code. AIRCORE-1058 Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
maxdubrinsky
marked this pull request as ready for review
August 24, 2026 18:26
maxdubrinsky
force-pushed
the
aircore-827-migrate-models/mdubrinsky
branch
from
August 24, 2026 18:35
854a062 to
fa107bb
Compare
maxdubrinsky
marked this pull request as draft
August 24, 2026 18:38
maxdubrinsky
force-pushed
the
aircore-827-migrate-models/mdubrinsky
branch
4 times, most recently
from
August 24, 2026 21:03
048e329 to
359387f
Compare
maxdubrinsky
marked this pull request as ready for review
August 24, 2026 21:09
Migrate models API call sites from sdk.models.* (Stainless SDK) to client_from_platform(sdk, ModelsClient).* (typed HTTP client), following the pattern established in #1277. 22 files changed across e2e tests, services, plugins, and test utilities. Key migrations: - sdk.models.retrieve -> get_model().data() - sdk.models.create -> create_model(body=CreateModelEntityRequest(...)).data() - sdk.models.update -> update_model(body=UpdateModelEntityRequest(...)).data() - sdk.models.list -> list_models(...).items() - sdk.models.wait_for_openai_model -> wait_for_openai_model(...) - sdk.models.get_provider_route_openai_url -> get_provider_route_openai_url(...) - Error imports: APIStatusError->NemoHTTPError, APIConnectionError/APITimeoutError->NemoTransportError - Type imports: nemo_platform.types.* -> nemo_platform_plugin.models.types.* Skipped (SDK infrastructure, not consumers): - packages/models/src/models/resources.py (extended ModelsResource, deleted with SDK) - packages/models/tests/test_client.py (tests SDK infrastructure) - Auto-generated CLI files (4 files) AIRCORE-827 Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
maxdubrinsky
force-pushed
the
aircore-827-migrate-models/mdubrinsky
branch
from
August 24, 2026 22:04
359387f to
2eec4cf
Compare
mckornfield
approved these changes
Aug 24, 2026
| """Create model entity if missing; ignore already-exists conflicts.""" | ||
| try: | ||
| sdk.models.create( | ||
| client_from_platform(sdk, ModelsClient).create_model( |
Contributor
There was a problem hiding this comment.
I've been reading this so my eyes are glazing over, but is "client_from_platform" the best name, or is it something like client_from_sdk or to_client? idk
maxdubrinsky
force-pushed
the
mdubrinsky/aircore-1058-add-typed-clients-for-remaining-service-areas-nemoclient
branch
from
August 25, 2026 16:35
2070a49 to
c8aeb8a
Compare
Base automatically changed from
mdubrinsky/aircore-1058-add-typed-clients-for-remaining-service-areas-nemoclient
to
main
August 25, 2026 20:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate models API call sites from
sdk.models.*(Stainless SDK) toclient_from_platform(sdk, ModelsClient).*(typed HTTP client), following the pattern established in #1277.Related Issue
AIRCORE-827
Changes
22 files changed across e2e tests, services, plugins, and test utilities:
sdk.models.retrieve->get_model().data()sdk.models.create->create_model(body=CreateModelEntityRequest(...)).data()sdk.models.update->update_model(body=UpdateModelEntityRequest(...)).data()sdk.models.list->list_models(...).items()sdk.models.wait_for_openai_model->wait_for_openai_model(...)sdk.models.get_provider_route_openai_url->get_provider_route_openai_url(...)APIStatusError->NemoHTTPError,APIConnectionError/APITimeoutError->NemoTransportErrornemo_platform.types.*->nemo_platform_plugin.models.typesSkipped (SDK infrastructure, not consumers):
packages/models/src/models/resources.py(extended ModelsResource, deleted with SDK)packages/models/tests/test_client.py(tests SDK infrastructure)Type of Change
Quality Gates
Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowTargeted validation:
py_compileon all 22 files: compile OKuv run ruff check: all checks passuv run ruff format: all files formatted