abacusai.model
==============

.. py:module:: abacusai.model


Classes
-------

.. autoapisummary::

   abacusai.model.AgentInterface
   abacusai.model.TrainingConfig
   abacusai.model.WorkflowGraph
   abacusai.model.CodeSource
   abacusai.model.DatabaseConnector
   abacusai.model.ModelLocation
   abacusai.model.ModelVersion
   abacusai.model.RefreshSchedule
   abacusai.model.AbstractApiClass
   abacusai.model.Model


Module Contents
---------------

.. py:class:: AgentInterface

   Bases: :py:obj:`ApiEnum`


   Generic enumeration.

   Derive from this class to define new enumerations.


   .. py:attribute:: DEFAULT
      :value: 'DEFAULT'



   .. py:attribute:: CHAT
      :value: 'CHAT'



.. py:class:: TrainingConfig

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   An abstract class for the training config options used to train the model.


   .. py:attribute:: _upper_snake_case_keys
      :type:  bool


   .. py:attribute:: _support_kwargs
      :type:  bool


   .. py:attribute:: kwargs
      :type:  dict


   .. py:attribute:: problem_type
      :type:  abacusai.api_class.enums.ProblemType


   .. py:attribute:: algorithm
      :type:  str


   .. py:method:: _get_builder()
      :classmethod:



.. py:class:: WorkflowGraph

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.

   :param nodes: A list of nodes in the workflow graph.
   :type nodes: List[WorkflowGraphNode]
   :param edges: A list of edges in the workflow graph, where each edge is a tuple of source, target and details.
   :type edges: List[WorkflowGraphEdge]


   .. py:attribute:: nodes
      :type:  List[WorkflowGraphNode]


   .. py:attribute:: edges
      :type:  List[WorkflowGraphEdge]


   .. py:method:: to_dict()

      Standardizes converting an ApiClass to dictionary.
      Keys of response dictionary are converted to camel case.
      This also validates the fields ( type, value, etc ) received in the dictionary.



   .. py:method:: from_dict(graph)
      :classmethod:



.. py:class:: CodeSource(client, sourceType=None, sourceCode=None, applicationConnectorId=None, applicationConnectorInfo=None, packageRequirements=None, status=None, error=None, publishingMsg=None, moduleDependencies=None)

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   Code source for python-based custom feature groups and models

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param sourceType: The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR
   :type sourceType: str
   :param sourceCode: If the type of the source is TEXT, the raw text of the function
   :type sourceCode: str
   :param applicationConnectorId: The Application Connector to fetch the code from
   :type applicationConnectorId: str
   :param applicationConnectorInfo: Args passed to the application connector to fetch the code
   :type applicationConnectorInfo: str
   :param packageRequirements: The pip package dependencies required to run the code
   :type packageRequirements: list
   :param status: The status of the code and validations
   :type status: str
   :param error: If the status is failed, an error message describing what went wrong
   :type error: str
   :param publishingMsg: Warnings in the source code
   :type publishingMsg: dict
   :param moduleDependencies: The list of internal modules dependencies required to run the code
   :type moduleDependencies: list


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



   .. py:method:: import_as_cell()

      Adds the source code as an unexecuted cell in the notebook.



