SAP AI Core SDK
Project description
SAP AI Core SDK
The SAP AI Core SDK is a Python-based SDK that lets you access SAP AI Core using Python methods and data structures. It provides tools that help you to manage your scenarios and workflows in SAP AI Core.
The SAP AI Core SDK can be used to interact with SAP AI Core. It provides access to all public lifecycle and administration APIs.
For example:
-
You can execute pipelines as a batch job to preprocess or train your models, or perform batch inference.
-
You can deploy а trained machine learning model as a web service to serve inference requests with high performance.
-
You can register your own Docker registry, synchronize your AI content from your own git repository, and register your own object store for training data and trained models.
Note
Note that executing online inference is not part of SAP AI Core SDK.
Example Usage
The SDK can, for instance, be used in a Jupyter notebook for convenient interaction with SAP AI Core in a test or development context.
Here are a few examples how to use the SDK. For details on the methods, please refer to the html documentation provided in the /docs
folder of the wheel file.
Import Definitions
from ai_core_sdk.ai_core_v2_client import AICoreV2Client
Create Client
client = AICoreV2Client(base_url=AI_API_BASE,
auth_url=AUTH_URL,
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
resource_group=resource_group_id)
Create New Resource Group
resource_group_create = client.resource_groups.create(resource_group_id=resource_group_id)
print(resource_group_create.resource_group_id)
resource_group_details = client.resource_groups.get(resource_group_id=resource_group_id)
print(f"{resource_group_details.status_message} \n{resource_group_details.resource_group_id}")
Create Object Store Secret
# access key and secret are assumed to reside in environment variables OSS_KEY and OSS_SECRET
object_store_secret_create = client.object_store_secrets.create(
name="default",
type="S3",
bucket="<your S3 bucket>",
endpoint="<your S3 host>",
path_prefix="<your path prefix in S3>", region="<your S3 region>",
data={"AWS_ACCESS_KEY_ID": os.environ.get("OSS_KEY"),
"AWS_SECRET_ACCESS_KEY": os.environ.get("OSS_SECRET")})
secret_get = client.object_store_secrets.get(name="default")
print(f"{secret_get.metadata}")
List Scenarios
scenarios = client.scenario.query()
for scenario in scenarios.resources:
print(f"{scenario.name} {scenario.id}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for ai_core_sdk-1.13.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0dc0a5eb2b7621d613454fbd47c619e11213a2138f38a8700df001a7c2bdee2 |
|
MD5 | 246fbf7bc8fce2de4cd212fd72bed462 |
|
BLAKE2b-256 | 38cca13677a194fe69adbebfece992c76504edc84651fcfa8c0539b9b1794408 |