Skip to main content

Project description

AI Builder SDK

AI 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 in Power Apps and Power Automate.

This SDK allows registration of model endpoints as AI Models with power platform to be leveraged in flows and power apps.

Installing

  1. Install Python 3.6+ from the link here. 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.

  2. Run the installer to begin installation and be sure to check the box 'Add Python X.X to PATH'.

  3. Make sure the installation path is in the PATH variable by running:

    python --version
    
  4. After python is installed, install aibuilder by running:

    pip install -f https://test.pypi.org/simple/ aibuilder
    
    

Capabilities

Get an Environment

An 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. Click here to know more about environments in Power Platform.

Registering a model

Once 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 Examples

Let’s say you have a machine learning model deployed on an endpoint and you are able to deploy the model successfully on an Azure Container Instance. Here is an example use case in AI Builder

      from azureml.core.webservice import AciWebservice, Webservice, Workspace
      from azureml.exceptions import WebserviceException

      from aibuilder.core.environment import Environment
      from aibuilder.models.constants import ModelClientResponseStatus

      # The name of the Power Platform environment where you are registering the model
      environment_name = 'environment_name'
      # The name of the model endpoint to be created in AzureML
      aci_service_name = 'service_name'
      # The name of the model as it will appear in AI Builder
      model_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)
      except WebserviceException as e:
         print(f"Service not found: {aci_service_name}")
      print(service.state) # Should be displayed as healthy

      # Get the Environment
      env = Environment.get(environment_name= environment_name)
      # Register your machine learning model to AI Builder
      response = env.register_model(model_name= model_name, connection=service)

      if response != ModelClientResponseStatus.success:
         raise Exception('Model registration failed')
      print(f"Registered AI Builder model {model_name}")

License

AI 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.

Metadata

Release files for aibuilder 0.0.54

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for aibuilder 0.0.54
File Interpreter ABI Platform
aibuilder-0.0.54-py3-none-any.whl Python 3 none any Details

Release files / aibuilder-0.0.54-py3-none-any.whl

Download URL aibuilder-0.0.54-py3-none-any.whl
Size 85.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
440183028022e8f6e7aa15e038a1d42a1f9d0e03e4ad1e2ff01f8a4fc6e6507c
BLAKE2b-256 checksum
How to use checksums
525e6379579890e4a5d97f0a1930a5a9c92505f5feec4974e0d26e92aacbd877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.56.0 importlib-metadata/3.10.1 keyring/23.0.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.54 This release

1 release file

0.0.53

1 release file

0.0.52

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page