Package: aibuilder
Project descriptionAI Builder SDKAI Builder is a Microsoft Power Platform capability that provides AI models that are designed to optimize your business
processes. AI Builder enables your business to use AI to automate processes and glean insights from your data
inPower AppsandPower Automate.This SDK allows registration of model endpoints as AI Models with power platform to be leveraged in flows and power
apps.InstallingInstall Python 3.6+ from the linkhere. Click the 'Download' link on any version of Python greater than Python 3.6. For Linux and Mac OS please follow the appropriate link on the page. You can also install using an OS specific package manager of your choice.Run the installer to begin installation and be sure to check the box 'Add Python X.X to PATH'.Make sure the installation path is in the PATH variable by running:python --versionAfter python is installed, install aibuilder by running:pip install -f https://test.pypi.org/simple/ aibuilderCapabilitiesGet an EnvironmentAn environment is a space to store, manage, and share your organization's business data, apps, and flows. It also serves
as a container to separate apps that might have different roles, security requirements, or target audiences. How you
choose to use environments depends on your organization and the apps you're trying to build. Each environment is created
under an Azure Active Directory (Azure AD) tenant, and its resources can only be accessed by users within that tenant.
When you create an app in an environment, that app is only permitted to connect to the data sources that are also
deployed in that same environment, including connections, gateways, flows, and Dataverse databases. The AI Builder SDK
allows you to programmatically retrieve an existing environment where you want to register your machine learning model.
Clickhereto know more about
environments in Power Platform.Registering a modelOnce you have your machine learning model hosted on an endpoint, you can then create a scoring script to run the hosted
machine learning model. This script which now represents the machine learning model is required to be registered with
AI Builder in order to use prediction.Usage and ExamplesLetâ€™s say you have a machine learning model deployed on an endpoint and you are able todeploythe model
successfully on an Azure Container Instance. Here is an example use case in AI Builderfromazureml.core.webserviceimportAciWebservice,Webservice,Workspacefromazureml.exceptionsimportWebserviceExceptionfromaibuilder.core.environmentimportEnvironmentfromaibuilder.models.constantsimportModelClientResponseStatus# The name of the Power Platform environment where you are registering the modelenvironment_name='environment_name'# The name of the model endpoint to be created in AzureMLaci_service_name='service_name'# The name of the model as it will appear in AI Buildermodel_name="name_of_model_to_be_registered"ws=Workspace.get(name='your_workspace_name',subscription_id='your_subscription_id',resource_group='your_resource_group')# Get the ACI service based on what you deployed (otherwise, create one if service is not found)try:service=Webservice(ws,name=aci_service_name)exceptWebserviceExceptionase:print(f"Service not found:{aci_service_name}")print(service.state)# Should be displayed as healthy# Get the Environmentenv=Environment.get(environment_name=environment_name)# Register your machine learning model to AI Builderresponse=env.register_model(model_name=model_name,connection=service)ifresponse!=ModelClientResponseStatus.success:raiseException('Model registration failed')print(f"Registered AI Builder model{model_name}")LicenseAI Builder SDK

Copyright (c) Microsoft Corporation
All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the 
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 
Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.