ai-accelerator 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,30 @@
1
+ AI_Accelerator/__init__.py,sha256=Qog_80e_dE8BAx-_WIarnJqemKZfYOdHRKMi289HCcY,66
2
+ AI_Accelerator/asgi.py,sha256=lJ8t17rcPFTpYuc6kVIAiqDdIVDwOXwhhTWWIh7bX6Q,421
3
+ AI_Accelerator/celery.py,sha256=pFF9linM86qb-BSnefmuJ-TMD3bdZS7oT5mII2b46UI,249
4
+ AI_Accelerator/settings.py,sha256=flXPuH6DBTdJ04OPLGCvUpFVu7R9aLJTcnt51nBv8jc,5878
5
+ AI_Accelerator/urls.py,sha256=JU9Wk0Wa8ebMb6xfvPLDW7tyXBHkBMv-nTsLgQ3KHmA,1228
6
+ AI_Accelerator/wsgi.py,sha256=JJKHAOjpcLU-_rMD3NQ-iI9Vn-rOhM8KQmROhYm7fwg,421
7
+ ai_accelerator-0.1.0.dist-info/licenses/LICENSE,sha256=eAil3Vtwtgi9v4H_NX9BuMiPldu2DBqh7i8YXNf8mUE,10404
8
+ aiac/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ aiac/admin.py,sha256=p6xop1PuuDG2Uwv3G_aRfldxOfBzTRfMaoZmORVkqyU,66
10
+ aiac/aiac_cli.py,sha256=IEWT6r2ZfXxi4WLio9MU3kbbhfqA4L1kSPTM_KXQr3o,968
11
+ aiac/apps.py,sha256=qmvkqVIs26ycpmZfH0CGRU67pnI1WlA6pEz39mGkzTo,146
12
+ aiac/client.py,sha256=4AkBMOpmUaYZSO_LTL7VA2ryDtQpiutLyaoWpac6J-s,1219
13
+ aiac/config.py,sha256=lSGUSGY4RJ_PBLYDXaU4P2yJgkjmtv--BEFdj3OFOJM,781
14
+ aiac/console.py,sha256=1haxu-SyJtBNQ0eEbp2llNYf1oDN6E93V1U68Z8BoeE,424
15
+ aiac/main.py,sha256=7L8ZmG7AQMooBgAUqZRUYtuQuxWDjLnwhDnX5kILNqc,577
16
+ aiac/models.py,sha256=4OVMcDDx9fVgBEJ91B7dfMEG2Ni1LRSLJOKzIkVPsKo,60
17
+ aiac/requirments.txt,sha256=GJtnmf7xHl4d62Tz9Yo1xS0kBuEDZLxwrDj-2g8KmbY,56
18
+ aiac/tests.py,sha256=2uDafv3Ns6f7Vy1ekUtgYxCZEi1KRyesZDTAFhYcX-E,63
19
+ aiac/urls.py,sha256=Pl6Cikf7UleV6_2XR2dAzK86iF73N_Y2z2jcAWRBqVA,98
20
+ aiac/views.py,sha256=u0FhL7RT5byf5IlcnZEMrcH2TOnQkdfRQU2SjtA26m0,66
21
+ aiac/deployment/commands.py,sha256=F0EP4GIYLz-pFstb5clGG0RhR1ehJ18Y2YKXpVSMrrY,10437
22
+ aiac/governance/commands.py,sha256=gyRchSH2I5QGKylJwWgPmxnNiwhyQLucJk2ECT7SW1Y,5353
23
+ aiac/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ aiac/monitoring/commands.py,sha256=3tnc_dJP88tiU9thp-ss5vopSJjzYAME9H4uUAaW2VE,6252
25
+ aiac/user/auth.py,sha256=A3ykBEou9gc2inyG2X46CPkiAr0WIO7nhX2xgry6WX8,2245
26
+ ai_accelerator-0.1.0.dist-info/METADATA,sha256=ChbpEvbdC_e3_N2r3CGYdQUjnvGPNU9kQKpHhSV05os,37213
27
+ ai_accelerator-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
28
+ ai_accelerator-0.1.0.dist-info/entry_points.txt,sha256=TYBlH34m_FtnqGx7SuPvJ7Jwjhml7IxHeTiecWzpxVM,44
29
+ ai_accelerator-0.1.0.dist-info/top_level.txt,sha256=nYQ_NrzMlMgGthHJB1ochex6exaa0GNKE3FsgNcFVPI,20
30
+ ai_accelerator-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aiac = aiac.aiac_cli:main
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity granting the License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all
15
+ other entities that control, are controlled by, or are under common
16
+ control with that entity. For the purposes of this definition,
17
+ "control" means (i) the power, direct or indirect, to cause the
18
+ direction or management of such entity, whether by contract or
19
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity
23
+ exercising permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation
27
+ source, and configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical
30
+ transformation or translation of a Source form, including but
31
+ not limited to compiled object code, generated documentation,
32
+ and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or
35
+ Object form, made available under the License, as indicated by a
36
+ copyright notice that is included in or attached to the work
37
+ (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based upon (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and derivative works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to use, reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, trademark, patent,
101
+ attribution and other notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright notice to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Support, Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "page" as the copyright notice for easier identification within
186
+ third-party archives.
187
+
188
+ Copyright 2026 AI Accelerator Team
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ AI_Accelerator
2
+ aiac
aiac/__init__.py ADDED
File without changes
aiac/admin.py ADDED
@@ -0,0 +1,3 @@
1
+ from django.contrib import admin
2
+
3
+ # Register your models here.
aiac/aiac_cli.py ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ AIAC CLI - Command Line Interface for AI Accelerator
4
+
5
+ This script provides the main entry point for the AIAC CLI tool.
6
+ """
7
+
8
+ import typer
9
+ from aiac.user.auth import auth_app
10
+ from aiac.deployment.commands import api_app_deployment
11
+ from aiac.monitoring.commands import monitoring_api_app
12
+ from aiac.governance.commands import governance_api_app
13
+
14
+ # Create the main CLI app
15
+ app = typer.Typer(
16
+ name="aiac",
17
+ help="AI Accelerator Command Line Interface",
18
+ add_completion=False,
19
+ )
20
+
21
+ # Add sub-commands
22
+ app.add_typer(auth_app, name="auth", help="Authentication commands")
23
+ app.add_typer(api_app_deployment, name="deployment", help="Deployment management commands")
24
+ app.add_typer(monitoring_api_app, name="monitoring", help="Monitoring and analytics commands")
25
+ app.add_typer(governance_api_app, name="governance", help="Governance and policy commands")
26
+
27
+ def main():
28
+ app()
29
+
30
+ if __name__ == "__main__":
31
+ main()
aiac/apps.py ADDED
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class AiacConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "aiac"
aiac/client.py ADDED
@@ -0,0 +1,29 @@
1
+ from aiac.config import get_config, load_config
2
+ import requests
3
+
4
+ class AIACClient:
5
+ def __init__(self):
6
+ self.config = get_config()
7
+ self.tokens = load_config()
8
+
9
+ def api_request(self, endpoint: str, method: str = "GET", data: dict = None):
10
+ endpoint_url = f"{self.config.api_base_url}/{endpoint.lstrip('/')}"
11
+ headers = {}
12
+ if self.tokens and "access" in self.tokens:
13
+ headers["Authorization"] = f"Bearer {self.tokens['access']}"
14
+
15
+ try:
16
+ response = requests.request(method=method, url=endpoint_url, headers=headers, json=data)
17
+ if response.status_code >= 400:
18
+ raise Exception(f"API request failed: {response.status_code} - {response.text}")
19
+ return response.json()
20
+ except requests.RequestException as e:
21
+ raise Exception(f"Network error: {str(e)}")
22
+
23
+ def post(self, endpoint: str, json: dict = None):
24
+ """Convenience method for POST requests"""
25
+ return self.api_request(endpoint, method="POST", data=json)
26
+
27
+ def get(self, endpoint: str):
28
+ """Convenience method for GET requests"""
29
+ return self.api_request(endpoint, method="GET")
aiac/config.py ADDED
@@ -0,0 +1,26 @@
1
+ from pathlib import Path
2
+ import json
3
+
4
+ def get_config():
5
+ api_base_url = "http://localhost:8000/api"
6
+
7
+ return type("Config", (object,), {"api_base_url": api_base_url})()
8
+
9
+ def save_config(data: dict, api_base_url: str):
10
+ folder = Path.home() / ".aiac"
11
+ folder.parent.mkdir(exist_ok=True)
12
+ config_file = folder / "config.json"
13
+
14
+ with open(config_file, "w") as f:
15
+ json.dump({"API_BASE_URL": api_base_url, **data}, f, indent=4)
16
+ return folder
17
+
18
+ def load_config():
19
+ folder = Path.home() / ".aiac"
20
+ config_file = folder / "config.json"
21
+ if config_file.exists():
22
+ with open(config_file, "r") as f:
23
+ data = json.load(f)
24
+ return data
25
+ else:
26
+ return f"Config file not found at {config_file}"
aiac/console.py ADDED
@@ -0,0 +1,15 @@
1
+ from rich.console import Console
2
+
3
+ console = Console()
4
+
5
+ def print_message(message: str):
6
+ console.print(f"[bold green]{message}[/bold green]")
7
+
8
+ def print_error(message: str):
9
+ console.print(f"[bold red]{message}[/bold red]")
10
+
11
+ def print_warning(message: str):
12
+ console.print(f"[bold yellow]{message}[/bold yellow]")
13
+
14
+ def print_info(message: str):
15
+ console.print(f"[bold blue]{message}[/bold blue]")
@@ -0,0 +1,236 @@
1
+ from aiac.client import AIACClient
2
+ import typer
3
+ from aiac.console import console, print_info, print_message, print_warning
4
+ from rich.table import Table
5
+
6
+ api_app_deployment = typer.Typer(help="Deployment commands")
7
+
8
+ @api_app_deployment.command("create-project-deployment")
9
+ def create_deployment(owner: str = typer.Option(..., prompt=True, help="Owner of the project"),
10
+ project_name: str = typer.Option(..., prompt=True, help="Name of the project"),
11
+ description: str = typer.Option(..., prompt=True, help="Description of the project")):
12
+ """
13
+ Create a new deployment for a specified model version.
14
+ """
15
+ client = AIACClient()
16
+ data = {
17
+ "owner": owner,
18
+ "project_name": project_name,
19
+ "description": description,
20
+
21
+ }
22
+ try:
23
+ response = client.api_request(endpoint="projects/", method="POST", data=data)
24
+ typer.echo(f"Project created successfully: {response}")
25
+ except Exception as e:
26
+ typer.echo(f"Failed to create project: {str(e)}")
27
+
28
+ @api_app_deployment.command("create-model-version")
29
+ def create_model_version(project_id: int = typer.Option(..., prompt=True, help="ID of the project"),
30
+ description: str = typer.Option(..., prompt=True, help="Description of the model version"),
31
+ field_file_path: str = typer.Option(..., prompt=True, help="Path to the model file"),
32
+ sample_data: str = typer.Option(...,prompt=True, help="Path to the sample data CSV file")):
33
+
34
+ """
35
+ Create a new model version for a specified project.
36
+ """
37
+
38
+ client = AIACClient()
39
+ data = {
40
+ "project_id": project_id,
41
+ "description": description,
42
+ "field_file": field_file_path,
43
+ "sample_data": sample_data,
44
+ }
45
+ try:
46
+ response = client.api_request(endpoint="model-versions/", method="POST", data=data)
47
+ typer.echo(f"Model version created successfully: {response}")
48
+ except Exception as e:
49
+ typer.echo(f"Failed to create model version: {str(e)}")
50
+
51
+ @api_app_deployment.command("deploy-model-version")
52
+ def deploy_model_version(user_id: int = typer.Option(..., prompt=True, help="ID of the user deploying the model"),
53
+ model_version_id: int = typer.Option(..., prompt=True, help="ID of the model version to deploy"),
54
+ port: int = typer.Option(..., prompt=True, help="Port to deploy the model version on")):
55
+ """
56
+ Deploy a specified model version.
57
+ """
58
+ client = AIACClient()
59
+ data = {
60
+ "user_id": user_id,
61
+ "model_version_id": model_version_id,
62
+ "port": port,
63
+ }
64
+ response = client.api_request(endpoint="deployments/", method="POST", data=data)
65
+ if response.status_code == 201:
66
+ typer.echo(f"Model version deployed successfully: {response}")
67
+ else:
68
+ typer.echo(f"Failed to deploy model version: {response}")
69
+
70
+ @api_app_deployment.command("redeploy-model")
71
+ def redeploy_model(deployment_id: int = typer.Option(..., prompt=True, help="ID of the deployment to redeploy")):
72
+ """
73
+ Redeploy a specified deployment.
74
+ """
75
+ client = AIACClient()
76
+ endpoint = f"deployments/{deployment_id}/redeploy/"
77
+ response = client.api_request(endpoint=endpoint, method="POST")
78
+ if response.status_code == 200:
79
+ typer.echo(f"Deployment redeployed successfully: {response}")
80
+ else:
81
+ typer.echo(f"Failed to redeploy deployment: {response}")
82
+
83
+ @api_app_deployment.command("stop-deployment")
84
+ def stop_deployment(deployment_id: int = typer.Option(..., prompt=True, help="ID of the deployment to stop")):
85
+ """
86
+ Stop a specified deployment.
87
+ """
88
+ client = AIACClient()
89
+ endpoint = f"deployments/{deployment_id}/stop/"
90
+ response = client.api_request(endpoint=endpoint, method="POST")
91
+ if response.status_code == 200:
92
+ typer.echo(f"Deployment stopped successfully: {response}")
93
+ else:
94
+ typer.echo(f"Failed to stop deployment: {response}")
95
+
96
+ @api_app_deployment.command("delete-deployment")
97
+ def delete_deployment(deployment_id: int = typer.Option(..., prompt=True, help="ID of the deployment to delete")):
98
+ """
99
+ Delete a specified deployment.
100
+ """
101
+ client = AIACClient()
102
+ endpoint = f"deployments/{deployment_id}/delete/"
103
+ response = client.api_request(endpoint=endpoint, method="DELETE")
104
+ if response.status_code == 200:
105
+ typer.echo(f"Deployment deleted successfully: {response}")
106
+ else:
107
+ typer.echo(f"Failed to delete deployment: {response}")
108
+
109
+ @api_app_deployment.command("list-deployments")
110
+ def list_deployments():
111
+ """
112
+ List all deployments.
113
+ """
114
+ client = AIACClient()
115
+ response = client.api_request(endpoint="deployments/list/", method="GET")
116
+ if response.status_code == 200:
117
+ typer.echo(f"Deployments: {response}")
118
+ Table = Table(title="Deployments")
119
+ Table.add_column("ID", "Project", "Model Version", "Port", "Status","Server_IP","endpoint_url","Container_Id","Logs","Created", justify="right" , style="cyan", no_wrap=True)
120
+ Table.add_row("----", "-------", "-------------", "----", "------","---------","------------","------------","----","-------")
121
+ for deployment in response.json():
122
+ Table.add_row(
123
+ str(deployment["id"]),
124
+ str(deployment["project"]),
125
+ str(deployment["model_version"]),
126
+ str(deployment["port"]),
127
+ str(deployment["status"]),
128
+ str(deployment["server_ip"]),
129
+ str(deployment["endpoint_url"]),
130
+ str(deployment["docker_container_id"]),
131
+ str(deployment["logs"]),
132
+ str(deployment["created_at"]),
133
+ )
134
+ Table.add_row("----", "-------", "-------------", "----", "------","---------","------------","------------","----","-------")
135
+ console.print(Table)
136
+ else:
137
+ typer.echo(f"Failed to retrieve deployments: {response}")
138
+
139
+ @api_app_deployment.command("get-deployment-details")
140
+ def get_deployment_details(deployment_id: int = typer.Option(..., prompt=True, help="ID of the deployment to get details for")):
141
+ """
142
+ Get details of a specified deployment.
143
+ """
144
+ client = AIACClient()
145
+ endpoint = f"deployments/{deployment_id}/"
146
+ response = client.api_request(endpoint=endpoint, method="GET")
147
+ if response.status_code == 200:
148
+ typer.echo(f"Deployment details: {response}")
149
+ Table = Table(title="Deployment Details")
150
+ Table.add_column("Field", style="cyan", no_wrap=True)
151
+ for key, value in response.json().items():
152
+ Table.add_row(key, str(value))
153
+ console.print(Table)
154
+ else:
155
+ typer.echo(f"Failed to retrieve deployment details: {response}")
156
+
157
+ @api_app_deployment.command("list-projects")
158
+ def list_projects():
159
+ """
160
+ List all projects.
161
+ """
162
+ client = AIACClient()
163
+ response = client.api_request(endpoint="projects/", method="GET")
164
+ if response.status_code == 200:
165
+ typer.echo(f"Projects: {response}")
166
+ Table = Table(title="Projects")
167
+ Table.add_column("ID", "Owner", "Project Name", "Description", "Created At", justify="right" , style="cyan", no_wrap=True)
168
+ Table.add_row("----", "-------", "-------------", "-----------", "----------")
169
+ for project in response.json():
170
+ Table.add_row(
171
+ str(project["id"]),
172
+ str(project["owner"]),
173
+ str(project["project_name"]),
174
+ str(project["description"]),
175
+ str(project["created_at"]),
176
+ )
177
+ Table.add_row("----", "-------", "-------------", "-----------", "----------")
178
+ console.print(Table)
179
+ else:
180
+ typer.echo(f"Failed to retrieve projects: {response}")
181
+
182
+ @api_app_deployment.command("list-model-versions")
183
+ def list_model_versions():
184
+ """
185
+ List all model versions.
186
+ """
187
+ client = AIACClient()
188
+ response = client.api_request(endpoint="model-versions/", method="GET")
189
+ if response.status_code == 200:
190
+ typer.echo(f"Model Versions: {response}")
191
+ Table = Table(title="Model Versions")
192
+ Table.add_column("ID", "Project", "Description", "Field File", "Created At", "Updated At", "Deployed", justify="right" , style="cyan", no_wrap=True)
193
+ Table.add_row("----", "-------", "-----------", "----------", "----------", "----------", "--------")
194
+ for model_version in response.json():
195
+ Table.add_row(
196
+ str(model_version["id"]),
197
+ str(model_version["projet"]),
198
+ str(model_version["description"]),
199
+ str(model_version["field_file"]),
200
+ str(model_version["created_at"]),
201
+ str(model_version["updated_at"]),
202
+ str(model_version["deployed"]),
203
+ )
204
+ Table.add_row("----", "-------", "-----------", "----------", "----------", "----------", "--------")
205
+ console.print(Table)
206
+ else:
207
+ typer.echo(f"Failed to retrieve model versions: {response}")
208
+
209
+
210
+
211
+ @api_app_deployment.command("delete-project")
212
+ def delete_project(project_id: int = typer.Option(..., prompt=True, help="ID of the project to delete")):
213
+ """
214
+ Delete a specified project.
215
+ """
216
+ client = AIACClient()
217
+ endpoint = f"projects/{project_id}/delete/"
218
+ response = client.api_request(endpoint=endpoint, method="DELETE")
219
+ if response.status_code == 200:
220
+ typer.echo(f"Project deleted successfully: {response}")
221
+ else:
222
+ typer.echo(f"Failed to delete project: {response}")
223
+
224
+
225
+ @api_app_deployment.command("delete-model-version")
226
+ def delete_model_version(model_version_id: int = typer.Option(..., prompt=True, help="ID of the model version to delete")):
227
+ """
228
+ Delete a specified model version.
229
+ """
230
+ client = AIACClient()
231
+ endpoint = f"model-versions/{model_version_id}/delete/"
232
+ response = client.api_request(endpoint=endpoint, method="DELETE")
233
+ if response.status_code == 200:
234
+ typer.echo(f"Model version deleted successfully: {response}")
235
+ else:
236
+ typer.echo(f"Failed to delete model version: {response}")