Method
updatePythonModel POST
Copy POST

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.

Arguments:

REQUIRED KEY TYPE DESCRIPTION
Yes modelId str The unique ID associated with the Python model to be changed.
No functionSourceCode str 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.
No trainFunctionName str 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.
No predictFunctionName str 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.
No predictManyFunctionName str 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.
No initializeFunctionName str Name of the function found in the source code to initialize the trained model before using it to make predictions using the model.
No trainingInputTables list 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).
No cpuSize str Size of the CPU for the model training function.
No memory int Memory (in GB) for the model training function.
No packageRequirements list List of package requirement strings. For example: `['numpy==1.2.3', 'pandas>=1.4.0']`.
No useGpu bool Whether this model needs gpu
No isThreadSafe int Whether this model is thread safe
No trainingConfig TrainingConfig The training config used to train this model.
KEY TYPE Description
ALGORITHM None None
KWARGS None None
PROBLEM_TYPE None None
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None
Note: The arguments for the API methods follow camelCase but for Python SDK underscore_case is followed.

Response:

KEY TYPE DESCRIPTION
success Boolean true if the call succeeded, false if there was an error
result Model
KEY TYPE Description
name str The user-friendly name for the model.
modelId str The unique identifier of the model.
modelConfigType str Name of the TrainingConfig class of the model_config.
modelPredictionConfig dict The prediction config options for the model.
createdAt str Date and time at which the model was created.
projectId str The project this model belongs to.
shared bool If model is shared to the Abacus.AI model showcase.
sharedAt str The date and time at which the model was shared to the model showcase
trainFunctionName str 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.
predictFunctionName str 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.
predictManyFunctionName str Name of the function found in the source code that will be executed to run batch predictions trhough the model.
initializeFunctionName str Name of the function found in the source code to initialize the trained model before using it to make predictions using the model
trainingInputTables list 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).
sourceCode str Python code used to make the model.
cpuSize str Cpu size specified for the python model training.
memory Int Memory in GB specified for the python model training.
trainingFeatureGroupIds List of Unique String Identifiers The unique identifiers of the feature groups used as the inputs to train this model on.
algorithmModelConfigs List[dict] List of algorithm specific training configs.
trainingVectorStoreVersions list The vector store version IDs used as inputs during training to create this ModelVersion.
documentRetrievers list List of document retrievers use to create this model.
documentRetrieverIds list List of document retriever IDs used to create this model.
isPythonModel bool If this model is handled as python model
defaultAlgorithm str If set, this algorithm will always be used when deploying the model regardless of the model metrics
customAlgorithmConfigs dict User-defined configs for each of the user-defined custom algorithm
restrictedAlgorithms dict User-selected algorithms to train.
useGpu bool If this model uses gpu.
notebookId str The notebook associated with this model.
trainingRequired bool If training is required to keep the model up-to-date.
dataLlmFeatureGroups List[FeatureGroup] List of feature groups used by the model for queries
latestModelVersion ModelVersion The latest model version.
KEY TYPE Description
modelVersion str The unique identifier of a model version.
modelConfigType str Name of the TrainingConfig class of the model_config.
status str The current status of the model.
modelId str A reference to the model this version belongs to.
modelPredictionConfig dict The prediction config options for the model.
trainingStartedAt str The start time and date of the training process in ISO-8601 format.
trainingCompletedAt str The end time and date of the training process in ISO-8601 format.
featureGroupVersions list A list of Feature Group version IDs used for model training.
error str Relevant error if the status is FAILED.
pendingDeploymentIds list List of deployment IDs where deployment is pending.
failedDeploymentIds list List of failed deployment IDs.
cpuSize str CPU size specified for the python model training.
memory int Memory in GB specified for the python model training.
automlComplete bool If true, all algorithms have completed training.
trainingFeatureGroupIds list The unique identifiers of the feature groups used as inputs during training to create this ModelVersion.
trainingDocumentRetrieverVersions list The document retriever version IDs used as inputs during training to create this ModelVersion.
documentRetrieverMappings dict mapping of document retriever version to their respective information.
bestAlgorithm dict Best performing algorithm.
defaultAlgorithm dict Default algorithm that the user has selected.
featureAnalysisStatus str Lifecycle of the feature analysis stage.
dataClusterInfo dict Information about the models for different data clusters.
customAlgorithmConfigs dict User-defined configs for each of the user-defined custom algorithms.
trainedModelTypes list List of trained model types.
useGpu bool Whether this model version is using gpu
partialComplete bool If true, all required algorithms have completed training.
modelFeatureGroupSchemaMappings dict mapping of feature group to schema version
trainingConfigUpdated bool If the training config has been updated since the instance was created.
codeSource CodeSource If a python model, information on where the source code is located.
KEY TYPE Description
sourceType str The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR
sourceCode str If the type of the source is TEXT, the raw text of the function
applicationConnectorId str The Application Connector to fetch the code from
applicationConnectorInfo str Args passed to the application connector to fetch the code
packageRequirements list The pip package dependencies required to run the code
status str The status of the code and validations
error str If the status is failed, an error message describing what went wrong
publishingMsg dict Warnings in the source code
moduleDependencies list The list of internal modules dependencies required to run the code
modelConfig TrainingConfig The training config options used to train this model.
KEY TYPE Description
ALGORITHM None None
KWARGS None None
PROBLEM_TYPE None None
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None
deployableAlgorithms DeployableAlgorithm List of deployable algorithms.
KEY TYPE Description
algorithm str ID of the algorithm.
name str Name of the algorithm.
trainedModelTypes List[dict] List of trained model types.
onlyOfflineDeployable bool Whether the algorithm can only be deployed offline.
location ModelLocation Location information for models that are imported.
KEY TYPE Description
location str Location of the plug-and-play model.
artifactNames dict Representations of the names of the artifacts used to create the model.
refreshSchedules RefreshSchedule List of refresh schedules that indicate when the next model version will be trained
KEY TYPE Description
refreshPolicyId str The unique identifier of the refresh policy
nextRunTime str The next run time of the refresh policy. If null, the policy is paused.
cron str A cron-style string that describes the when this refresh policy is to be executed in UTC
refreshType str The type of refresh that will be run
error str An error message for the last pipeline run of a policy
codeSource CodeSource If a python model, information on the source code
KEY TYPE Description
sourceType str The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR
sourceCode str If the type of the source is TEXT, the raw text of the function
applicationConnectorId str The Application Connector to fetch the code from
applicationConnectorInfo str Args passed to the application connector to fetch the code
packageRequirements list The pip package dependencies required to run the code
status str The status of the code and validations
error str If the status is failed, an error message describing what went wrong
publishingMsg dict Warnings in the source code
moduleDependencies list The list of internal modules dependencies required to run the code
databaseConnector DatabaseConnector Database connector used by the model.
KEY TYPE Description
databaseConnectorId str A unique string identifier for the connection.
service str An enum string indicating the service this connection connects to.
name str A user-friendly name for the service.
status str The status of the database connector.
auth dict Non-secret connection information for this connector.
createdAt str The ISO-8601 string indicating when the API key was created.
modelConfig TrainingConfig The training config options used to train this model.
KEY TYPE Description
ALGORITHM None None
KWARGS None None
PROBLEM_TYPE None None
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None

Exceptions:

TYPE WHEN
DataNotFoundError

modelId is not found.

InvalidEnumParameterError

An invalid value is passed for cpuSize.

ConflictError

The source code is invalid.

InvalidParameterError

The model ID refers to a non-Python model.

Language: