Helper Class

ExternalModelSchemas

class ExternalModelSchemas(input: List[Dict], output: List[Dict] = None)

External model schema

Variables:
  • input (List[Dict]) – Model input data schema

  • output (List[Dict]) – (optional) Model output data schema

ModelDetails

class ModelDetails(model_type: str = None, input_type: str = None, algorithm: str = None, label_type: str = None, label_column: str = None, prediction_type: str = None, software_spec: str = None, software_spec_id: str = None, provider: str = None)

External model model details

Variables:
  • model_type (str) – Value for model type

  • input_type (str) – Value for inout type

  • algorithm (str) – Value for algorithm

  • label_type (str) – Value for label type

  • label_column (str) – Value for label column

  • prediction_type (str) – Value for prediction type

  • software_spec (str) – Value for software_spec

  • software_spec_id (str) – Value for software_spec_id

  • provider (str) – Value for provider,Available options are in Provider

TrainingDataReference

class TrainingDataReference(type: str = None, id: str = None, connection: Dict = None, location: Dict = None, schema: Dict = None)

Training data schema definition

Variables:
  • type (str) – Type of training data reference. It has values as fs, url, data_asset or connection_asset.

  • id (str) – ID of training data reference.

  • connection (Dict) – (Optional) Connection details

  • location (Dict) – (Optional) Location details

  • schema (Dict) – Model training data schema

If type is fs, the parameters that user needs to input are - location.path If type is url, the parameters that user needs to provide are - training_data_references[].id and connection.url If type is data_asset, then - location.href If type is connection_asset, then location.file_name or location.table_name, connection.href

DeploymentDetails

class DeploymentDetails(identifier: str, name: str, deployment_type: str, scoring_endpoint: str = None, description: str = None)

External model deployment details

Variables:
  • identifier (str) – Deployment identifier specific to providers.

  • name (str) – Name of the deployment

  • deployment_type (str) – Deployment type (i.e., online)

  • scoring_endpoint (str) – Deployment scoring endpoint url.

  • description (str) – (Optional) Description of the deployment

CloudPakforDataConfig

class CloudPakforDataConfig(service_url: str, username: str, password: str = None, api_key: str = None, disable_ssl_verification: bool = True, bedrock_url: str = None)

Configurations for Cloud Pak for Data environment

Variables:
  • service_url (str) – Host URL of Cloud Pak for Data environment.

  • username (str) – Environment username

  • password (str) – Environment password

  • api_key (str) – Environment api_key if IAM enabled

  • disable_ssl_verification (bool) – Disable SSL verification. Default is True.

  • bedrock_url (str) – (Optional) Foundational services (common-services-route ) url. User needs to get this url from CP4D admin. This url is required only when iam-integration is enabled on CP4D 4.0.x cluster.

ModelEntryProps

class ModelEntryProps(model_entry_catalog_id: str, asset_id: str = None, model_catalog_id: str = None, model_entry_id: str = None, model_entry_name: str = None, model_entry_desc: str = None, project_id: str = None, space_id: str = None, grc_model_id: str = None)

Model usecase Properties

Variables:
  • model_entry_catalog_id (str) – Catalog ID where model usecase exist.

  • asset_id (str) – Published model/asset ID. It is optional for external models ONLY.

  • model_catalog_id (str) – (Optional) Catalog Id where model exist.

  • model_entry_id (str) – (Optional) Existing Model usecase to link with.

  • model_entry_name (str) – (Optional) New model usecase name. Used only when creating new model usecase.

  • model_entry_description (str) – (Optional) New model usecase description. Used only when creating new model usecase.

  • project_id (str) – (Optional) Project ID where the model exist.Not applicable for external models.

  • space_id (str) – (Optional) Space ID where model exist Not applicable for external models.

  • grc_model_id (str) – (Optional) Openpages model id. Only applicable for CPD environments.

PromptTemplate

class PromptTemplate(model_version: dict = None, prompt_variables: dict = None, prompt_instruction: str = None, input_prefix: str = None, output_prefix: str = None, structured_examples: dict = None, input: str = None, model_parameters: dict = None)

Details of a PromptTemplate

Variables:
  • model_version (dict) – (Optional) Model version information and their respective values.

  • prompt_variables (dict) – (Optional) Values for prompt variables in the format {prompt_variable: value}.

  • prompt_instruction (str) – (Optional) Instruction for using the prompt.

  • input_prefix (str) – (Optional) Prefix for input data.

  • output_prefix (str) – (Optional)Prefix for output data.

  • structured_examples (dict) – (Optional) Values of examples in the format {example_input: example_output}.

  • input_prompt (str) – (Optional)Prompt input value.

  • model_parameters (dict) – (Optional)Model parameters and their respective values.

DetachedPromptTemplate

Attention

  • When specifying external information, ensure the following:
    • Provide both model_name and model_url together, or omit both.

    • The same rule applies for prompt_url and prompt_additional_info. Omit both if one is omitted

class DetachedPromptTemplate(prompt_id: str, model_id: str, model_provider: str, model_name: str = None, model_url: str = None, prompt_url: str = None, prompt_additional_info: list = None)

Details of a detached prompt template.

Variables:
  • prompt_id (str) – ID of the external prompt.

  • model_id (str) – ID of the external model associated with the prompt.

  • model_provider (str) – Provider of the external model.

  • model_name (str) – (Optional) Name of the external model (optional).

  • model_url (str) – URL of the external model (optional).

  • prompt_url (str) – URL of the external prompt (optional).

  • prompt_additional_info (dict) – Additional information related to the external prompt (optional).