Fetch AI assets details

Important

The get_model() function retrieves detailed information about both wml and external models, providing users with versatile model management capabilities.

Model Asset

get_model(self, model_id: str = None, container_type: str = None, container_id: str = None, wml_stored_model_details: dict = None)

Get model asset.

Parameters:
  • model_id (str) – (Optional) Id of the traditional machine learning model asset.

  • container_type (str) – (Optional) Name of the container where model is saved. Currently supported container_type are space or project. For external models it is not needed and defaulted to catalog.

  • container_id (str) – (Optional) Id of the container where model asset is saved. For external models, it refers to catalog id where model stub is saved. if not provided for external models,if available and user have access, default platform asset catalog is used

  • wml_stored_model_details (dict) – (Optional) Watson machine learning model details. Applied to Watson Machine Learning models only.

Return type:

ModelAssetUtilities

The way to use me is:

>>> client.assets.get_model(model_id=<model_id>) # uses container type and id used to initiate client
>>> client.assets.get_model(model_id=<model id>,container_type=<space or project>,container_id=<space or project id>)
>>> client.assets.get_model(wml_stored_model_details=<wml model details>) # uses model id, container type and id part of model details

for external models,

>>> client.assets.get_model(model_id=<model_id>) # uses available platform asset catalog id as container_id
>>> client.assets.get_model(model_id=<model_id>,container_id=<catalog id>)

Prompt Asset

get_prompt(self, asset_id: str, container_type: str = None, container_id: str = None) AIGovAssetUtilities

Retrieve a prompt asset from the AI government asset utilities.

This method allows retrieval of a prompt asset from the AI government asset utilities, either by providing the ID of the prompt, or by specifying the container type and container ID where the prompt is stored.

Parameters:
  • prompt_id (str): The ID of the prompt asset to retrieve.

  • container_type (str optional): The type of container where the prompt is stored.

  • container_id (str optional): The ID of the container where the prompt is stored.

Returns:

AIGovAssetUtilities: An instance of AIGovAssetUtilities for managing the retrieved prompt asset.

Note:
  • To retrieve a prompt asset, either the ‘prompt_id’ or both ‘container_type’ and ‘container_id’ must be provided.

  • If ‘prompt_id’ is provided, the method will directly fetch the prompt with that ID.

  • If ‘container_type’ and ‘container_id’ are provided, the method will search for the prompt within the specified container.

Example usage,:

#Retrieve a prompt asset using prompt ID
retrieved_prompt= facts_client.asests.get_prompt(asset_id="********")
retrieved_prompt= facts_client.asests.get_prompt(asset_id="********")
# Retrieve a prompt asset using container type and container ID
retrieved_prompt= facts_client.asests.get_prompt(asset_id="********",container_type="project", container_id"*****")
retrieved_prompt= facts_client.asests.get_prompt(asset_id="********",container_type="project", container_id"*****")