Install the NeMo Microservices Python SDK#

The NeMo Microservices Python SDK provides convenient access to the NeMo Microservices REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients.

Prerequisites#

Following are the prerequisites for using the Python SDK:

  • Python 3.8 or higher

  • pip package manager

Installation#

pip install nemo-microservices

Note

This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.

Verify Installation#

After installation, verify that the SDK is properly installed by running:

python -c "import nemo_microservices; print('NeMo Microservices SDK installed successfully')"

Basic Usage#

Use the Python SDK by creating a client and making requests to the NeMo Microservices API as follows.

Synchronous Client#

from nemo_microservices import NeMoMicroservices

# Initialize the client
client = NeMoMicroservices(
    base_url="http://nemo.test",
    inference_base_url="http://nim.test"
)

# List namespaces
namespaces = client.namespaces.list()
print(namespaces.data)

Asynchronous Client#

import asyncio
from nemo_microservices import AsyncNeMoMicroservices

async def main():
    # Initialize the async client
    client = AsyncNeMoMicroservices(
        base_url="http://nemo.test",
        inference_base_url="http://nim.test"
    )
    
    # List namespaces
    namespaces = await client.namespaces.list()
    print(namespaces.data)

# Run the async function
asyncio.run(main())

After you successfully installed and verified the SDK, proceed to the next section Beginner Tutorials for getting started.