From 21ca6b237b580836185f0da2772e62f090198f98 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 16 Oct 2025 10:36:08 +0530 Subject: [PATCH 01/13] fusion commands to start and stop model --- singlestoredb/fusion/handlers/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/singlestoredb/fusion/handlers/utils.py b/singlestoredb/fusion/handlers/utils.py index f5e82b03..ae1923ef 100644 --- a/singlestoredb/fusion/handlers/utils.py +++ b/singlestoredb/fusion/handlers/utils.py @@ -18,6 +18,8 @@ from ...management.workspace import Workspace from ...management.workspace import WorkspaceGroup from ...management.workspace import WorkspaceManager +from ...management.inference_api import InferenceAPIInfo +from ...management.inference_api import InferenceAPIManager def get_workspace_manager() -> WorkspaceManager: From c262771dd9d1fc4bda1c15842b5aa4da696481d4 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 16 Oct 2025 11:11:56 +0530 Subject: [PATCH 02/13] changes --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 775ccf6b..15874a62 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -219,7 +219,7 @@ def __init__(self, manager: Optional[Manager]): def get(self, model_name: str) -> InferenceAPIInfo: if self._manager is None: raise ManagementError(msg='Manager not initialized') - res = self._manager._get(f'inferenceapis/{self.project_id}/{model_name}').json() + res = self._manager._get(f'v1/inferenceapis/{self.project_id}/{model_name}').json() inference_api = InferenceAPIInfo.from_dict(res) inference_api._manager = self # Associate the manager return inference_api From 2228495ba4dfe359ab9de38950119fbda693ca13 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 16 Oct 2025 13:30:22 +0530 Subject: [PATCH 03/13] changes --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 15874a62..775ccf6b 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -219,7 +219,7 @@ def __init__(self, manager: Optional[Manager]): def get(self, model_name: str) -> InferenceAPIInfo: if self._manager is None: raise ManagementError(msg='Manager not initialized') - res = self._manager._get(f'v1/inferenceapis/{self.project_id}/{model_name}').json() + res = self._manager._get(f'inferenceapis/{self.project_id}/{model_name}').json() inference_api = InferenceAPIInfo.from_dict(res) inference_api._manager = self # Associate the manager return inference_api From 9284fcbc7302435cfe779db525f0a9f0163c1b33 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Wed, 29 Oct 2025 12:07:13 +0530 Subject: [PATCH 04/13] pre commit checks --- singlestoredb/fusion/handlers/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/singlestoredb/fusion/handlers/utils.py b/singlestoredb/fusion/handlers/utils.py index ae1923ef..f5e82b03 100644 --- a/singlestoredb/fusion/handlers/utils.py +++ b/singlestoredb/fusion/handlers/utils.py @@ -18,8 +18,6 @@ from ...management.workspace import Workspace from ...management.workspace import WorkspaceGroup from ...management.workspace import WorkspaceManager -from ...management.inference_api import InferenceAPIInfo -from ...management.inference_api import InferenceAPIManager def get_workspace_manager() -> WorkspaceManager: From 544b3263036a32aa5728b78bac525798f4855c2d Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 30 Oct 2025 11:05:44 +0530 Subject: [PATCH 05/13] review changes --- singlestoredb/fusion/handlers/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/singlestoredb/fusion/handlers/models.py b/singlestoredb/fusion/handlers/models.py index a408147c..15a5e769 100644 --- a/singlestoredb/fusion/handlers/models.py +++ b/singlestoredb/fusion/handlers/models.py @@ -7,6 +7,7 @@ from .. import result from ..handler import SQLHandler from ..result import FusionSQLResult +from .. import result from .files import ShowFilesHandler from .utils import get_file_space from .utils import get_inference_api From 43598d103ecd23f44bd485c71c904752c9cd4775 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 30 Oct 2025 11:09:34 +0530 Subject: [PATCH 06/13] checks changes --- singlestoredb/fusion/handlers/models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/singlestoredb/fusion/handlers/models.py b/singlestoredb/fusion/handlers/models.py index 15a5e769..a408147c 100644 --- a/singlestoredb/fusion/handlers/models.py +++ b/singlestoredb/fusion/handlers/models.py @@ -7,7 +7,6 @@ from .. import result from ..handler import SQLHandler from ..result import FusionSQLResult -from .. import result from .files import ShowFilesHandler from .utils import get_file_space from .utils import get_inference_api From 6f2af76ccaa5856621e236f80fbc8c2faaaeb249 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 30 Oct 2025 11:50:00 +0530 Subject: [PATCH 07/13] debug issue commit --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 775ccf6b..c50fadf0 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -50,7 +50,7 @@ def from_start_response(cls, response: Dict[str, Any]) -> 'ModelOperationResult' """ return cls( - name=response.get('modelName', ''), + name=response.get('modelID', ''), status='Initializing', hosting_platform=response.get('hostingPlatform', ''), ) From c236ea72e33f5ccbb59ec3ace55af918dabad689 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Thu, 30 Oct 2025 12:21:54 +0530 Subject: [PATCH 08/13] response changes --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index c50fadf0..775ccf6b 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -50,7 +50,7 @@ def from_start_response(cls, response: Dict[str, Any]) -> 'ModelOperationResult' """ return cls( - name=response.get('modelID', ''), + name=response.get('modelName', ''), status='Initializing', hosting_platform=response.get('hostingPlatform', ''), ) From 85ada9103933cbeef17be60f5d92f42c2d68ade3 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Mon, 3 Nov 2025 13:54:14 +0530 Subject: [PATCH 09/13] replaced inferenceapis with models in model routes --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 775ccf6b..6e67c71c 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -219,7 +219,7 @@ def __init__(self, manager: Optional[Manager]): def get(self, model_name: str) -> InferenceAPIInfo: if self._manager is None: raise ManagementError(msg='Manager not initialized') - res = self._manager._get(f'inferenceapis/{self.project_id}/{model_name}').json() + res = self._manager._get(f'models/{self.project_id}/{model_name}').json() inference_api = InferenceAPIInfo.from_dict(res) inference_api._manager = self # Associate the manager return inference_api From 6e9cc0be675cc8fb49cf758a17c8192754017c02 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Mon, 3 Nov 2025 14:36:13 +0530 Subject: [PATCH 10/13] revert get endpoint changes --- singlestoredb/management/inference_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 6e67c71c..775ccf6b 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -219,7 +219,7 @@ def __init__(self, manager: Optional[Manager]): def get(self, model_name: str) -> InferenceAPIInfo: if self._manager is None: raise ManagementError(msg='Manager not initialized') - res = self._manager._get(f'models/{self.project_id}/{model_name}').json() + res = self._manager._get(f'inferenceapis/{self.project_id}/{model_name}').json() inference_api = InferenceAPIInfo.from_dict(res) inference_api._manager = self # Associate the manager return inference_api From 113d890d1fdb798c0758dd0f03af7ba87971d43e Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Fri, 7 Nov 2025 13:42:10 +0530 Subject: [PATCH 11/13] aura models show and drop commands initial commit --- singlestoredb/fusion/handlers/models.py | 94 +++++++++++++++++++++++ singlestoredb/management/inference_api.py | 92 ++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/singlestoredb/fusion/handlers/models.py b/singlestoredb/fusion/handlers/models.py index a408147c..c143cfb4 100644 --- a/singlestoredb/fusion/handlers/models.py +++ b/singlestoredb/fusion/handlers/models.py @@ -10,6 +10,7 @@ from .files import ShowFilesHandler from .utils import get_file_space from .utils import get_inference_api +from .utils import get_inference_api_manager class ShowCustomModelsHandler(ShowFilesHandler): @@ -346,3 +347,96 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: StopModelHandler.register(overwrite=True) + + +class ShowInferenceAPIsHandler(SQLHandler): + """ + SHOW INFERENCE APIS ; + + Description + ----------- + Displays the list of inference APIs in the current project. + + Example + -------- + The following command lists all inference APIs:: + + SHOW INFERENCE APIS; + + See Also + -------- + * ``START MODEL model_name`` + * ``STOP MODEL model_name`` + * ``DROP INFERENCE API model_name`` + + """ # noqa: E501 + + def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: + inference_api_manager = get_inference_api_manager() + models = inference_api_manager.show() + + res = FusionSQLResult() + res.add_field('Model Name', result.STRING) + res.add_field('Status', result.STRING) + + rows = [] + for model in models: + rows.append(( + model.name, + model.status, + )) + + res.set_rows(rows) + return res + + +ShowInferenceAPIsHandler.register(overwrite=True) + + +class DropInferenceAPIHandler(SQLHandler): + """ + DROP INFERENCE API model_name ; + + # Model Name + model_name = '' + + Description + ----------- + Drops (deletes) an inference API model. + + Arguments + --------- + * ````: Name of the model to drop. + + Example + -------- + The following command drops an inference API:: + + DROP INFERENCE API my_model; + + See Also + -------- + * ``START MODEL model_name`` + * ``STOP MODEL model_name`` + * ``SHOW INFERENCE APIS`` + + """ # noqa: E501 + + def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: + inference_api = get_inference_api(params) + operation_result = inference_api.drop() + + res = FusionSQLResult() + res.add_field('Status', result.STRING) + res.add_field('Message', result.STRING) + res.set_rows([ + ( + operation_result.status, + operation_result.get_message(), + ), + ]) + + return res + + +DropInferenceAPIHandler.register(overwrite=True) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 775ccf6b..8c18134e 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -3,6 +3,7 @@ import os from typing import Any from typing import Dict +from typing import List from typing import Optional from .utils import vars_to_str @@ -76,6 +77,48 @@ def from_stop_response(cls, response: Dict[str, Any]) -> 'ModelOperationResult': hosting_platform=response.get('hostingPlatform', ''), ) + @classmethod + def from_drop_response(cls, response: Dict[str, Any]) -> 'ModelOperationResult': + """ + Create a ModelOperationResult from a drop operation response. + + Parameters + ---------- + response : dict + Response from the drop endpoint + + Returns + ------- + ModelOperationResult + + """ + return cls( + name=response.get('name', ''), + status=response.get('status', 'Deleted'), + hosting_platform=response.get('hostingPlatform', ''), + ) + + @classmethod + def from_show_response(cls, response: Dict[str, Any]) -> 'ModelOperationResult': + """ + Create a ModelOperationResult from a show operation response. + + Parameters + ---------- + response : dict + Response from the show endpoint (single model info) + + Returns + ------- + ModelOperationResult + + """ + return cls( + name=response.get('name', ''), + status=response.get('status', ''), + hosting_platform=response.get('hostingPlatform', ''), + ) + def get_message(self) -> str: """ Get a human-readable message about the operation. @@ -195,6 +238,20 @@ def stop(self) -> ModelOperationResult: raise ManagementError(msg='No manager associated with this inference API') return self._manager.stop(self.name) + def drop(self) -> ModelOperationResult: + """ + Drop this inference API model. + + Returns + ------- + ModelOperationResult + Result object containing status information about the dropped model + + """ + if self._manager is None: + raise ManagementError(msg='No manager associated with this inference API') + return self._manager.drop(self.name) + class InferenceAPIManager(object): """ @@ -263,3 +320,38 @@ def stop(self, model_name: str) -> ModelOperationResult: raise ManagementError(msg='Manager not initialized') res = self._manager._post(f'models/{model_name}/stop') return ModelOperationResult.from_stop_response(res.json()) + + def show(self) -> List[ModelOperationResult]: + """ + Show all inference APIs in the project. + + Returns + ------- + List[ModelOperationResult] + List of ModelOperationResult objects with status information + + """ + if self._manager is None: + raise ManagementError(msg='Manager not initialized') + res = self._manager._get('models').json() + return [ModelOperationResult.from_show_response(api) for api in res] + + def drop(self, model_name: str) -> ModelOperationResult: + """ + Drop an inference API model. + + Parameters + ---------- + model_name : str + Name of the model to drop + + Returns + ------- + ModelOperationResult + Result object containing status information about the dropped model + + """ + if self._manager is None: + raise ManagementError(msg='Manager not initialized') + res = self._manager._delete(f'models/{model_name}/drop') + return ModelOperationResult.from_drop_response(res.json()) From 0284b2b69781e517b8d24185ee2917936a38cd41 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Fri, 14 Nov 2025 10:18:54 +0530 Subject: [PATCH 12/13] changes --- singlestoredb/fusion/handlers/models.py | 20 ++++++++++---------- singlestoredb/management/inference_api.py | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/singlestoredb/fusion/handlers/models.py b/singlestoredb/fusion/handlers/models.py index c143cfb4..86271aa9 100644 --- a/singlestoredb/fusion/handlers/models.py +++ b/singlestoredb/fusion/handlers/models.py @@ -349,9 +349,9 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: StopModelHandler.register(overwrite=True) -class ShowInferenceAPIsHandler(SQLHandler): +class ShowModelsHandler(SQLHandler): """ - SHOW INFERENCE APIS ; + SHOW MODELS ; Description ----------- @@ -361,13 +361,13 @@ class ShowInferenceAPIsHandler(SQLHandler): -------- The following command lists all inference APIs:: - SHOW INFERENCE APIS; + SHOW MODELS; See Also -------- * ``START MODEL model_name`` * ``STOP MODEL model_name`` - * ``DROP INFERENCE API model_name`` + * ``DROP MODEL model_name`` """ # noqa: E501 @@ -390,12 +390,12 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: return res -ShowInferenceAPIsHandler.register(overwrite=True) +ShowModelsHandler.register(overwrite=True) -class DropInferenceAPIHandler(SQLHandler): +class DropModelHandler(SQLHandler): """ - DROP INFERENCE API model_name ; + DROP MODEL model_name ; # Model Name model_name = '' @@ -412,13 +412,13 @@ class DropInferenceAPIHandler(SQLHandler): -------- The following command drops an inference API:: - DROP INFERENCE API my_model; + DROP MODEL my_model; See Also -------- * ``START MODEL model_name`` * ``STOP MODEL model_name`` - * ``SHOW INFERENCE APIS`` + * ``SHOW MODELS`` """ # noqa: E501 @@ -439,4 +439,4 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: return res -DropInferenceAPIHandler.register(overwrite=True) +DropModelHandler.register(overwrite=True) diff --git a/singlestoredb/management/inference_api.py b/singlestoredb/management/inference_api.py index 8c18134e..404fa1c5 100644 --- a/singlestoredb/management/inference_api.py +++ b/singlestoredb/management/inference_api.py @@ -353,5 +353,5 @@ def drop(self, model_name: str) -> ModelOperationResult: """ if self._manager is None: raise ManagementError(msg='Manager not initialized') - res = self._manager._delete(f'models/{model_name}/drop') + res = self._manager._delete(f'models/{model_name}') return ModelOperationResult.from_drop_response(res.json()) From 8e654704b86c3a5f711620276b4c5a46e7dd9435 Mon Sep 17 00:00:00 2001 From: Mohit Verma Date: Tue, 18 Nov 2025 20:48:46 +0530 Subject: [PATCH 13/13] review changes --- singlestoredb/fusion/handlers/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/singlestoredb/fusion/handlers/models.py b/singlestoredb/fusion/handlers/models.py index 86271aa9..8bb618d7 100644 --- a/singlestoredb/fusion/handlers/models.py +++ b/singlestoredb/fusion/handlers/models.py @@ -427,10 +427,12 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: operation_result = inference_api.drop() res = FusionSQLResult() + res.add_field('Model Name', result.STRING) res.add_field('Status', result.STRING) res.add_field('Message', result.STRING) res.set_rows([ ( + operation_result.name, operation_result.status, operation_result.get_message(), ),