.. py:class:: DatabaseConnector(client, databaseConnectorId=None, service=None, name=None, status=None, auth=None, createdAt=None)

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   A connector to an external service

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param databaseConnectorId: A unique string identifier for the connection.
   :type databaseConnectorId: str
   :param service: An enum string indicating the service this connection connects to.
   :type service: str
   :param name: A user-friendly name for the service.
   :type name: str
   :param status: The status of the database connector.
   :type status: str
   :param auth: Non-secret connection information for this connector.
   :type auth: dict
   :param createdAt: The ISO-8601 string indicating when the API key was created.
   :type createdAt: str


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



   .. py:method:: list_objects(fetch_raw_data = False)

      Lists querable objects in the database connector.

      :param fetch_raw_data: If true, return unfiltered objects.
      :type fetch_raw_data: bool



   .. py:method:: get_object_schema(object_name = None, fetch_raw_data = False)

      Get the schema of an object in an database connector.

      :param object_name: Unique identifier for the object in the external system.
      :type object_name: str
      :param fetch_raw_data: If true, return unfiltered list of columns.
      :type fetch_raw_data: bool

      :returns: The schema of the object.
      :rtype: DatabaseConnectorSchema



   .. py:method:: rename(name)

      Renames a Database Connector

      :param name: The new name for the Database Connector.
      :type name: str



   .. py:method:: verify()

      Checks if Abacus.AI can access the specified database.

      :param database_connector_id: Unique string identifier for the database connector.
      :type database_connector_id: str



   .. py:method:: delete()

      Delete a database connector.

      :param database_connector_id: The unique identifier for the database connector.
      :type database_connector_id: str



   .. py:method:: query(query)

      Runs a query in the specified database connector.

      :param query: The query to be run in the database connector.
      :type query: str



.. py:class:: ModelLocation(client, location=None, artifactNames=None)

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   Provide location information for the plug-and-play model.

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param location: Location of the plug-and-play model.
   :type location: str
   :param artifactNames: Representations of the names of the artifacts used to create the model.
   :type artifactNames: dict


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



