Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This package contains utilities to interact with the AI Squared technology stack, particularly with developing and deploying models to the AI Squared Platform or other applications developed through the AI Squared JavaScript SDK.
This package is available through Pypi and can be installed by running the following command:
pip install aisquared
Alternatively, the latest version of the software can be installed directly from GitHub using the following command
pip install git+https://github.com/AISquaredInc/aisquared
This package is currently in a state of constant development, so it is likely that breaking changes can be made at any time. We will work diligently to document changes and make stable releases in the future.
The aisquared
package currently contains five subpackages, the aisquared.config
package, the aisquared.base
subpackage, the aisquared.logging
subpackage, the aisquared.serving
subpackage, and the aisquared.platform
package. The config
package holds objects for building the configuration files that need to be included with converted model files for use within the AI Squared Extension. The contents of the config subpackage contain both pre- and postprocessing steps as well as harvesting, analytic, rendering, and feedback objects to use with the model. The following will explain the functionality of the config package:
aisquared.config
The aisquared.config
subpackage contains the following objects:
ModelConfiguration
ModelConfiguration
object is the final object to be used to create the configuration file. It takes as input a list of harvesting steps, list of preprocessing steps, a list of analytics, a list of postprocessing steps, a list of rendering steps, an optional MLFlow URI, an optional MLFlow user, and an optional MLFlow tokenGraphConfiguration
aisquared.config.harvesting
The aisquared.config.harvesting
subpackage contains the following objects:
ImageHarvester
ImageHarvester
class indicates the harvesting of images within the DOM to perform prediction onTextHarvester
TextHarvester
class indicates the harvesting of text within the DOM to perform prediction onInputHarvester
InputHarvester
class configures harvesting of different kinds of user-defined inputsQueryParameterHarvester
QueryParameterHarvester
class configures harvesting based on query parametersaisquared.config.preprocessing
The aisquared.config.preprocessing
subpackage contains the following objects:
ImagePreprocessor
ImagePreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for images.TabularPreprocessor
TabularPreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for tabular data.TextPreprocessor
TextPreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for text data.aisquared.config.analytic
The aisquared.config.analytic
subpackage contains the following objects:
LocalAnalytic
LocalAnalytic
class indicates the use of an analytic or lookup table from a local fileLocalModel
LocalModel
class indicates the use of a model from a local fileDeployedAnalytic
DeployedAnalytic
class indicates the use of an analytic or lookup table from a remote resourceDeployedModel
DeployedModel
class indicates the use of a model deployed to a remote resourceReverseMLWorkflow
ReverseMLWorkflow
class indicates the use of a Reverse ML Workflow, pulling predictions from a remote sourceaisquared.config.postprocessing
The aisquared.config.postprocessing
subpackage contains the following objects:
Regression
Regression
object is a postprocessing class for models which perform regression. Since it is common to train regression models by scaling regression outputs to values between 0 and 1, this class is designed to convert output values between 0 and 1 to their original values, corresponding to min
and max
when the class is instantiated.BinaryClassification
BinaryClassification
object is a postprocessing class for models which perform binary classification. The class is instantiated with a label map and a cutoff value used to identify when the positive class (class 1) is identified.MulticlassClassification
MulticlassClassification
object is a postprocessing class for models which perform multiclass classification. The class is instantiated with a label map only.ObjectDetection
ObjectDetection
object is a postprocessing class for models which perform object detection. The class is instantiated with a label map and a cutoff value for identification.aisquared.config.rendering
The aisquared.config.rendering
subpackage contains the following objects:
ImageRendering
ImageRendering
object is a rendering class for rendering single predictions on images.ObjectRendering
ObjectRendering
object is a rendering class for rendering object detection predictions on images.WordRendering
WordRendering
object is a rendering class for rendering highlights, underlines, or badges on individual words.DocumentRendering
DocumentRendering
object is a rendering class for rendering document predictions.BarChartRendering
BarChartRendering
object is a rendering class for rendering bar charts.ContainerRendering
ContainerRendering
object is a rendering class for rendering containers.DashboardReplacementRendering
DashboardReplacementRendering
object is a rendering class for rendering complete dashboard replacementsDoughnutChartRendering
DoughnutChartRendering
object is a class for rendering doughnut chartsFilterRendering
FilterRendering
object is a class for pass data in a model chainHTMLTagRendering
HTMLTagRendering
object is a class for rendering HTML tagsPieChartRendering
PieChartRendering
object is a class for rendering pie chartsSOSRendering
SOSRendering
object is a class for rendering SOS dashboardsTableRendering
TableRendering
object is a class for rendering tablesaisquared.config.feedback
The aisquared.config.feedback
subpackage contains the following objects:
SimpleFeedback
SimpleFeedback
object is a feedback object for simple thumbs up/thumbs down for predictionsBinaryFeedback
BinaryFeedback
object is a feedback object for binary classification use casesMulticlassFeedback
MulticlassFeedback
object is a feedback object for multiclass classification use casesRegressionFeedback
RegressionFeedback
object is a feedback object for regression use casesModelFeedback
ModelFeedback
object is a feedback object for configuring feedback for the model directly, rather than its predictionsQualitativeFeedback
QualitativeFeedback
object is a feedback object for configuring questions asked about each individual prediction the model makesThe aisquared.config.preprocessing
subpackage contains PreProcStep
objects, which are then fed into the ImagePreprocessor
, TabularPreprocessor
, and TextPreprocessor
classes. The PreProcStep
classes are:
tabular.ZScore
tabular.MinMax
tabular.OneHot
tabular.DropColumn
image.AddValue
image.SubtractValue
image.MultiplyValue
image.DivideValue
image.ConvertToColor
image.Resize
text.Tokenize
text.RemoveCharacters
text.ConvertToCase
text.ConvertToVocabulary
text.PadSequences
These step objects can then be placed within the TabularPreprocessor
, ImagePreprocessor
, or TextPreprocessor
objects. For the TabularPreprocessor
, the ZScore
, MinMax
, and OneHot
Steps are supported. For the ImagePreprocessor
, the AddValue
, SubtractValue
, MultiplyValue
, DivideValue
, ConvertToColor
, and Resize
Steps are supported. For the TextPreprocessor
, the Tokenize
, RemoveCharacters
, ConvertToCase
, ConvertToVocabulary
, and PadSequences
Steps are supported
Once harvesting, preprocessing, analytic, postprocessing, and rendering objects have been created, these objects can then be passed to the aisquared.config.ModelConfiguration
class. This class utilizes the objects passed to it to build the entire model configuration automatically.
Once the ModelConfiguration
object has been created with the required parameters, the .compile()
method can be used to create a file with the .air
extension that can be loaded into an application which utilizes the AI Squared JavaScript SDK.
aisquared.base
The aisquared.base
subpackage contains base utilities not designed to be directly called by the end user.
aisquared.platform
The aisquared.platform
subpackage contains classes and utilities for interacting with the AI Squared Platform. It primarily contains the AISquaredPlatformClient
with the following capabilities:
.air
files deployed to the platform.air
file deployed in the platform.air
file deployed in the platform.air
file shared with them.air
file with users.air
file with usersaisquared.serving
(requires installing aisquared[full])The aisquared.serving
subpackage contains utilities for serving models locally or remotely using MLflow or locally using Flask.
aisquared.logging
(requires installing aisquared[full])The aisquared.logging
subpackage is powered by MLflow, a powerful open-source platform for the machine learning lifecycle. The logging
subpackage inherits nearly all functionality from mlflow, so we highly recommend users refer to the MLflow documentation site for additional information.
In this subpackage, we have additionally added implementations of individual functions to save TensorFlow, Keras, Scikit-Learn, and PyTorch models in a format that can be deployed quickly using MLflow.
AI Squared welcomes feedback and contributions to this repository! We use GitHub for issue tracking, so feel free to place your input there. For any issues you would like to keep confidential, such as any confidential security issues, or if you would like to contribute directly to this project, please reach out to pythonsdk@squared.ai and we will get back to you as soon as possible.
Below are a list of additional features, bug fixes, and other changes made for each version.
flags
parameter to TextHarvester
using regular expression harvestingmodel_feedback
parameter in ModelConfiguration
object and included functionality in feedback_steps
parameterformat
parameter to header
for both deployed analyticsDocumentPredictor
and ImagePredictor
objectsALLOWED_STAGES
ModelConfiguration
to include url
parameteraisquared.logging
subpackageInputHarvester
aisquared.serving
subpackage, specifically the deploy_model
and get_remote_prediction
functionsGraphConfiguration
classauto-run
parameter to ModelConfiguration
and GraphConfiguration
classesaisquared
CLI with the following commands:
aisquared deploy
, which deploys a model locallyaisquared predict
, which predicts using a local JSON fileaisquared airfiles
, which contains the subcommands list
, delete
, download
, and upload
aisquared.config.analytic
to accept 'tabular'
as an input_type
aisquared.logging
and aisquared.remote
from top-level importsround
parameter to Regression postprocesserDocumentPredictor
and ImagePredictor
classesChainRendering
classFilterRendering
classQUALIFIERS
logging
and remote
subpackages from top-level aisquared
importS3Connector
class to the analytics
subpackage, which allows download of an analytic directly from S3docs
subdirectory for hosting the documentation on GitHub Pagesto_dict
method within ObjectRendering
classMultiplyValue
stepbody_only
parameter to TextHarvester
'underline'
to possible badgesthreshold_key
and threshold_values
to relevant rendering classesTrim
text preprocessing classCustomObject
in the base package to allow for creation of custom classesutils
subpackage with capabilities to mimic a trained sklearn modelaisquared
and aisquared[full]
all
parameter to LocalAnalytic
classmimic_model
function in line with updates to BeyondML
ReverseMLWorkflow
analyticBarChartRendering
, ContainerRendering
, DashboardReplacementRendering
, DoughnutChartRendering
, HTMLTagRendering
, LineChartRendering
, PieChartRendering
, SOSRendering
, and TableRendering
rendering classesQueryParameterHarvester
harvester classlimit
parameter to the TextHarvester classAISquaredPlatformClient
top_level_kwargs
parameter to the CustomObject
classDashboardRendering
classAISquaredPlatformClient
AISquaredPlatformClient
auto_run
parameter to be string (fix involves casting as string)ModelConfiguration
class to allow a more functional interface to build .air
filesContainerRendering
class with parameters for position
and static_position
AISquaredPlatformClient
AISquaredPlatformClient
to interact directly with the platform ALBAISquaredPlatformClient
to import functions from support filesCustomObject
to aisquared.config
from aisquared.base
AISquaredPlatformClient
file_name
parameter in ReverseMLWorkflow
to file_names
documentation_link
parameter to ModelConfiguration
classModelConfiguration
Rendering classes2.12.0
to prevent import issuesposition
parameter to WordRendering
classprocessor
classes to processer
DeployedAnalytic
class to include API key managementModelConfiguration
and GraphConfiguration
APIs into .air
files0.3.6
ChatbotHarvester
classTextRendering
classCustomRendering
classCustomObject
in aisquared.base
subpackageDatabricksClient
to the aisquared.platform
subpackageDeployedModel
class configuration to conform to AIRJSDatabricksClient
class to include update_job
functionReverseMLWorkflow
class'User-Agent'
to headers for AISquaredPlatformClient
and DatabricksClient
llmlink
as a dependency to the 'full' installation of aisquared
and added it as a top-level packageDeployedModel
class to support more abstract API callsChatbotHarvester
, DeployedAnalytic
, and ChatRendering
classesModelConfiguration
class with warnings
and documentURL
DeployedAnalytic
class with more general support for API calls, DeployedModel
to be deprecatedONNXModel
class to support ONNX modelsaisquared
on Mac ARM devicesFAQs
Utilities for interacting with the AI Squared Technology Stack
We found that aisquared demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.