|
38 | 38 | overload,
|
39 | 39 | TYPE_CHECKING,
|
40 | 40 | )
|
| 41 | +from typing_extensions import TypeAliasType |
41 | 42 |
|
42 | 43 | from google.cloud.aiplatform import initializer as aiplatform_initializer
|
43 | 44 | from google.cloud.aiplatform import utils as aiplatform_utils
|
|
85 | 86 |
|
86 | 87 |
|
87 | 88 | # These type defnitions are expanded to help the user see all the types
|
88 |
| -PartsType = Union[ |
89 |
| - str, |
90 |
| - "Image", |
91 |
| - "Part", |
92 |
| - List[Union[str, "Image", "Part"]], |
93 |
| -] |
| 89 | +PartsType = TypeAliasType( |
| 90 | + "PartsType", |
| 91 | + Union[ |
| 92 | + str, |
| 93 | + "Image", |
| 94 | + "Part", |
| 95 | + List[Union[str, "Image", "Part"]], |
| 96 | + ], |
| 97 | +) |
| 98 | + |
94 | 99 |
|
95 | 100 | ContentDict = Dict[str, Any]
|
96 |
| -ContentsType = Union[ |
97 |
| - List["Content"], |
98 |
| - List[ContentDict], |
99 |
| - str, |
100 |
| - "Image", |
101 |
| - "Part", |
102 |
| - List[Union[str, "Image", "Part"]], |
103 |
| -] |
| 101 | +ContentsType = TypeAliasType( |
| 102 | + "ContentsType", |
| 103 | + Union[ |
| 104 | + List["Content"], |
| 105 | + List[ContentDict], |
| 106 | + str, |
| 107 | + "Image", |
| 108 | + "Part", |
| 109 | + List[Union[str, "Image", "Part"]], |
| 110 | + ], |
| 111 | +) |
104 | 112 |
|
105 | 113 | GenerationConfigDict = Dict[str, Any]
|
106 |
| -GenerationConfigType = Union[ |
107 |
| - "GenerationConfig", |
108 |
| - GenerationConfigDict, |
109 |
| -] |
| 114 | +GenerationConfigType = TypeAliasType( |
| 115 | + "GenerationConfigType", |
| 116 | + Union[ |
| 117 | + "GenerationConfig", |
| 118 | + GenerationConfigDict, |
| 119 | + ], |
| 120 | +) |
110 | 121 |
|
111 |
| -SafetySettingsType = Union[ |
112 |
| - List["SafetySetting"], |
113 |
| - Dict[ |
114 |
| - gapic_content_types.HarmCategory, |
115 |
| - gapic_content_types.SafetySetting.HarmBlockThreshold, |
| 122 | +SafetySettingsType = TypeAliasType( |
| 123 | + "SafetySettingsType", |
| 124 | + Union[ |
| 125 | + List["SafetySetting"], |
| 126 | + Dict[ |
| 127 | + gapic_content_types.HarmCategory, |
| 128 | + gapic_content_types.SafetySetting.HarmBlockThreshold, |
| 129 | + ], |
116 | 130 | ],
|
117 |
| -] |
| 131 | +) |
118 | 132 |
|
119 | 133 |
|
120 | 134 | def _reconcile_model_name(model_name: str, project: str, location: str) -> str:
|
|
0 commit comments