.. py:class:: ModelVersion(client, modelVersion=None, modelConfigType=None, status=None, modelId=None, modelPredictionConfig=None, trainingStartedAt=None, trainingCompletedAt=None, featureGroupVersions=None, error=None, pendingDeploymentIds=None, failedDeploymentIds=None, cpuSize=None, memory=None, automlComplete=None, trainingFeatureGroupIds=None, trainingDocumentRetrieverVersions=None, documentRetrieverMappings=None, bestAlgorithm=None, defaultAlgorithm=None, featureAnalysisStatus=None, dataClusterInfo=None, customAlgorithmConfigs=None, trainedModelTypes=None, useGpu=None, partialComplete=None, modelFeatureGroupSchemaMappings=None, trainingConfigUpdated=None, codeSource={}, modelConfig={}, deployableAlgorithms={})

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   A version of a model

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param modelVersion: The unique identifier of a model version.
   :type modelVersion: str
   :param modelConfigType: Name of the TrainingConfig class of the model_config.
   :type modelConfigType: str
   :param status: The current status of the model.
   :type status: str
   :param modelId: A reference to the model this version belongs to.
   :type modelId: str
   :param modelPredictionConfig: The prediction config options for the model.
   :type modelPredictionConfig: dict
   :param trainingStartedAt: The start time and date of the training process in ISO-8601 format.
   :type trainingStartedAt: str
   :param trainingCompletedAt: The end time and date of the training process in ISO-8601 format.
   :type trainingCompletedAt: str
   :param featureGroupVersions: A list of Feature Group version IDs used for model training.
   :type featureGroupVersions: list
   :param error: Relevant error if the status is FAILED.
   :type error: str
   :param pendingDeploymentIds: List of deployment IDs where deployment is pending.
   :type pendingDeploymentIds: list
   :param failedDeploymentIds: List of failed deployment IDs.
   :type failedDeploymentIds: list
   :param cpuSize: CPU size specified for the python model training.
   :type cpuSize: str
   :param memory: Memory in GB specified for the python model training.
   :type memory: int
   :param automlComplete: If true, all algorithms have completed training.
   :type automlComplete: bool
   :param trainingFeatureGroupIds: The unique identifiers of the feature groups used as inputs during training to create this ModelVersion.
   :type trainingFeatureGroupIds: list
   :param trainingDocumentRetrieverVersions: The document retriever version IDs used as inputs during training to create this ModelVersion.
   :type trainingDocumentRetrieverVersions: list
   :param documentRetrieverMappings: mapping of document retriever version to their respective information.
   :type documentRetrieverMappings: dict
   :param bestAlgorithm: Best performing algorithm.
   :type bestAlgorithm: dict
   :param defaultAlgorithm: Default algorithm that the user has selected.
   :type defaultAlgorithm: dict
   :param featureAnalysisStatus: Lifecycle of the feature analysis stage.
   :type featureAnalysisStatus: str
   :param dataClusterInfo: Information about the models for different data clusters.
   :type dataClusterInfo: dict
   :param customAlgorithmConfigs: User-defined configs for each of the user-defined custom algorithms.
   :type customAlgorithmConfigs: dict
   :param trainedModelTypes: List of trained model types.
   :type trainedModelTypes: list
   :param useGpu: Whether this model version is using gpu
   :type useGpu: bool
   :param partialComplete: If true, all required algorithms have completed training.
   :type partialComplete: bool
   :param modelFeatureGroupSchemaMappings: mapping of feature group to schema version
   :type modelFeatureGroupSchemaMappings: dict
   :param trainingConfigUpdated: If the training config has been updated since the instance was created.
   :type trainingConfigUpdated: bool
   :param codeSource: If a python model, information on where the source code is located.
   :type codeSource: CodeSource
   :param modelConfig: The training config options used to train this model.
   :type modelConfig: TrainingConfig
   :param deployableAlgorithms: List of deployable algorithms.
   :type deployableAlgorithms: DeployableAlgorithm


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



   .. py:method:: describe_train_test_data_split_feature_group_version()

      Get the train and test data split for a trained model by model version. This is only supported for models with custom algorithms.

      :param model_version: The unique version ID of the model version.
      :type model_version: str

      :returns: The feature group version containing the training data and folds information.
      :rtype: FeatureGroupVersion



   .. py:method:: set_model_objective(metric = None)

      Sets the best model for all model instances of the model based on the specified metric, and updates the training configuration to use the specified metric for any future model versions.

      If metric is set to None, then just use the default selection


      :param metric: The metric to use to determine the best model.
      :type metric: str



   .. py:method:: get_feature_group_schemas_for()

      Gets the schema (including feature mappings) for all feature groups used in the model version.

      :param model_version: Unique string identifier for the version of the model.
      :type model_version: str

      :returns: List of schema for all feature groups used in the model version.
      :rtype: list[ModelVersionFeatureGroupSchema]



   .. py:method:: delete()

      Deletes the specified model version. Model versions which are currently used in deployments cannot be deleted.

      :param model_version: The unique identifier of the model version to delete.
      :type model_version: str



   .. py:method:: export_model_artifact_as_feature_group(table_name, artifact_type = None)

      Exports metric artifact data for a model as a feature group.

      :param table_name: Name of the feature group table to create.
      :type table_name: str
      :param artifact_type: eval artifact type to export.
      :type artifact_type: EvalArtifactType

      :returns: The created feature group.
      :rtype: FeatureGroup



   .. py:method:: refresh()

      Calls describe and refreshes the current object's fields

      :returns: The current object
      :rtype: ModelVersion



   .. py:method:: describe()

      Retrieves a full description of the specified model version.

      :param model_version: Unique string identifier of the model version.
      :type model_version: str

      :returns: A model version.
      :rtype: ModelVersion



   .. py:method:: get_feature_importance_by()

      Gets the feature importance calculated by various methods for the model.

      :param model_version: Unique string identifier for the model version.
      :type model_version: str

      :returns: Feature importances for the model.
      :rtype: FeatureImportance



   .. py:method:: get_training_data_logs()

      Retrieves the data preparation logs during model training.

      :param model_version: The unique version ID of the model version.
      :type model_version: str

      :returns: A list of logs.
      :rtype: list[DataPrepLogs]



   .. py:method:: get_training_logs(stdout = False, stderr = False)

      Returns training logs for the model.

      :param stdout: Set True to get info logs.
      :type stdout: bool
      :param stderr: Set True to get error logs.
      :type stderr: bool

      :returns: A function logs object.
      :rtype: FunctionLogs



   .. py:method:: export_custom(output_location, algorithm = None)

      Bundle custom model artifacts to a zip file, and export to the specified location.

      :param output_location: Location to export the model artifacts results. For example, s3://a-bucket/
      :type output_location: str
      :param algorithm: The algorithm to be exported. Optional if there's only one custom algorithm in the model version.
      :type algorithm: str

      :returns: Object describing the export and its status.
      :rtype: ModelArtifactsExport



   .. py:method:: wait_for_training(timeout=None)

      A waiting call until model gets trained.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: wait_for_full_automl(timeout=None)

      A waiting call until full AutoML cycle is completed.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: get_status()

      Gets the status of the model version under training.

      :returns: A string describing the status of a model training (pending, complete, etc.).
      :rtype: str



   .. py:method:: get_train_test_feature_group_as_pandas()

      Get the model train test data split feature group of the model version as pandas data frame.

      :returns: A pandas dataframe for the training data with fold column.
      :rtype: pandas.Dataframe



