ibm_aigov_facts_client.factsheet.asset_utils_prompt module
- class AIGovAssetUtilities(assets_client: Assets, json_data: dict, model_id: str = None, container_type: str = None, container_id: str = None, facts_type: str = None)
Bases:
ModelAssetUtilitiesAI asset utilities. Running client.assets.get_prompt() makes all methods in AIGovAssetUtilities object available to use.
- classmethod from_dict(_dict: Dict) AIGovAssetUtilities
Initialize a AIGovAssetUtilities object from a json dictionary.
- to_dict() Dict
Return a json dictionary representing this model.
- set_environment_type(from_container: str, to_container: str) None
This method is not available for prompt.
- get_experiment(experiment_name: str = None) NotebookExperimentUtilities
This method is not available for prompt.
- is_detached() bool
Check if the fetched prompt is in offline mode.
- Returns:
bool: True if the fetched prompt is offline and headless, False otherwise.
- Raises:
ClientError: If the fetched prompt mode is not ‘detached’.
Example:
prompt.is_offline()
- get_asset_id()
Extracts the asset_id from the Prompt created.
Returns: str: The asset_id if found, otherwise None.
- get_info(verbose=False)
Get info of the fetched prompt.
This method retrieves all available details of the fetched prompt and returns them as a dictionary.
- Args:
verbose (bool): If True, include all details. Default is False.
- Returns:
dict: A dictionary containing the prompt details.
- Raises:
ValueError: If no prompt data is available.
- get_prompt_variables() str
Get the prompt variables of the fetched prompt.
This method retrieves the prompt variables from the fetched prompt.
- Returns:
str: A string representation of the prompt variables.
- Raises:
ValueError: If no prompt data is available.
Example:
prompt.get_prompt_variables()
- update_prompt_attribute(key_name: str, value: Any)
Update a specific attribute of the fetched prompt.
This method updates a any attribute of the fetched prompt with the provided key name and value.
- Parameters:
key_name (str): The name of the attribute to be updated. value (Any): The new value for the attribute. It can be of any type.
- Raises:
ClientError: If the update operation fails.
Example:
prompt.update_prompt_attribute(key_name="task_id", value="Next steps")
- update_prompt_variables(prompt_variables: dict)
Update the prompt variables for the prompt.
This method takes a dictionary of prompt variables and updates the prompt variables of the prompt.
- Parameters:
prompt_variables (dict): A dictionary containing the new prompt variables.
Example:
prompt.update_prompt_variables(prompt_variables={"text": {}})
- update_prompt_name(name: str)
Update or set the name of the Prompt.
This method allows the setting or updating of the prompt ‘name’ to a new value.
- Parameters:
name (str): The new name to assign to the instance. This should be a non-empty string.
Example:
prompt.update_prompt_name(name="NewName")
- update_prompt_description(prompt_description: str)
Update or set the description of the prompt.
This method allows for the setting or updating of prompt description to a new value.
- Parameters:
prompt_description (str): The new description to assign to the external prompt.
Example:
prompt.update_prompt_description(prompt_description="description")
- untrack()
Unlink prompt from it’s usecase and approach
Example for IBM Cloud or CPD:
>>> prompt.untrack()
- get_deployments() List
This method is not available for prompt.
- delete_deployments(deployment_ids: list = None)
This method is not available for prompt.
- add_deployments(deployments: list = None) list
This method is not available for prompt.
- get_version() Dict
Get prompt template version details. Supported for CPD version >=4.7.0
- Return type:
dict
The way to use me is:
>>> get_prompt.get_version()