gmicloud 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.2
2
+ Name: gmicloud
3
+ Version: 0.1.0
4
+ Summary: GMI Cloud Python SDK
5
+ Home-page: https://github.com/GMISWE/python-sdk
6
+ Author: GMI
7
+ Author-email: GMI <gmi@gmitec.net>
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ Dynamic: author
15
+ Dynamic: home-page
16
+ Dynamic: requires-python
17
+
18
+ # GMICloud
19
+
20
+ ## Overview
21
+
22
+ This project is an open-source SDK for interacting with the GMICLOUD platform. It provides functionalities to manage
23
+ artifacts, tasks, and usage data efficiently.
24
+
25
+ ## Features
26
+
27
+ - Create and manage artifacts
28
+ - Create and manage tasks
29
+ - Fetch usage data
30
+ - Integration with OpenAI for chat completions
31
+
32
+ ## Installation
33
+
34
+ To install the SDK, use pip:
35
+
36
+ ```bash
37
+ pip install gmicloud-sdk
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ### Initialize the Client
43
+
44
+ ```python
45
+ from gmicloud import Client
46
+
47
+ client = Client(username="your_username", password="your_password")
48
+ ```
49
+
50
+ ### Create an Artifact with a File
51
+
52
+ ```python
53
+ artifact_id = client.artifact_manager.create_artifact_with_file(
54
+ artifact_name="Llama3.1 8B",
55
+ artifact_file_path="./files/Llama-3.1-8B-Instruct.zip",
56
+ description="This is a test artifact",
57
+ tags=['example', 'test']
58
+ )
59
+ ```
60
+
61
+ ### Create an Artifact from a Template
62
+
63
+ ```python
64
+ artifact_id = client.artifact_manager.create_artifact_from_template(
65
+ artifact_template_id="template_id"
66
+ )
67
+ ```
68
+
69
+ ### Create and Start a Task
70
+
71
+ ```python
72
+ task_id = client.task_manager.create_task(Task(
73
+ config=TaskConfig(
74
+ ray_task_config=RayTaskConfig(
75
+ ray_version="2.40.0-py310-gpu",
76
+ file_path="serve",
77
+ artifact_id=artifact_id,
78
+ deployment_name="app",
79
+ replica_resource=ReplicaResource(
80
+ cpu=2,
81
+ ram_gb=128,
82
+ gpu=2,
83
+ ),
84
+ ),
85
+ task_scheduling=TaskScheduling(
86
+ scheduling_oneoff=OneOffScheduling(
87
+ trigger_timestamp=int(datetime.now().timestamp()) + 60,
88
+ min_replicas=1,
89
+ max_replicas=10,
90
+ )
91
+ ),
92
+ ),
93
+ ))
94
+
95
+ client.task_manager.start_task(task_id)
96
+ ```
97
+
98
+ ### Call Chat Completion
99
+
100
+ ```python
101
+ from openai import OpenAI
102
+
103
+ task = client.task_manager.get_task(task_id)
104
+ open_ai = OpenAI(
105
+ api_key="YOUR_API_KEY",
106
+ base_url=task.info.endpoint
107
+ )
108
+
109
+ completion = open_ai.chat.completions.create(
110
+ model="meta-llama/Llama-3.1-8B-Instruct",
111
+ messages=[
112
+ {"role": "system", "content": "You are a helpful assistant."},
113
+ {"role": "user", "content": "Translate the sentences to Chinese"},
114
+ ],
115
+ max_tokens=200,
116
+ temperature=0.7
117
+ )
118
+
119
+ print(completion.choices[0].message.content)
120
+ ```
121
+
122
+ ## Configuration
123
+
124
+ ### One-off Task Configuration
125
+
126
+ `examples/config/one-off_task.json`:
127
+
128
+ ```json
129
+ {
130
+ "config": {
131
+ "ray_task_config": {
132
+ "ray_version": "2.40.0",
133
+ "file_path": "serve",
134
+ "deployment_name": "string",
135
+ "replica_resource": {
136
+ "cpu": 2,
137
+ "ram_gb": 12,
138
+ "gpu": 1
139
+ }
140
+ },
141
+ "task_scheduling": {
142
+ "scheduling_oneoff": {
143
+ "min_replicas": 1,
144
+ "max_replicas": 1
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ### Daily Task Configuration
152
+
153
+ `examples/config/daily_task.json`:
154
+
155
+ ```json
156
+ {
157
+ "config": {
158
+ "ray_task_config": {
159
+ "ray_version": "2.40.0-py310-gpu",
160
+ "file_path": "serve",
161
+ "deployment_name": "string",
162
+ "replica_resource": {
163
+ "cpu": 6,
164
+ "ram_gb": 64,
165
+ "gpu": 2
166
+ }
167
+ },
168
+ "task_scheduling": {
169
+ "scheduling_daily": {
170
+ "triggers": [
171
+ {
172
+ "timezone": "UTC",
173
+ "Hour": 0,
174
+ "minute": 10,
175
+ "second": 0,
176
+ "min_replicas": 1,
177
+ "max_replicas": 2
178
+ },
179
+ {
180
+ "timezone": "UTC",
181
+ "Hour": 0,
182
+ "minute": 10,
183
+ "second": 30,
184
+ "min_replicas": 1,
185
+ "max_replicas": 4
186
+ }
187
+ ]
188
+ }
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ ## Running Tests
195
+
196
+ To run the unit tests, use the following command:
197
+
198
+ ```bash
199
+ pytest
200
+ ```
201
+
202
+ ## Contributing
203
+
204
+ Contributions are welcome! Please open an issue or submit a pull request.
205
+
206
+ ## License
207
+
208
+ This project is licensed under the MIT License. See the `LICENSE` file for details.
@@ -0,0 +1,27 @@
1
+ examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ examples/example.py,sha256=VX0EQoLshF2bOm1eDCcrnA-9t3ZPUffKdSMUBVax_UM,4446
3
+ gmicloud/__init__.py,sha256=nvdQUQfy6KxeVU889VKyJjz9iXfShVHKb65rNfyIPlQ,740
4
+ gmicloud/client.py,sha256=D6wPXutlr3hWaFF_3azmYk5kMrvLSObvubDOe29mKfk,1775
5
+ gmicloud/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ gmicloud/_internal/_config.py,sha256=qIH76TSyS3MQWe62LHI46RJhDnklNFisdajY75oUAqE,218
7
+ gmicloud/_internal/_constants.py,sha256=EyhjJp_mEIsAuopFyfnRzGRVjQH9jOhU5AQvtBF_IeU,339
8
+ gmicloud/_internal/_enums.py,sha256=1xGle0FARJEQWkphjUM6yJ1hCqD9YKsh8_5GfkGEvio,477
9
+ gmicloud/_internal/_exceptions.py,sha256=hScBq7n2fOit4_umlkabZJchY8zVbWSRfWM2Y0rLCbw,306
10
+ gmicloud/_internal/_models.py,sha256=n8lHes_o3BzpHqS2ZL96OZ1HuaQRD7c1qqTvlHetYpg,12529
11
+ gmicloud/_internal/_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ gmicloud/_internal/_client/_artifact_client.py,sha256=IY3CZzcDUg7bM8-UwogF5n7Tb2gWQKUY1SCYcdvjhmA,7053
13
+ gmicloud/_internal/_client/_decorator.py,sha256=sy4gxzsUB6ORXHw5pqmMf7TTlK41Nmu1fhIhK2AIsbY,670
14
+ gmicloud/_internal/_client/_file_upload_client.py,sha256=1JRs4X57S3EScPIP9w2DC1Uo6_Wbcjumcw3nVM7uIGM,4667
15
+ gmicloud/_internal/_client/_http_client.py,sha256=V1fZ5O-Ja2n1Z0YHa-PkAMHY-yNFw--Dk_httldNYxA,6520
16
+ gmicloud/_internal/_client/_iam_client.py,sha256=57KHyGg_0Vj5AzwhIto0kmbqQYxnixKIOilNO8hCwr0,2698
17
+ gmicloud/_internal/_client/_task_client.py,sha256=76PpI2-ZjHHtGLMxJ_wEOh0mHnmPzVG7sCkWLxV2rAw,5110
18
+ gmicloud/_internal/_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ gmicloud/_internal/_manager/_artifact_manager.py,sha256=eUxi7ABAivGK_6B8xo9RXr_pieHyFZLFyDDtOU37SnA,12439
20
+ gmicloud/_internal/_manager/_task_manager.py,sha256=0GYjXRPtJswxDLPmVhLl3LNbQiXZP_49WUvd5OE3wn0,8119
21
+ gmicloud/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ gmicloud/tests/test_artifacts.py,sha256=c1MlkaLTaIeVJ3acn92fl3txcDFdy3itOTRhUXaze0E,17120
23
+ gmicloud/tests/test_tasks.py,sha256=AY90zTJdsXk1cxn6Jxhi4TDdwXRiGxz_r_aRk_Jkl8Y,10956
24
+ gmicloud-0.1.0.dist-info/METADATA,sha256=Vu5h1LtOonBVJ98U-noSJEHfnsFS0_N-wvc9gv9ZGzk,4308
25
+ gmicloud-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
26
+ gmicloud-0.1.0.dist-info/top_level.txt,sha256=2GhHEguTB3WOeNihOOrIwGp1n7pw_VTJbG8pa5WyyFk,18
27
+ gmicloud-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ examples
2
+ gmicloud