.. py:class:: RefreshSchedule(client, refreshPolicyId=None, nextRunTime=None, cron=None, refreshType=None, error=None)

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   A refresh schedule for an object. Defines when the next version of the object will be created

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param refreshPolicyId: The unique identifier of the refresh policy
   :type refreshPolicyId: str
   :param nextRunTime: The next run time of the refresh policy. If null, the policy is paused.
   :type nextRunTime: str
   :param cron: A cron-style string that describes the when this refresh policy is to be executed in UTC
   :type cron: str
   :param refreshType: The type of refresh that will be run
   :type refreshType: str
   :param error: An error message for the last pipeline run of a policy
   :type error: str


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



.. py:class:: AbstractApiClass(client, id)

   .. py:method:: __eq__(other)

      Return self==value.



   .. py:method:: _get_attribute_as_dict(attribute)


.. py:class:: Model(client, name=None, modelId=None, modelConfigType=None, modelPredictionConfig=None, createdAt=None, projectId=None, shared=None, sharedAt=None, trainFunctionName=None, predictFunctionName=None, predictManyFunctionName=None, initializeFunctionName=None, trainingInputTables=None, sourceCode=None, cpuSize=None, memory=None, trainingFeatureGroupIds=None, algorithmModelConfigs=None, trainingVectorStoreVersions=None, documentRetrievers=None, documentRetrieverIds=None, isPythonModel=None, defaultAlgorithm=None, customAlgorithmConfigs=None, restrictedAlgorithms=None, useGpu=None, notebookId=None, trainingRequired=None, dataLlmFeatureGroups=None, location={}, refreshSchedules={}, codeSource={}, databaseConnector={}, latestModelVersion={}, modelConfig={})

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`


   A model

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param name: The user-friendly name for the model.
   :type name: str
   :param modelId: The unique identifier of the model.
   :type modelId: str
   :param modelConfigType: Name of the TrainingConfig class of the model_config.
   :type modelConfigType: str
   :param modelPredictionConfig: The prediction config options for the model.
   :type modelPredictionConfig: dict
   :param createdAt: Date and time at which the model was created.
   :type createdAt: str
   :param projectId: The project this model belongs to.
   :type projectId: str
   :param shared: If model is shared to the Abacus.AI model showcase.
   :type shared: bool
   :param sharedAt: The date and time at which the model was shared to the model showcase
   :type sharedAt: str
   :param trainFunctionName: Name of the function found in the source code that will be executed to train the model. It is not executed when this function is run.
   :type trainFunctionName: str
   :param predictFunctionName: Name of the function found in the source code that will be executed run predictions through model. It is not executed when this function is run.
   :type predictFunctionName: str
   :param predictManyFunctionName: Name of the function found in the source code that will be executed to run batch predictions trhough the model.
   :type predictManyFunctionName: str
   :param initializeFunctionName: Name of the function found in the source code to initialize the trained model before using it to make predictions using the model
   :type initializeFunctionName: str
   :param trainingInputTables: List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the functions return value).
   :type trainingInputTables: list
   :param sourceCode: Python code used to make the model.
   :type sourceCode: str
   :param cpuSize: Cpu size specified for the python model training.
   :type cpuSize: str
   :param memory: Memory in GB specified for the python model training.
   :type memory: int
   :param trainingFeatureGroupIds: The unique identifiers of the feature groups used as the inputs to train this model on.
   :type trainingFeatureGroupIds: list of unique string identifiers
   :param algorithmModelConfigs: List of algorithm specific training configs.
   :type algorithmModelConfigs: list[dict]
   :param trainingVectorStoreVersions: The vector store version IDs used as inputs during training to create this ModelVersion.
   :type trainingVectorStoreVersions: list
   :param documentRetrievers: List of document retrievers use to create this model.
   :type documentRetrievers: list
   :param documentRetrieverIds: List of document retriever IDs used to create this model.
   :type documentRetrieverIds: list
   :param isPythonModel: If this model is handled as python model
   :type isPythonModel: bool
   :param defaultAlgorithm: If set, this algorithm will always be used when deploying the model regardless of the model metrics
   :type defaultAlgorithm: str
   :param customAlgorithmConfigs: User-defined configs for each of the user-defined custom algorithm
   :type customAlgorithmConfigs: dict
   :param restrictedAlgorithms: User-selected algorithms to train.
   :type restrictedAlgorithms: dict
   :param useGpu: If this model uses gpu.
   :type useGpu: bool
   :param notebookId: The notebook associated with this model.
   :type notebookId: str
   :param trainingRequired: If training is required to keep the model up-to-date.
   :type trainingRequired: bool
   :param dataLlmFeatureGroups: List of feature groups used by the model for queries
   :type dataLlmFeatureGroups: list[featuregroup]
   :param latestModelVersion: The latest model version.
   :type latestModelVersion: ModelVersion
   :param location: Location information for models that are imported.
   :type location: ModelLocation
   :param refreshSchedules: List of refresh schedules that indicate when the next model version will be trained
   :type refreshSchedules: RefreshSchedule
   :param codeSource: If a python model, information on the source code
   :type codeSource: CodeSource
   :param databaseConnector: Database connector used by the model.
   :type databaseConnector: DatabaseConnector
   :param modelConfig: The training config options used to train this model.
   :type modelConfig: TrainingConfig


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



   .. py:method:: describe_train_test_data_split_feature_group()

      Get the train and test data split for a trained model by its unique identifier. This is only supported for models with custom algorithms.

      :param model_id: The unique ID of the model. By default, the latest model version will be returned if no version is specified.
      :type model_id: str

      :returns: The feature group containing the training data and fold information.
      :rtype: FeatureGroup



   .. py:method:: refresh()

      Calls describe and refreshes the current object's fields

      :returns: The current object
      :rtype: Model



   .. py:method:: describe()

      Retrieves a full description of the specified model.

      :param model_id: Unique string identifier associated with the model.
      :type model_id: str

      :returns: Description of the model.
      :rtype: Model



   .. py:method:: rename(name)

      Renames a model

      :param name: The new name to assign to the model.
      :type name: str



   .. py:method:: update_python(function_source_code = None, train_function_name = None, predict_function_name = None, predict_many_function_name = None, initialize_function_name = None, training_input_tables = None, cpu_size = None, memory = None, package_requirements = None, use_gpu = None, is_thread_safe = None, training_config = None)

      Updates an existing Python Model using user-provided Python code. If a list of input feature groups is supplied, they will be provided as arguments to the `train` and `predict` functions with the materialized feature groups for those input feature groups.

      This method expects `functionSourceCode` to be a valid language source file which contains the functions named `trainFunctionName` and `predictFunctionName`. `trainFunctionName` returns the ModelVersion that is the result of training the model using `trainFunctionName`. `predictFunctionName` has no well-defined return type, as it returns the prediction made by the `predictFunctionName`, which can be anything.


      :param function_source_code: Contents of a valid Python source code file. The source code should contain the functions named `trainFunctionName` and `predictFunctionName`. A list of allowed import and system libraries for each language is specified in the user functions documentation section.
      :type function_source_code: str
      :param train_function_name: Name of the function found in the source code that will be executed to train the model. It is not executed when this function is run.
      :type train_function_name: str
      :param predict_function_name: Name of the function found in the source code that will be executed to run predictions through the model. It is not executed when this function is run.
      :type predict_function_name: str
      :param predict_many_function_name: Name of the function found in the source code that will be executed to run batch predictions through the model. It is not executed when this function is run.
      :type predict_many_function_name: str
      :param initialize_function_name: Name of the function found in the source code to initialize the trained model before using it to make predictions using the model.
      :type initialize_function_name: str
      :param training_input_tables: List of feature groups that are supplied to the `train` function as parameters. Each of the parameters are materialized DataFrames (same type as the functions return value).
      :type training_input_tables: list
      :param cpu_size: Size of the CPU for the model training function.
      :type cpu_size: str
      :param memory: Memory (in GB) for the model training function.
      :type memory: int
      :param package_requirements: List of package requirement strings. For example: `['numpy==1.2.3', 'pandas>=1.4.0']`.
      :type package_requirements: list
      :param use_gpu: Whether this model needs gpu
      :type use_gpu: bool
      :param is_thread_safe: Whether this model is thread safe
      :type is_thread_safe: bool
      :param training_config: The training config used to train this model.
      :type training_config: TrainingConfig

      :returns: The updated model.
      :rtype: Model



   .. py:method:: update_python_zip(train_function_name = None, predict_function_name = None, predict_many_function_name = None, train_module_name = None, predict_module_name = None, training_input_tables = None, cpu_size = None, memory = None, package_requirements = None, use_gpu = None)

      Updates an existing Python Model using a provided zip file. If a list of input feature groups are supplied, they will be provided as arguments to the train and predict functions with the materialized feature groups for those input feature groups.

      This method expects `trainModuleName` and `predictModuleName` to be valid language source files which contain the functions named `trainFunctionName` and `predictFunctionName`, respectively. `trainFunctionName` returns the ModelVersion that is the result of training the model using `trainFunctionName`, and `predictFunctionName` has no well-defined return type, as it returns the prediction made by the `predictFunctionName`, which can be anything.


      :param train_function_name: Name of the function found in the train module that will be executed to train the model. It is not executed when this function is run.
      :type train_function_name: str
      :param predict_function_name: Name of the function found in the predict module that will be executed to run predictions through the model. It is not executed when this function is run.
      :type predict_function_name: str
      :param predict_many_function_name: Name of the function found in the predict module that will be executed to run batch predictions through the model. It is not executed when this function is run.
      :type predict_many_function_name: str
      :param train_module_name: Full path of the module that contains the train function from the root of the zip.
      :type train_module_name: str
      :param predict_module_name: Full path of the module that contains the predict function from the root of the zip.
      :type predict_module_name: str
      :param training_input_tables: List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the function's return value).
      :type training_input_tables: list
      :param cpu_size: Size of the CPU for the model training function.
      :type cpu_size: str
      :param memory: Memory (in GB) for the model training function.
      :type memory: int
      :param package_requirements: List of package requirement strings. For example: ['numpy==1.2.3', 'pandas>=1.4.0'].
      :type package_requirements: list
      :param use_gpu: Whether this model needs gpu
      :type use_gpu: bool

      :returns: The updated model.
      :rtype: Upload



   .. py:method:: update_python_git(application_connector_id = None, branch_name = None, python_root = None, train_function_name = None, predict_function_name = None, predict_many_function_name = None, train_module_name = None, predict_module_name = None, training_input_tables = None, cpu_size = None, memory = None, use_gpu = None)

      Updates an existing Python model using an existing Git application connector. If a list of input feature groups are supplied, these will be provided as arguments to the train and predict functions with the materialized feature groups for those input feature groups.

      This method expects `trainModuleName` and `predictModuleName` to be valid language source files which contain the functions named `trainFunctionName` and `predictFunctionName`, respectively. `trainFunctionName` returns the `ModelVersion` that is the result of training the model using `trainFunctionName`, and `predictFunctionName` has no well-defined return type, as it returns the prediction made by the `predictFunctionName`, which can be anything.


      :param application_connector_id: The unique ID associated with the Git application connector.
      :type application_connector_id: str
      :param branch_name: Name of the branch in the Git repository to be used for training.
      :type branch_name: str
      :param python_root: Path from the top level of the Git repository to the directory containing the Python source code. If not provided, the default is the root of the Git repository.
      :type python_root: str
      :param train_function_name: Name of the function found in train module that will be executed to train the model. It is not executed when this function is run.
      :type train_function_name: str
      :param predict_function_name: Name of the function found in the predict module that will be executed to run predictions through model. It is not executed when this function is run.
      :type predict_function_name: str
      :param predict_many_function_name: Name of the function found in the predict module that will be executed to run batch predictions through model. It is not executed when this function is run.
      :type predict_many_function_name: str
      :param train_module_name: Full path of the module that contains the train function from the root of the zip.
      :type train_module_name: str
      :param predict_module_name: Full path of the module that contains the predict function from the root of the zip.
      :type predict_module_name: str
      :param training_input_tables: List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the functions return value).
      :type training_input_tables: list
      :param cpu_size: Size of the CPU for the model training function.
      :type cpu_size: str
      :param memory: Memory (in GB) for the model training function.
      :type memory: int
      :param use_gpu: Whether this model needs gpu
      :type use_gpu: bool

      :returns: The updated model.
      :rtype: Model



   .. py:method:: set_training_config(training_config, feature_group_ids = None)

      Edits the default model training config

      :param training_config: The training config used to train this model.
      :type training_config: TrainingConfig
      :param feature_group_ids: The list of feature groups used as input to the model.
      :type feature_group_ids: List

      :returns: The model object corresponding to the updated training config.
      :rtype: Model



   .. py:method:: set_prediction_params(prediction_config)

      Sets the model prediction config for the model

      :param prediction_config: Prediction configuration for the model.
      :type prediction_config: dict

      :returns: Model object after the prediction configuration is applied.
      :rtype: Model



   .. py:method:: get_metrics(model_version = None, return_graphs = False, validation = False)

      Retrieves metrics for all the algorithms trained in this model version.

      If only the model's unique identifier (model_id) is specified, the latest trained version of the model (model_version) is used.


      :param model_version: Version of the model.
      :type model_version: str
      :param return_graphs: If true, will return the information used for the graphs on the model metrics page such as PR Curve per label.
      :type return_graphs: bool
      :param validation: If true, will return the validation metrics instead of the test metrics.
      :type validation: bool

      :returns: An object containing the model metrics and explanations for what each metric means.
      :rtype: ModelMetrics



   .. py:method:: list_versions(limit = 100, start_after_version = None)

      Retrieves a list of versions for a given model.

      :param limit: Maximum length of the list of all dataset versions.
      :type limit: int
      :param start_after_version: Unique string identifier of the version after which the list starts.
      :type start_after_version: str

      :returns: An array of model versions.
      :rtype: list[ModelVersion]



   .. py:method:: retrain(deployment_ids = None, feature_group_ids = None, custom_algorithms = None, builtin_algorithms = None, custom_algorithm_configs = None, cpu_size = None, memory = None, training_config = None, algorithm_training_configs = None)

      Retrains the specified model, with an option to choose the deployments to which the retraining will be deployed.

      :param deployment_ids: List of unique string identifiers of deployments to automatically deploy to.
      :type deployment_ids: List
      :param feature_group_ids: List of feature group IDs provided by the user to train the model on.
      :type feature_group_ids: List
      :param custom_algorithms: List of user-defined algorithms to train. If not set, will honor the runs from the last time and applicable new custom algorithms.
      :type custom_algorithms: list
      :param builtin_algorithms: List of algorithm names or algorithm IDs of Abacus.AI built-in algorithms to train. If not set, will honor the runs from the last time and applicable new built-in algorithms.
      :type builtin_algorithms: list
      :param custom_algorithm_configs: User-defined training configs for each custom algorithm.
      :type custom_algorithm_configs: dict
      :param cpu_size: Size of the CPU for the user-defined algorithms during training.
      :type cpu_size: str
      :param memory: Memory (in GB) for the user-defined algorithms during training.
      :type memory: int
      :param training_config: The training config used to train this model.
      :type training_config: TrainingConfig
      :param algorithm_training_configs: List of algorithm specifc training configs that will be part of the model training AutoML run.
      :type algorithm_training_configs: list

      :returns: The model that is being retrained.
      :rtype: Model



   .. py:method:: delete()

      Deletes the specified model and all its versions. Models which are currently used in deployments cannot be deleted.

      :param model_id: Unique string identifier of the model to delete.
      :type model_id: str



   .. py:method:: set_default_algorithm(algorithm = None, data_cluster_type = None)

      Sets the model's algorithm to default for all new deployments

      :param algorithm: Algorithm to pin in the model.
      :type algorithm: str
      :param data_cluster_type: Data cluster type to set the lead model for.
      :type data_cluster_type: str



   .. py:method:: list_artifacts_exports(limit = 25)

      List all the model artifacts exports.

      :param limit: Maximum length of the list of all exports.
      :type limit: int

      :returns: List of model artifacts exports.
      :rtype: list[ModelArtifactsExport]



   .. py:method:: get_training_types_for_deployment(model_version = None, algorithm = None)

      Returns types of models that can be deployed for a given model instance ID.

      :param model_version: The unique ID associated with the model version to deploy.
      :type model_version: str
      :param algorithm: The unique ID associated with the algorithm to deploy.
      :type algorithm: str

      :returns: Model training types for deployment.
      :rtype: ModelTrainingTypeForDeployment



   .. py:method:: update_agent(function_source_code = None, agent_function_name = None, memory = None, package_requirements = None, description = None, enable_binary_input = None, agent_input_schema = None, agent_output_schema = None, workflow_graph = None, agent_interface = None)

      Updates an existing AI Agent. A new version of the agent will be created and published.

      :param memory: Memory (in GB) for the agent.
      :type memory: int
      :param description: A description of the agent, including its purpose and instructions.
      :type description: str
      :param workflow_graph: The workflow graph for the agent.
      :type workflow_graph: WorkflowGraph
      :param agent_interface: The interface that the agent will be deployed with.
      :type agent_interface: AgentInterface

      :returns: The updated agent.
      :rtype: Agent



   .. py:method:: wait_for_training(timeout=None)

      A waiting call until model is trained.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: wait_for_evaluation(timeout=None)

      A waiting call until model is evaluated completely.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: wait_for_publish(timeout=None)

      A waiting call until agent is published.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: wait_for_full_automl(timeout=None)

      A waiting call until full AutoML cycle is completed.

      :param timeout: The waiting time given to the call to finish, if it doesn't finish by the allocated time, the call is said to be timed out.
      :type timeout: int



   .. py:method:: get_status(get_automl_status = False)

      Gets the status of the model training.

      :returns: A string describing the status of a model training (pending, complete, etc.).
      :rtype: str



   .. py:method:: create_refresh_policy(cron)

      To create a refresh policy for a model.

      :param cron: A cron style string to set the refresh time.
      :type cron: str

      :returns: The refresh policy object.
      :rtype: RefreshPolicy



   .. py:method:: list_refresh_policies()

      Gets the refresh policies in a list.

      :returns: A list of refresh policy objects.
      :rtype: List[RefreshPolicy]



   .. py:method:: get_train_test_feature_group_as_pandas()

      Get the model train test data split feature group as pandas.

      :returns: A pandas dataframe for the training data with fold column.
      :rtype: pandas.Dataframe



