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
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None
PROBLEM_TYPE None None
KWARGS 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.
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.
customAlgorithms list List of user-defined algorithms used for model training.
builtinAlgorithms list List of algorithm names builtin algorithms provided by Abacus.AI 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
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None
PROBLEM_TYPE None None
KWARGS None None
deployableAlgorithms DeployableAlgorithm List of deployable algorithms.
KEY TYPE Description
algorithm str ID of the algorithm.
onlyOfflineDeployable bool Whether the algorithm can only be deployed offline.
name str Name of the algorithm.
trainedModelTypes List[dict] List of trained model types.
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.
dataLlmFeatureGroups FeatureGroup List of feature groups used by the model for queries
KEY TYPE Description
featureGroupId str Unique identifier for this feature group.
modificationLock bool If feature group is locked against a change or not.
name String None
featureGroupSourceType str The source type of the feature group
tableName str Unique table name of this feature group.
sql str SQL definition creating this feature group.
datasetId str Dataset ID the feature group is sourced from.
functionSourceCode str Source definition creating this feature group.
functionName str Function name to execute from the source code.
sourceTables List[str] Source tables for this feature group.
createdAt str Timestamp at which the feature group was created.
description str Description of the feature group.
sqlError str Error message with this feature group.
latestVersionOutdated bool Is latest materialized feature group version outdated.
referencedFeatureGroups List[str] Feature groups this feature group is used in.
tags List[str] Tags added to this feature group.
primaryKey str Primary index feature.
updateTimestampKey str Primary timestamp feature.
lookupKeys List[str] Additional indexed features for this feature group.
streamingEnabled bool If true, the feature group can have data streamed to it.
incremental bool If feature group corresponds to an incremental dataset.
mergeConfig dict Merge configuration settings for the feature group.
samplingConfig dict Sampling configuration for the feature group.
cpuSize str CPU size specified for the Python feature group.
memory int Memory in GB specified for the Python feature group.
streamingReady bool If true, the feature group is ready to receive streaming data.
featureTags dict Tags for features in this feature group
moduleName str Path to the file with the feature group function.
templateBindings dict Config specifying variable names and values to use when resolving a feature group template.
featureExpression str If the dataset feature group has custom features, the SQL select expression creating those features.
useOriginalCsvNames bool If true, the feature group will use the original column names in the source dataset.
pythonFunctionBindings dict Config specifying variable names, types, and values to use when resolving a Python feature group.
pythonFunctionName str Name of the Python function the feature group was built from.
useGpu bool Whether this feature group is using gpu
versionLimit int Version limit for the feature group.
exportOnMaterialization bool Whether to export the feature group on materialization.
features Feature List of resolved features.
KEY TYPE Description
name str The unique name of the column
selectClause str The sql logic for creating this feature's data
featureMapping str The Feature Mapping of the feature
sourceTable str The source table of the column
originalName str The original name of the column
usingClause str Nested Column Using Clause
orderClause str Nested Column Ordering Clause
whereClause str Nested Column Where Clause
featureType str Feature Type of the Feature
dataType str Data Type of the Feature
detectedFeatureType str The detected feature type of the column
detectedDataType str The detected data type of the column
columns NestedFeature Nested Features
KEY TYPE Description
name str The unique name of the column
selectClause str The sql logic for creating this feature's data
featureType str Feature Type of the Feature
featureMapping str The Feature Mapping of the feature
dataType str Data Type of the Feature
sourceTable str The source table of the column
originalName str The original name of the column
pointInTimeInfo PointInTimeFeature Point in time column information
KEY TYPE Description
historyTableName str The name of the history table. If not specified, the current table is used for a self-join.
aggregationKeys List[str] List of keys to use for joining the historical table and performing the window aggregation.
timestampKey str Name of feature which contains the timestamp value for the point-in-time feature.
historicalTimestampKey str Name of feature which contains the historical timestamp.
lookbackWindowSeconds float If window is specified in terms of time, the number of seconds in the past from the current time for the start of the window.
lookbackWindowLagSeconds float Optional lag to offset the closest point for the window. If it is positive, the start of the window is delayed. If it is negative, we are looking at the "future" rows in the history table.
lookbackCount int If window is specified in terms of count, the start position of the window (0 is the current row).
lookbackUntilPosition int Optional lag to offset the closest point for the window. If it is positive, the start of the window is delayed by that many rows. If it is negative, we are looking at those many "future" rows in the history table.
expression str SQL aggregate expression which can convert a sequence of rows into a scalar value.
groupName str The group name this point-in-time feature belongs to.
duplicateFeatures Feature List of duplicate features.
KEY TYPE Description
name str The unique name of the column
selectClause str The sql logic for creating this feature's data
featureMapping str The Feature Mapping of the feature
sourceTable str The source table of the column
originalName str The original name of the column
usingClause str Nested Column Using Clause
orderClause str Nested Column Ordering Clause
whereClause str Nested Column Where Clause
featureType str Feature Type of the Feature
dataType str Data Type of the Feature
detectedFeatureType str The detected feature type of the column
detectedDataType str The detected data type of the column
columns NestedFeature Nested Features
KEY TYPE Description
name str The unique name of the column
selectClause str The sql logic for creating this feature's data
featureType str Feature Type of the Feature
featureMapping str The Feature Mapping of the feature
dataType str Data Type of the Feature
sourceTable str The source table of the column
originalName str The original name of the column
pointInTimeInfo PointInTimeFeature Point in time column information
KEY TYPE Description
historyTableName str The name of the history table. If not specified, the current table is used for a self-join.
aggregationKeys List[str] List of keys to use for joining the historical table and performing the window aggregation.
timestampKey str Name of feature which contains the timestamp value for the point-in-time feature.
historicalTimestampKey str Name of feature which contains the historical timestamp.
lookbackWindowSeconds float If window is specified in terms of time, the number of seconds in the past from the current time for the start of the window.
lookbackWindowLagSeconds float Optional lag to offset the closest point for the window. If it is positive, the start of the window is delayed. If it is negative, we are looking at the "future" rows in the history table.
lookbackCount int If window is specified in terms of count, the start position of the window (0 is the current row).
lookbackUntilPosition int Optional lag to offset the closest point for the window. If it is positive, the start of the window is delayed by that many rows. If it is negative, we are looking at those many "future" rows in the history table.
expression str SQL aggregate expression which can convert a sequence of rows into a scalar value.
groupName str The group name this point-in-time feature belongs to.
pointInTimeGroups PointInTimeGroup List of Point In Time Groups.
KEY TYPE Description
groupName str The name of the point in time group
windowKey str Name of feature which contains the timestamp value for the point in time feature
aggregationKeys list List of keys to use for join the historical table and performing the window aggregation.
lookbackWindow float Number of seconds in the past from the current time for start of the window.
lookbackWindowLag float Optional lag to offset the closest point for the window. If it is positive, we delay the start of window. If it is negative, we are looking at the "future" rows in the history table.
lookbackCount int If window is specified in terms of count, the start position of the window (0 is the current row)
lookbackUntilPosition int Optional lag to offset the closest point for the window. If it is positive, we delay the start of window by that many rows. If it is negative, we are looking at those many "future" rows in the history table.
historyTableName str The table to use for aggregating, if not provided, the source table will be used
historyWindowKey str Name of feature to use for ordering the rows on the history table. If not provided, the windowKey from the source table will be used
historyAggregationKeys list List of keys to use for join the historical table and performing the window aggregation. If not provided, the aggregationKeys from the source table will be used. Must be the same length and order as the source table's aggregationKeys
features PointInTimeGroupFeature List of features in the Point in Time group
KEY TYPE Description
name str The name of the feature
expression str SQL Aggregate expression which can convert a sequence of rows into a scalar value.
pitOperationType str The operation used in point in time feature generation
pitOperationConfig dict The configuration used as input to the operation type
annotationConfig AnnotationConfig Annotation config for this feature
KEY TYPE Description
featureAnnotationConfigs list List of feature annotation configs
labels list List of labels
statusFeature str Name of the feature that contains the status of the annotation (Optional)
commentsFeatures list Features that contain comments for the annotation (Optional)
metadataFeature str Name of the feature that contains the metadata for the annotation (Optional)
latestFeatureGroupVersion FeatureGroupVersion Latest feature group version.
KEY TYPE Description
featureGroupVersion str The unique identifier for this materialized version of feature group.
featureGroupId str The unique identifier of the feature group this version belongs to.
sql str The sql definition creating this feature group.
sourceTables List[str] The source tables for this feature group.
sourceDatasetVersions List[str] The dataset version ids for this feature group version.
createdAt str The timestamp at which the feature group version was created.
status str The current status of the feature group version.
error str Relevant error if the status is FAILED.
deployable bool whether feature group is deployable or not.
cpuSize str Cpu size specified for the python feature group.
memory int Memory in GB specified for the python feature group.
useOriginalCsvNames bool If true, the feature group will use the original column names in the source dataset.
pythonFunctionBindings list Config specifying variable names, types, and values to use when resolving a Python feature group.
indexingConfigWarningMsg str The warning message related to indexing keys.
materializationStartedAt str The timestamp at which the feature group materialization started.
materializationCompletedAt str The timestamp at which the feature group materialization completed.
columns List[Feature] List of resolved columns.
templateBindings list Template variable bindings used for resolving the template.
features Feature List of features.
KEY TYPE Description
name str The unique name of the column
selectClause str The sql logic for creating this feature's data
featureMapping str The Feature Mapping of the feature
sourceTable str The source table of the column
originalName str The original name of the column
usingClause str Nested Column Using Clause
orderClause str Nested Column Ordering Clause
whereClause str Nested Column Where Clause
featureType str Feature Type of the Feature
dataType str Data Type of the Feature
detectedFeatureType str The detected feature type of the column
detectedDataType str The detected data type of the column
columns NestedFeature Nested Features
pointInTimeInfo PointInTimeFeature Point in time column information
pointInTimeGroups PointInTimeGroup List of Point In Time Groups
KEY TYPE Description
groupName str The name of the point in time group
windowKey str Name of feature which contains the timestamp value for the point in time feature
aggregationKeys list List of keys to use for join the historical table and performing the window aggregation.
lookbackWindow float Number of seconds in the past from the current time for start of the window.
lookbackWindowLag float Optional lag to offset the closest point for the window. If it is positive, we delay the start of window. If it is negative, we are looking at the "future" rows in the history table.
lookbackCount int If window is specified in terms of count, the start position of the window (0 is the current row)
lookbackUntilPosition int Optional lag to offset the closest point for the window. If it is positive, we delay the start of window by that many rows. If it is negative, we are looking at those many "future" rows in the history table.
historyTableName str The table to use for aggregating, if not provided, the source table will be used
historyWindowKey str Name of feature to use for ordering the rows on the history table. If not provided, the windowKey from the source table will be used
historyAggregationKeys list List of keys to use for join the historical table and performing the window aggregation. If not provided, the aggregationKeys from the source table will be used. Must be the same length and order as the source table's aggregationKeys
features PointInTimeGroupFeature List of features in the Point in Time group
codeSource CodeSource If a python feature group, 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
annotationConfig AnnotationConfig The annotations config for the feature group.
KEY TYPE Description
featureAnnotationConfigs list List of feature annotation configs
labels list List of labels
statusFeature str Name of the feature that contains the status of the annotation (Optional)
commentsFeatures list Features that contain comments for the annotation (Optional)
metadataFeature str Name of the feature that contains the metadata for the annotation (Optional)
indexingConfig IndexingConfig The indexing config for the feature group.
KEY TYPE Description
primaryKey str A single key index
updateTimestampKey str The primary timestamp feature
lookupKeys List[str] A multi-key index. Cannot be used in conjuction with primary key.
concatenationConfig ConcatenationConfig Feature group ID whose data will be concatenated into this feature group.
KEY TYPE Description
concatenatedTable str The feature group to concatenate with the destination feature group.
mergeType str The type of merge to perform, either `UNION` or `INTERSECTION`.
replaceUntilTimestamp int The Unix timestamp to specify the point up to which data from the source feature group will be replaced.
skipMaterialize bool If `True`, the concatenated feature group will not be materialized.
indexingConfig IndexingConfig Indexing config for the feature group for feature store
KEY TYPE Description
primaryKey str A single key index
updateTimestampKey str The primary timestamp feature
lookupKeys List[str] A multi-key index. Cannot be used in conjuction with primary key.
codeSource CodeSource If a Python feature group, 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
featureGroupTemplate FeatureGroupTemplate FeatureGroupTemplate to use when this feature group is attached to a template.
KEY TYPE Description
featureGroupTemplateId str The unique identifier for this feature group template.
description str A user-friendly text description of this feature group template.
featureGroupId str The unique identifier for the feature group used to create this template.
isSystemTemplate bool True if this is a system template returned from a user organization.
name str The user-friendly name of this feature group template.
templateSql str SQL that can include variables which will be replaced by values from the template config to resolve this template SQL into a valid SQL query for a feature group.
templateVariables dict A map, from template variable names to parameters for replacing those template variables with values (e.g. to values and metadata on how to resolve those values).
createdAt str When the feature group template was created.
updatedAt str When the feature group template was updated.
explanation NaturalLanguageExplanation Natural language explanation of the feature group
KEY TYPE Description
shortExplanation str succinct explanation of the artifact
longExplanation str Longer and verbose explanation of the artifact
isOutdated bool Flag indicating whether the explanation is outdated due to a change in the underlying artifact
htmlExplanation str HTML formatted explanation of the artifact
refreshSchedules RefreshSchedule List of schedules that determines when the next version of the feature group will be created.
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
exportConnectorConfig FeatureGroupRefreshExportConfig The export config (file connector or database connector information) for feature group exports.
KEY TYPE Description
connectorType str The type of connector the feature group is
location str The file connector location of the feature group export
exportFileFormat str The file format of the feature group export
additionalIdColumns list Additional id columns to use for upsert operations
databaseFeatureMapping dict The mapping of feature names to database columns
externalConnectionId str The unique identifier of the external connection to write to
idColumn str The column to use as the id column for upsert operations
objectName str The name of the object to write to
writeMode str The write mode to use for the export
operatorConfig OperatorConfig Operator configuration settings for the feature group.
KEY TYPE Description
operatorType None None
modelConfig TrainingConfig The training config options used to train this model.
KEY TYPE Description
ALGORITHM None None
_SUPPORT_KWARGS None None
_UPPER_SNAKE_CASE_KEYS None None
PROBLEM_TYPE None None
KWARGS 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: