NeMo Helix Python SDK Reference
The NeMo Helix Python SDK is a library for building and deploying AI models, abstracting the underlying infrastructure and providing a high-level interface for the NeMo Helix APIs.
Installation
Install the PyPI nemo-helix wrapper package using pip. The wrapper defines the all extra and includes the SDK. If you are working from a source checkout, run make bootstrap from the repository root instead; the generated SDK package under sdk/python/nemo-helix/pyproject.toml does not define the wrapper extras.
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.
If you previously installed the nemo-microservices package, uninstall it first to avoid conflicts:
Usage
This section describes how to use the NeMo Helix Python SDK. The SDK is built on the typed NemoClient, which exposes per-service resource clients (for example client.files, client.workspaces, client.secrets, client.jobs) that you call directly.
Import the Main Client Class
Import the main client class from the nemo_helix_plugin.client package and create a client instance as follows:
After creating the client instance, you can use the client to interact with NeMo Helix APIs. Each call returns a NemoResponse; use .data() for a single entity or .items() for a paginated list.
Async Usage
If you want to use the asynchronous client, import AsyncNemoClient instead of NemoClient and use await with each API call:
Functionality between the synchronous and asynchronous clients is otherwise identical.
Using Types
Request bodies are Pydantic models that you pass to the body= argument of each method, and responses are Pydantic models too:
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs, set python.analysis.typeCheckingMode to basic.
Pagination
List methods in the NeMo Helix API are paginated. Each list call returns a NemoPaginatedResponse, which you can iterate with .items() (all items across pages) or .pages() (page by page):
Or, asynchronously:
To work page by page, use .pages() (or await .pages() for the async client) and iterate the .items on each page result:
Handling Errors
The library raises errors when it cannot connect to the API or when the API returns a non-success status code.
When the library cannot connect to the API (for example, due to network connection problems or a timeout), it raises NemoTransportError.
When the API returns a non-success status code (that is, 4xx or 5xx response), it raises a subclass of NemoHTTPError containing status_code and detail properties. All errors inherit from NemoClientError.
Error codes are as follows:
Retries and Timeouts
By default, requests time out after 60 seconds. You can configure this with the timeout option, which accepts a float or an httpx.Timeout object:
You can configure automatic retries with a RetryPolicy through the retry option, and override either per client with with_options:
Next Steps
- Read more about connecting with the client APIs.
- Browse the REST API Reference.