nemo_microservices.resources.models#

Module Contents#

Classes#

API#

class nemo_microservices.resources.models.AsyncModelsResource(
client: nemo_microservices._client.AsyncNeMoMicroservices,
)#

Bases: nemo_microservices._resource.AsyncAPIResource

Initialization

async create(
*,
api_endpoint: nemo_microservices.types.shared_params.api_endpoint_data.APIEndpointData | nemo_microservices._types.Omit = omit,
artifact: nemo_microservices.types.shared_params.model_artifact.ModelArtifact | nemo_microservices._types.Omit = omit,
base_model: str | Dict[str, object] | nemo_microservices._types.Omit = omit,
custom_fields: Dict[str, object] | nemo_microservices._types.Omit = omit,
description: str | nemo_microservices._types.Omit = omit,
guardrails: nemo_microservices.types.shared_params.guardrail_config_param.GuardrailConfigParam | nemo_microservices._types.Omit = omit,
name: str | nemo_microservices._types.Omit = omit,
namespace: str | nemo_microservices._types.Omit = omit,
ownership: nemo_microservices.types.shared_params.ownership.Ownership | nemo_microservices._types.Omit = omit,
peft: nemo_microservices.types.shared_params.parameter_efficient_finetuning_data.ParameterEfficientFinetuningData | nemo_microservices._types.Omit = omit,
project: str | nemo_microservices._types.Omit = omit,
prompt: nemo_microservices.types.shared_params.prompt_data.PromptData | nemo_microservices._types.Omit = omit,
spec: nemo_microservices.types.shared_params.model_spec.ModelSpec | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Create a new model.

Args: api_endpoint: Data about an API endpoint.

artifact: Data about a model artifact (a set of checkpoint files, configs, and other auxiliary info).

  The `files_url` field can point to a DataStore location.

  Example:

  - nds://models/rdinu/my-lora-customization

  The `rdinu/my-lora-customization` part above is the actual repository.

  If a specific revision needs to be referred, the HuggingFace syntax is used.

  - nds://models/rdinu/my-lora-customization@v1
  - nds://models/rdinu/my-lora-customization@8df79a8

base_model: Link to another model which is used as a base for the current model.

custom_fields: A set of custom fields that the user can define and use for various purposes.

description: The description of the entity.

guardrails: A guardrail configuration

name: The name of the entity. Must be unique inside the namespace. If not specified, it will be the same as the automatically generated id.

namespace: The namespace of the entity. This can be missing for namespace entities or in deployments that don’t use namespaces.

ownership: Information about ownership of an entity.

  If the entity is a namespace, the `access_policies` will typically apply to all
  entities inside the namespace.

peft: Data about a parameter-efficient finetuning.

project: The URN of the project associated with this entity.

prompt: Prompt engineering data.

spec: Detailed specification about a model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async delete(
model_name: str,
*,
namespace: str,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.shared.delete_response.DeleteResponse#

Delete Model

Args: extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

list(
*,
filter: nemo_microservices.types.model_filter_param.ModelFilterParam | nemo_microservices._types.Omit = omit,
page: int | nemo_microservices._types.Omit = omit,
page_size: int | nemo_microservices._types.Omit = omit,
search: nemo_microservices.types.model_search_param.ModelSearchParam | nemo_microservices._types.Omit = omit,
sort: nemo_microservices.types.model_sort_field.ModelSortField | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices._base_client.AsyncPaginator[nemo_microservices.types.model.Model, nemo_microservices.pagination.AsyncDefaultPagination[nemo_microservices.types.model.Model]]#

Return the list of available models.

Args: filter: Filter models on various criteria.

  Where it makes sense, you can also filter on the existence of a property. For
  example:

  - `?filter[peft]=true`: would filter all models with `peft` attribute set.

page: Page number.

page_size: Page size.

search: Search models using substring matching. You can combine multiple search fields and filters.

  For example:

  - `?search[name]=llama`: searches all models with 'llama' in the name.
  - `?search[base_model]=mistral`: searches all models with 'mistral' in the
    base_model.
  - `?search[peft]=lora`: searches all models with 'lora' in the peft field.
  - `?search[custom_property][item]=adapter`: searches all models where the
    custom_property's item contains 'adapter'.
  - `?search[name]=llama&search[peft]=lora`: searches all models with 'llama' in
    the name AND 'lora' in the peft field.
  - `?search[name]=llama&search[name]=gpt`: searches all models with 'llama' OR
    'gpt' in the name.
  - `?search[updated_at][start]=2024-01-01T00:00:00` finds all models updated on
    or after the start date
  - `?search[created_at][start]=2022-01-01&search[updated_at][end]=2024-01-01`
    finds all models created from start date up to and including end date

sort: The field to sort by. To sort in decreasing order, use - in front of the field name.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async retrieve(
model_name: str,
*,
namespace: str,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Get model info.

Args: extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async update(
model_name: str,
*,
namespace: str,
api_endpoint: nemo_microservices.types.shared_params.api_endpoint_data.APIEndpointData | nemo_microservices._types.Omit = omit,
artifact: nemo_microservices.types.shared_params.model_artifact.ModelArtifact | nemo_microservices._types.Omit = omit,
base_model: nemo_microservices.types.model_update_params.BaseModel | nemo_microservices._types.Omit = omit,
custom_fields: Dict[str, object] | nemo_microservices._types.Omit = omit,
description: str | nemo_microservices._types.Omit = omit,
guardrails: nemo_microservices.types.shared_params.guardrail_config_param.GuardrailConfigParam | nemo_microservices._types.Omit = omit,
ownership: nemo_microservices.types.shared_params.ownership.Ownership | nemo_microservices._types.Omit = omit,
peft: nemo_microservices.types.shared_params.parameter_efficient_finetuning_data.ParameterEfficientFinetuningData | nemo_microservices._types.Omit = omit,
project: str | nemo_microservices._types.Omit = omit,
prompt: nemo_microservices.types.shared_params.prompt_data.PromptData | nemo_microservices._types.Omit = omit,
schema_version: str | nemo_microservices._types.Omit = omit,
spec: nemo_microservices.types.shared_params.model_spec.ModelSpec | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Update model metadata.

If the request body has an empty field, keep the old value.

Args: api_endpoint: Data about an API endpoint.

artifact: Data about a model artifact (a set of checkpoint files, configs, and other auxiliary info).

  The `files_url` field can point to a DataStore location.

  Example:

  - nds://models/rdinu/my-lora-customization

  The `rdinu/my-lora-customization` part above is the actual repository.

  If a specific revision needs to be referred, the HuggingFace syntax is used.

  - nds://models/rdinu/my-lora-customization@v1
  - nds://models/rdinu/my-lora-customization@8df79a8

base_model: Link to another model which is used as a base for the current model.

custom_fields: A set of custom fields that the user can define and use for various purposes.

description: The description of the entity.

guardrails: A guardrail configuration

ownership: Information about ownership of an entity.

  If the entity is a namespace, the `access_policies` will typically apply to all
  entities inside the namespace.

peft: Data about a parameter-efficient finetuning.

project: The URN of the project associated with this entity.

prompt: Prompt engineering data.

schema_version: The version of the schema for the object. Internal use only.

spec: Detailed specification about a model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property with_raw_response: nemo_microservices.resources.models.AsyncModelsResourceWithRawResponse#

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://docs.nvidia.com/nemo/microservices/latest/pysdk/index.html#accessing-raw-response-data-e-g-headers

property with_streaming_response: nemo_microservices.resources.models.AsyncModelsResourceWithStreamingResponse#

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://docs.nvidia.com/nemo/microservices/latest/pysdk/index.html#with_streaming_response

class nemo_microservices.resources.models.AsyncModelsResourceWithRawResponse(
models: nemo_microservices.resources.models.AsyncModelsResource,
)#

Initialization

class nemo_microservices.resources.models.AsyncModelsResourceWithStreamingResponse(
models: nemo_microservices.resources.models.AsyncModelsResource,
)#

Initialization

class nemo_microservices.resources.models.ModelsResource(client: nemo_microservices._client.NeMoMicroservices)#

Bases: nemo_microservices._resource.SyncAPIResource

Initialization

create(
*,
api_endpoint: nemo_microservices.types.shared_params.api_endpoint_data.APIEndpointData | nemo_microservices._types.Omit = omit,
artifact: nemo_microservices.types.shared_params.model_artifact.ModelArtifact | nemo_microservices._types.Omit = omit,
base_model: str | Dict[str, object] | nemo_microservices._types.Omit = omit,
custom_fields: Dict[str, object] | nemo_microservices._types.Omit = omit,
description: str | nemo_microservices._types.Omit = omit,
guardrails: nemo_microservices.types.shared_params.guardrail_config_param.GuardrailConfigParam | nemo_microservices._types.Omit = omit,
name: str | nemo_microservices._types.Omit = omit,
namespace: str | nemo_microservices._types.Omit = omit,
ownership: nemo_microservices.types.shared_params.ownership.Ownership | nemo_microservices._types.Omit = omit,
peft: nemo_microservices.types.shared_params.parameter_efficient_finetuning_data.ParameterEfficientFinetuningData | nemo_microservices._types.Omit = omit,
project: str | nemo_microservices._types.Omit = omit,
prompt: nemo_microservices.types.shared_params.prompt_data.PromptData | nemo_microservices._types.Omit = omit,
spec: nemo_microservices.types.shared_params.model_spec.ModelSpec | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Create a new model.

Args: api_endpoint: Data about an API endpoint.

artifact: Data about a model artifact (a set of checkpoint files, configs, and other auxiliary info).

  The `files_url` field can point to a DataStore location.

  Example:

  - nds://models/rdinu/my-lora-customization

  The `rdinu/my-lora-customization` part above is the actual repository.

  If a specific revision needs to be referred, the HuggingFace syntax is used.

  - nds://models/rdinu/my-lora-customization@v1
  - nds://models/rdinu/my-lora-customization@8df79a8

base_model: Link to another model which is used as a base for the current model.

custom_fields: A set of custom fields that the user can define and use for various purposes.

description: The description of the entity.

guardrails: A guardrail configuration

name: The name of the entity. Must be unique inside the namespace. If not specified, it will be the same as the automatically generated id.

namespace: The namespace of the entity. This can be missing for namespace entities or in deployments that don’t use namespaces.

ownership: Information about ownership of an entity.

  If the entity is a namespace, the `access_policies` will typically apply to all
  entities inside the namespace.

peft: Data about a parameter-efficient finetuning.

project: The URN of the project associated with this entity.

prompt: Prompt engineering data.

spec: Detailed specification about a model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

delete(
model_name: str,
*,
namespace: str,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.shared.delete_response.DeleteResponse#

Delete Model

Args: extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

list(
*,
filter: nemo_microservices.types.model_filter_param.ModelFilterParam | nemo_microservices._types.Omit = omit,
page: int | nemo_microservices._types.Omit = omit,
page_size: int | nemo_microservices._types.Omit = omit,
search: nemo_microservices.types.model_search_param.ModelSearchParam | nemo_microservices._types.Omit = omit,
sort: nemo_microservices.types.model_sort_field.ModelSortField | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.pagination.SyncDefaultPagination[nemo_microservices.types.model.Model]#

Return the list of available models.

Args: filter: Filter models on various criteria.

  Where it makes sense, you can also filter on the existence of a property. For
  example:

  - `?filter[peft]=true`: would filter all models with `peft` attribute set.

page: Page number.

page_size: Page size.

search: Search models using substring matching. You can combine multiple search fields and filters.

  For example:

  - `?search[name]=llama`: searches all models with 'llama' in the name.
  - `?search[base_model]=mistral`: searches all models with 'mistral' in the
    base_model.
  - `?search[peft]=lora`: searches all models with 'lora' in the peft field.
  - `?search[custom_property][item]=adapter`: searches all models where the
    custom_property's item contains 'adapter'.
  - `?search[name]=llama&search[peft]=lora`: searches all models with 'llama' in
    the name AND 'lora' in the peft field.
  - `?search[name]=llama&search[name]=gpt`: searches all models with 'llama' OR
    'gpt' in the name.
  - `?search[updated_at][start]=2024-01-01T00:00:00` finds all models updated on
    or after the start date
  - `?search[created_at][start]=2022-01-01&search[updated_at][end]=2024-01-01`
    finds all models created from start date up to and including end date

sort: The field to sort by. To sort in decreasing order, use - in front of the field name.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

retrieve(
model_name: str,
*,
namespace: str,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Get model info.

Args: extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

update(
model_name: str,
*,
namespace: str,
api_endpoint: nemo_microservices.types.shared_params.api_endpoint_data.APIEndpointData | nemo_microservices._types.Omit = omit,
artifact: nemo_microservices.types.shared_params.model_artifact.ModelArtifact | nemo_microservices._types.Omit = omit,
base_model: nemo_microservices.types.model_update_params.BaseModel | nemo_microservices._types.Omit = omit,
custom_fields: Dict[str, object] | nemo_microservices._types.Omit = omit,
description: str | nemo_microservices._types.Omit = omit,
guardrails: nemo_microservices.types.shared_params.guardrail_config_param.GuardrailConfigParam | nemo_microservices._types.Omit = omit,
ownership: nemo_microservices.types.shared_params.ownership.Ownership | nemo_microservices._types.Omit = omit,
peft: nemo_microservices.types.shared_params.parameter_efficient_finetuning_data.ParameterEfficientFinetuningData | nemo_microservices._types.Omit = omit,
project: str | nemo_microservices._types.Omit = omit,
prompt: nemo_microservices.types.shared_params.prompt_data.PromptData | nemo_microservices._types.Omit = omit,
schema_version: str | nemo_microservices._types.Omit = omit,
spec: nemo_microservices.types.shared_params.model_spec.ModelSpec | nemo_microservices._types.Omit = omit,
extra_headers: nemo_microservices._types.Headers | None = None,
extra_query: nemo_microservices._types.Query | None = None,
extra_body: nemo_microservices._types.Body | None = None,
timeout: float | httpx.Timeout | None | nemo_microservices._types.NotGiven = not_given,
) nemo_microservices.types.model.Model#

Update model metadata.

If the request body has an empty field, keep the old value.

Args: api_endpoint: Data about an API endpoint.

artifact: Data about a model artifact (a set of checkpoint files, configs, and other auxiliary info).

  The `files_url` field can point to a DataStore location.

  Example:

  - nds://models/rdinu/my-lora-customization

  The `rdinu/my-lora-customization` part above is the actual repository.

  If a specific revision needs to be referred, the HuggingFace syntax is used.

  - nds://models/rdinu/my-lora-customization@v1
  - nds://models/rdinu/my-lora-customization@8df79a8

base_model: Link to another model which is used as a base for the current model.

custom_fields: A set of custom fields that the user can define and use for various purposes.

description: The description of the entity.

guardrails: A guardrail configuration

ownership: Information about ownership of an entity.

  If the entity is a namespace, the `access_policies` will typically apply to all
  entities inside the namespace.

peft: Data about a parameter-efficient finetuning.

project: The URN of the project associated with this entity.

prompt: Prompt engineering data.

schema_version: The version of the schema for the object. Internal use only.

spec: Detailed specification about a model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property with_raw_response: nemo_microservices.resources.models.ModelsResourceWithRawResponse#

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://docs.nvidia.com/nemo/microservices/latest/pysdk/index.html#accessing-raw-response-data-e-g-headers

property with_streaming_response: nemo_microservices.resources.models.ModelsResourceWithStreamingResponse#

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://docs.nvidia.com/nemo/microservices/latest/pysdk/index.html#with_streaming_response

class nemo_microservices.resources.models.ModelsResourceWithRawResponse(
models: nemo_microservices.resources.models.ModelsResource,
)#

Initialization

class nemo_microservices.resources.models.ModelsResourceWithStreamingResponse(
models: nemo_microservices.resources.models.ModelsResource,
)#

Initialization