|
13 | 13 | """This module contains utilities related to SageMaker JumpStart CuratedHub."""
|
14 | 14 | from __future__ import absolute_import
|
15 | 15 | import re
|
16 |
| -from typing import Any, Dict, Optional |
17 |
| -import boto3 |
| 16 | +from typing import Optional |
18 | 17 | from sagemaker.session import Session
|
19 | 18 | from sagemaker.jumpstart import constants
|
20 | 19 | from sagemaker.utils import aws_partition
|
21 | 20 | from sagemaker.jumpstart.curated_hub.types import (
|
22 |
| - DescribeHubResponse, |
23 | 21 | HubContentType,
|
24 |
| - DescribeHubContentsResponse, |
25 | 22 | HubArnExtractedInfo,
|
26 | 23 | )
|
27 | 24 |
|
28 | 25 |
|
29 |
| -def describe(hub_name: str, region: str) -> DescribeHubResponse: |
30 |
| - """Returns descriptive information about the Hub.""" |
31 |
| - |
32 |
| - sagemaker_session = Session(boto3.Session(region_name=region)) |
33 |
| - hub_description = sagemaker_session.describe_hub(hub_name=hub_name) |
34 |
| - return DescribeHubResponse(hub_description) |
35 |
| - |
36 |
| - |
37 |
| -def describe_model( |
38 |
| - hub_name: str, region: str, model_name: str, model_version: str = "*" |
39 |
| -) -> DescribeHubContentsResponse: |
40 |
| - """Returns descriptive information about the Hub model.""" |
41 |
| - |
42 |
| - sagemaker_session = Session(boto3.Session(region_name=region)) |
43 |
| - hub_content_description: Dict[str, Any] = sagemaker_session.describe_hub_content( |
44 |
| - hub_name=hub_name, |
45 |
| - hub_content_name=model_name, |
46 |
| - hub_content_version=model_version, |
47 |
| - hub_content_type=HubContentType.MODEL, |
48 |
| - ) |
49 |
| - |
50 |
| - return DescribeHubContentsResponse(hub_content_description) |
51 |
| - |
52 |
| - |
53 | 26 | def get_info_from_hub_resource_arn(
|
54 | 27 | arn: str,
|
55 | 28 | ) -> HubArnExtractedInfo:
|
|
0 commit comments