diff --git a/docs/README.md b/docs/README.md index b98bdbc..9544633 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ --- -description: Giza CLI 0.12.3 +description: Giza CLI 0.14.0 --- # Giza CLI @@ -18,7 +18,7 @@ For now it provides the following capabilities: * Model transpilation with `transpile` using multiple frameworks, like Cairo or EZKL * Model versioning * Proof generation for multiple frameworks, like Orion Cairo or EZKL -* Deployment of models to the Giza Platform for verifiable inferences +* Deployment of models to the Giza Platform as an endpoint for verifiable inferences * Workspace management to help you with Giza Actions * Actions jumpstart with `new` command to help you get started with your actions diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 762630d..edcd395 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -14,7 +14,7 @@ * [Models](resources/models.md) * [Versions](resources/versions.md) * [Workspaces](resources/workspaces.md) -* [Deployments](resources/deployments.md) +* [Endpoints](resources/endpoints.md) ## π Frameworks diff --git a/docs/examples/full_transpilation.md b/docs/examples/full_transpilation.md index 283bc66..2683d18 100644 --- a/docs/examples/full_transpilation.md +++ b/docs/examples/full_transpilation.md @@ -21,7 +21,7 @@ pip install -r requirements.txt Or: ```bash -pip install giza-cli==0.12.3 onnx==1.14.1 torch==2.1.0 torchvision==0.16.0 +pip install giza-cli==0.14.0 onnx==1.14.1 torch==2.1.0 torchvision==0.16.0 ``` We will use the libraries for the following purposes: diff --git a/docs/frameworks/cairo/deploy.md b/docs/frameworks/cairo/deploy.md index dac173a..624c58f 100644 --- a/docs/frameworks/cairo/deploy.md +++ b/docs/frameworks/cairo/deploy.md @@ -2,24 +2,24 @@ To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](../../resources/versions.md) documentation. -To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint, providing a straightforward method for deploying and using machine learning capabilities +To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint, providing a straightforward method for deploying and using machine learning capabilities that can easily be consumed as and API endpoint. ``` -> giza deployments deploy --model-id 1 --version-id 1 model.sierra -β°β°β°β°β°β±β± Creating deployment! -[giza][2024-02-07 12:31:02.498] Deployment is successful β -[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 β -[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π +> giza endpoints deploy --model-id 1 --version-id 1 model.sierra +β°β°β°β°β°β±β± Creating endpoint! +[giza][2024-02-07 12:31:02.498] Endpoint is successful β +[giza][2024-02-07 12:31:02.501] Endpoint created with id -> 1 β +[giza][2024-02-07 12:31:02.502] Endpoint created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π ``` If a model is fully compatible the sierra file is not needed and can be deployed without using it in the command: ``` -> giza deployments deploy --model-id 1 --version-id 1 -β°β°β°β°β°β±β± Creating deployment! -[giza][2024-02-07 12:31:02.498] Deployment is successful β -[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 β -[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π +> giza endpoints deploy --model-id 1 --version-id 1 +β°β°β°β°β°β±β± Creating endpoint! +[giza][2024-02-07 12:31:02.498] Endpoint is successful β +[giza][2024-02-07 12:31:02.501] Endpoint created with id -> 1 β +[giza][2024-02-07 12:31:02.502] Endpoint created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π ``` {% hint style="danger" %} @@ -55,12 +55,72 @@ There is an extra args, `job_size`, that can be used in each request to specify Available sizes are `S`, `M`, `L,` and `XL`, each with different usage limits. +## List the proving jobs for an endpoint + +To list the proving jobs for an endpoint, we can use the `list-jobs` command available for the endpoints. This command will return a list of all the proving jobs for the endpoint with the `request_id` for easier tracking. + +```console +> giza endpoints list-jobs --endpoint-id 1 +[giza][2024-03-06 18:13:50.485] Getting jobs from endpoint 1 β +[ + { + "id": 1, + "job_name": "proof-20240306-979342e7", + "size": "S", + "status": "Completed", + "elapsed_time": 120., + "created_date": "2024-03-06T16:12:31.295958", + "last_update": "2024-03-06T16:14:29.952678", + "request_id": "979342e7b94641f0a260c1997d9ccfee" + }, + { + "id": 2, + "job_name": "proof-20240306-f6559749", + "size": "S", + "status": "COMPLETED", + "elapsed_time": 120.0, + "created_date": "2024-03-06T16:43:27.531250", + "last_update": "2024-03-06T16:45:17.272684", + "request_id": "f655974900d8479c9bb662a060bc1365" + } +] +``` + +## List the proofs for an endpoint + +To list the proofs for an endpoint, we can use the `list-proofs` command available for the endpoints. This command will return a list of all the proofs for the endpoint with the `request_id` for easier tracking. + +```console +> giza endpoints list-proofs --endpoint-id 1 +[giza][2024-03-06 18:15:23.146] Getting proofs from endpoint 32 β +[ + { + "id": 1, + "job_id": 1, + "metrics": { + "proving_time": 0.03023695945739746 + }, + "created_date": "2024-03-06T16:44:46.196186", + "request_id": "979342e7b94641f0a260c1997d9ccfee" + }, + { + "id": 1, + "job_id": 2, + "metrics": { + "proving_time": 0.07637895945739746 + }, + "created_date": "2024-03-06T16:44:46.196186", + "request_id": "f655974900d8479c9bb662a060bc1365" + } +] +``` + ## Download the proof -We can download the proof using the `download-proof` command available for the deployments: +We can download the proof using the `download-proof` command available for the endpoints: -
β― giza deployments download-proof --model-id 1 --version-id 1 --deployment-id 1 --proof-id "b14bfbcf250b404192765d9be0811c9b"
-[giza][2024-02-20 15:40:48.560] Getting proof from deployment 1 β
+β― giza endpoints download-proof --model-id 1 --version-id 1 --endpoint-id 1 --proof-id "b14bfbcf250b404192765d9be0811c9b"
+[giza][2024-02-20 15:40:48.560] Getting proof from endpoint 1 β
[giza][2024-02-20 15:40:49.288] Proof downloaded to zk.proof β
diff --git a/docs/frameworks/cairo/prove.md b/docs/frameworks/cairo/prove.md
index 28fbad1..dc56a8e 100644
--- a/docs/frameworks/cairo/prove.md
+++ b/docs/frameworks/cairo/prove.md
@@ -6,7 +6,7 @@ Giza provides two methods for proving Orion Cairo programs: through the CLI or d
**Deploying Your Model**
-After deploying your model on the Giza Platform, you will receive a URL for your deployed model. Refer to the [Deployments section](../../resources/deployments.md) for more details on deploying models.
+After deploying your model on the Giza Platform, you will receive a URL for your deployed model. Refer to the [Endpoints section](../../resources/endpoints.md) for more details on deploying models.
**Running Inference**
@@ -23,7 +23,7 @@ This action will execute the inference, generate Trace and Memory files on the p
To check the status of your proof, use the following command:
```
-giza deployments get-proof --model-id --version-id --deployment-id --proof-id
+giza endpoints get-proof --model-id --version-id --endpoint-id --proof-id
```
**Downloading Your Proof**
@@ -31,7 +31,7 @@ giza deployments get-proof --model-id --version-id --dep
Once the proof is ready, you can download it using:
```
-giza deployments download-proof --model-id --version-id --deployment-id --proof-id --output-path
+giza endpoints download-proof --model-id --version-id --endpoint-id --proof-id --output-path
```
{% hint style="info" %}
diff --git a/docs/frameworks/cairo/transpile.md b/docs/frameworks/cairo/transpile.md
index 9b5273b..7d0ec96 100644
--- a/docs/frameworks/cairo/transpile.md
+++ b/docs/frameworks/cairo/transpile.md
@@ -38,7 +38,7 @@ my_awesome_model
When we transpile a model we have two possibilities: a fully compatible model and a partially compatible one.
-A model is fully compatible when all the operators that the model uses are supported by the Transpiler and Orion, if this happens the model is compiled after transpilation and we save the .sierra file on behalf of the user to use later for deployment ([deployment docs](../../resources/deployments.md)). This will be shown in the output of the transpile command:
+A model is fully compatible when all the operators that the model uses are supported by the Transpiler and Orion, if this happens the model is compiled after transpilation and we save the .sierra file on behalf of the user to use later for deployment ([endpoint docs](../../resources/endpoints.md)). This will be shown in the output of the transpile command:
{% code overflow="wrap" %}
```
@@ -46,7 +46,7 @@ A model is fully compatible when all the operators that the model uses are suppo
```
{% endcode %}
-If a model is partially supported, we will create a warning in the output stating that not all the operators are supported right now. If it is partially supported the Cairo code can still be modified for later compilation and deployment.
+If a model is partially supported, we will create a warning in the output stating that not all the operators are supported right now. If it is partially supported the Cairo code can still be modified for later compilation and endpoint.
{% code overflow="wrap" %}
```
diff --git a/docs/frameworks/ezkl/deploy.md b/docs/frameworks/ezkl/deploy.md
index 32e62d7..168b3a5 100644
--- a/docs/frameworks/ezkl/deploy.md
+++ b/docs/frameworks/ezkl/deploy.md
@@ -2,15 +2,15 @@
To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](../../resources/versions.md) documentation.
-To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/predict` endpoint, providing a straightforward method for deploying and using machine learning capabilities. As we are using `EZKL` we need to add `--framework EZKL` (or `-f EZKL` for short) to the command:
+To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/predict` endpoint, providing a straightforward method for deploying and using machine learning capabilities as an API endpoint. As we are using `EZKL` we need to add `--framework EZKL` (or `-f EZKL` for short) to the command:
{% code overflow="wrap" %}
```shell
-> giza deployments deploy --model-id 1 --version-id 1 --framework EZKL
-β°β°β°β°β°β±β± Creating deployment!
-[giza][2024-02-07 12:31:02.498] Deployment is successful β
-[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 β
-[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
+> giza endpoints deploy --model-id 1 --version-id 1 --framework EZKL
+β°β°β°β°β°β±β± Creating endpoint!
+[giza][2024-02-07 12:31:02.498] Endpoint is successful β
+[giza][2024-02-07 12:31:02.501] Endpoint created with id -> 1 β
+[giza][2024-02-07 12:31:02.502] Endpoint created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
```
{% endcode %}
@@ -73,12 +73,72 @@ curl https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/predict \
Available sizes are `S`, `M`, `L,` and `XL`, each with different usage limits.
+## List the proving jobs for an endpoint
+
+To list the proving jobs for an endpoint, we can use the `list-jobs` command available for the endpoints. This command will return a list of all the proving jobs for the endpoint with the `request_id` for easier tracking.
+
+```console
+giza endpoints list-jobs --endpoint-id 1
+[giza][2024-03-06 18:13:50.485] Getting jobs from endpoint 1 β
+[
+ {
+ "id": 1,
+ "job_name": "proof-ezkl-20240306-979342e7",
+ "size": "S",
+ "status": "Completed",
+ "elapsed_time": 120.,
+ "created_date": "2024-03-06T16:12:31.295958",
+ "last_update": "2024-03-06T16:14:29.952678",
+ "request_id": "979342e7b94641f0a260c1997d9ccfee"
+ },
+ {
+ "id": 2,
+ "job_name": "proof-ezkl-20240306-f6559749",
+ "size": "S",
+ "status": "COMPLETED",
+ "elapsed_time": 120.0,
+ "created_date": "2024-03-06T16:43:27.531250",
+ "last_update": "2024-03-06T16:45:17.272684",
+ "request_id": "f655974900d8479c9bb662a060bc1365"
+ }
+]
+```
+
+## List the proofs for an endpoint
+
+To list the proofs for an endpoint, we can use the `list-proofs` command available for the endpoints. This command will return a list of all the proofs for the endpoint with the `request_id` for easier tracking.
+
+```console
+giza endpoints list-proofs --endpoint-id 1
+[giza][2024-03-06 18:15:23.146] Getting proofs from endpoint 1 β
+[
+ {
+ "id": 1,
+ "job_id": 1,
+ "metrics": {
+ "proving_time": 0.03023695945739746
+ },
+ "created_date": "2024-03-06T16:44:46.196186",
+ "request_id": "979342e7b94641f0a260c1997d9ccfee"
+ },
+ {
+ "id": 1,
+ "job_id": 2,
+ "metrics": {
+ "proving_time": 0.07637895945739746
+ },
+ "created_date": "2024-03-06T16:44:46.196186",
+ "request_id": "f655974900d8479c9bb662a060bc1365"
+ }
+]
+```
+
## Download the proof
-We can download the proof using the `download-proof` command available for the deployments:
+We can download the proof using the `download-proof` command available for the endpoints:
-β― giza deployments download-proof --model-id 1 --version-id 1 --deployment-id 1 --proof-id "d0564505755944b8bef9292d980f3e27"
-[giza][2024-02-20 15:40:48.560] Getting proof from deployment 1 β
+β― giza endpoints download-proof --proof-id "d0564505755944b8bef9292d980f3e27"
+[giza][2024-02-20 15:40:48.560] Getting proof from endpoint 1 β
[giza][2024-02-20 15:40:49.288] Proof downloaded to zk.proof β
diff --git a/docs/reference/api/README.md b/docs/reference/api/README.md
index 93d7ae3..73def96 100644
--- a/docs/reference/api/README.md
+++ b/docs/reference/api/README.md
@@ -1,91 +1,109 @@
+
+
# API Overview
## Modules
-* [`callbacks`](callbacks.md#module-callbacks)
-* [`cli`](cli.md#module-cli)
-* [`client`](client.md#module-client)
-* [`commands`](commands.md#module-commands)
-* [`commands.actions`](commands.actions.md#module-commandsactions)
-* [`commands.deployments`](commands.deployments.md#module-commandsdeployments)
-* [`commands.models`](commands.models.md#module-commandsmodels)
-* [`commands.prove`](commands.prove.md#module-commandsprove)
-* [`commands.reset_password`](commands.reset\_password.md#module-commandsreset\_password)
-* [`commands.users`](commands.users.md#module-commandsusers)
-* [`commands.verify`](commands.verify.md#module-commandsverify)
-* [`commands.version`](commands.version.md#module-commandsversion)
-* [`commands.versions`](commands.versions.md#module-commandsversions)
-* [`commands.workspaces`](commands.workspaces.md#module-commandsworkspaces)
-* [`exceptions`](exceptions.md#module-exceptions)
-* [`frameworks`](frameworks.md#module-frameworks)
-* [`frameworks.cairo`](frameworks.cairo.md#module-frameworkscairo)
-* [`frameworks.ezkl`](frameworks.ezkl.md#module-frameworksezkl)
-* [`options`](options.md#module-options)
-* [`utils`](utils.md#module-utils)
-* [`utils.decorators`](utils.decorators.md#module-utilsdecorators)
-* [`utils.echo`](utils.echo.md#module-utilsecho)
-* [`utils.enums`](utils.enums.md#module-utilsenums)
-* [`utils.misc`](utils.misc.md#module-utilsmisc)
+- [`callbacks`](./callbacks.md#module-callbacks)
+- [`cli`](./cli.md#module-cli)
+- [`client`](./client.md#module-client)
+- [`commands`](./commands.md#module-commands)
+- [`commands.actions`](./commands.actions.md#module-commandsactions)
+- [`commands.endpoints`](./commands.endpoints.md#module-commandsendpoints)
+- [`commands.models`](./commands.models.md#module-commandsmodels)
+- [`commands.prove`](./commands.prove.md#module-commandsprove)
+- [`commands.reset_password`](./commands.reset_password.md#module-commandsreset_password)
+- [`commands.users`](./commands.users.md#module-commandsusers)
+- [`commands.verify`](./commands.verify.md#module-commandsverify)
+- [`commands.version`](./commands.version.md#module-commandsversion)
+- [`commands.versions`](./commands.versions.md#module-commandsversions)
+- [`commands.workspaces`](./commands.workspaces.md#module-commandsworkspaces)
+- [`exceptions`](./exceptions.md#module-exceptions)
+- [`frameworks`](./frameworks.md#module-frameworks)
+- [`frameworks.cairo`](./frameworks.cairo.md#module-frameworkscairo)
+- [`frameworks.ezkl`](./frameworks.ezkl.md#module-frameworksezkl)
+- [`options`](./options.md#module-options)
+- [`utils`](./utils.md#module-utils)
+- [`utils.decorators`](./utils.decorators.md#module-utilsdecorators)
+- [`utils.echo`](./utils.echo.md#module-utilsecho)
+- [`utils.enums`](./utils.enums.md#module-utilsenums)
+- [`utils.exception_handling`](./utils.exception_handling.md#module-utilsexception_handling)
+- [`utils.misc`](./utils.misc.md#module-utilsmisc)
## Classes
-* [`client.ApiClient`](client.md#class-apiclient): Implementation of the API client to interact with core-services
-* [`client.DeploymentsClient`](client.md#class-deploymentsclient): Client to interact with `deployments` endpoint.
-* [`client.JobsClient`](client.md#class-jobsclient): Client to interact with `jobs` endpoint.
-* [`client.ModelsClient`](client.md#class-modelsclient): Client to interact with `models` endpoint.
-* [`client.ProofsClient`](client.md#class-proofsclient): Client to interact with `proofs` endpoint.
-* [`client.TranspileClient`](client.md#class-transpileclient): Client to interact with `users` endpoint.
-* [`client.UsersClient`](client.md#class-usersclient): Client to interact with `users` endpoint.
-* [`client.VersionJobsClient`](client.md#class-versionjobsclient): Client to interact with `jobs` endpoint.
-* [`client.VersionsClient`](client.md#class-versionsclient): Client to interact with `versions` endpoint.
-* [`client.WorkspaceClient`](client.md#class-workspaceclient): Client to interact with `workspaces` endpoint.
-* [`exceptions.PasswordError`](exceptions.md#class-passworderror)
-* [`echo.Echo`](utils.echo.md#class-echo): Helper class to use when printing output of the CLI.
-* [`enums.Framework`](utils.enums.md#class-framework)
-* [`enums.JobKind`](utils.enums.md#class-jobkind)
-* [`enums.JobSize`](utils.enums.md#class-jobsize)
-* [`enums.JobStatus`](utils.enums.md#class-jobstatus)
-* [`enums.ServiceSize`](utils.enums.md#class-servicesize)
-* [`enums.VersionStatus`](utils.enums.md#class-versionstatus)
+- [`client.ApiClient`](./client.md#class-apiclient): Implementation of the API client to interact with core-services
+- [`client.EndpointsClient`](./client.md#class-endpointsclient): Client to interact with `endpoints` endpoint.
+- [`client.EndpointsClient`](./client.md#class-endpointsclient): Client to interact with `endpoints` endpoint.
+- [`client.JobsClient`](./client.md#class-jobsclient): Client to interact with `jobs` endpoint.
+- [`client.ModelsClient`](./client.md#class-modelsclient): Client to interact with `models` endpoint.
+- [`client.ProofsClient`](./client.md#class-proofsclient): Client to interact with `proofs` endpoint.
+- [`client.TranspileClient`](./client.md#class-transpileclient): Client to interact with `users` endpoint.
+- [`client.UsersClient`](./client.md#class-usersclient): Client to interact with `users` endpoint.
+- [`client.VersionJobsClient`](./client.md#class-versionjobsclient): Client to interact with `jobs` endpoint.
+- [`client.VersionsClient`](./client.md#class-versionsclient): Client to interact with `versions` endpoint.
+- [`client.WorkspaceClient`](./client.md#class-workspaceclient): Client to interact with `workspaces` endpoint.
+- [`exceptions.PasswordError`](./exceptions.md#class-passworderror)
+- [`exceptions.ScarbBuildError`](./exceptions.md#class-scarbbuilderror)
+- [`exceptions.ScarbNotFound`](./exceptions.md#class-scarbnotfound)
+- [`echo.Echo`](./utils.echo.md#class-echo): Helper class to use when printin output of the CLI.
+- [`enums.Framework`](./utils.enums.md#class-framework)
+- [`enums.JobKind`](./utils.enums.md#class-jobkind)
+- [`enums.JobSize`](./utils.enums.md#class-jobsize)
+- [`enums.JobStatus`](./utils.enums.md#class-jobstatus)
+- [`enums.ServiceSize`](./utils.enums.md#class-servicesize)
+- [`enums.VersionStatus`](./utils.enums.md#class-versionstatus)
+- [`exception_handling.ExceptionHandler`](./utils.exception_handling.md#class-exceptionhandler): Context manager to handle exceptions in the CLI.
## Functions
-* [`callbacks.debug_callback`](callbacks.md#function-debug\_callback): If a call adds the `--debug` flag debugging mode is activated for external requests and API Clients.
-* [`callbacks.version_callback`](callbacks.md#function-version\_callback): Prints the current version when `--version` flag is added to a call.
-* [`cli.entrypoint`](cli.md#function-entrypoint)
-* [`actions.new`](commands.actions.md#function-new): This command will create a new action by generating a Python project.
-* [`deployments.deploy`](commands.deployments.md#function-deploy)
-* [`deployments.get`](commands.deployments.md#function-get)
-* [`deployments.list`](commands.deployments.md#function-list)
-* [`models.create`](commands.models.md#function-create): Command to create a model. Asks for the new model's information and validates the input,
-* [`models.get`](commands.models.md#function-get): Command to create a user. Asks for the new users information and validates the input,
-* [`models.list`](commands.models.md#function-list): Command to list all models.
-* [`prove.prove`](commands.prove.md#function-prove)
-* [`reset_password.handle_http_error`](commands.reset\_password.md#function-handle\_http\_error): Handle an HTTP error.
-* [`reset_password.prompt_for_input`](commands.reset\_password.md#function-prompt\_for\_input): Prompt the user for input.
-* [`reset_password.request_reset_password_token`](commands.reset\_password.md#function-request\_reset\_password\_token): Request a password reset token for a given email.
-* [`reset_password.reset_password`](commands.reset\_password.md#function-reset\_password): Reset the password for a user using a reset token.
-* [`users.create`](commands.users.md#function-create): Command to create a user. Asks for the new users information and validates the input,
-* [`users.create_api_key`](commands.users.md#function-create\_api\_key): Create an API key for your user. You need to be logged in to create an API key.
-* [`users.login`](commands.users.md#function-login): Logs the current user into Giza. Under the hood this will retrieve the token for the next requests.
-* [`users.me`](commands.users.md#function-me): Retrieve information about the current user and print it as json to stdout.
-* [`users.resend_email`](commands.users.md#function-resend\_email): Command to resend verification email. Asks for the user's email and sends the request to the API
-* [`verify.verify`](commands.verify.md#function-verify)
-* [`version.check_version`](commands.version.md#function-check\_version): Check if there is a new version available of the cli in pypi to suggest upgrade
-* [`versions.download`](commands.versions.md#function-download): Retrieve information about the current user and print it as json to stdout.
-* [`versions.download_original`](commands.versions.md#function-download\_original): Retrieve information about the current user and print it as json to stdout.
-* [`versions.get`](commands.versions.md#function-get)
-* [`versions.list`](commands.versions.md#function-list)
-* [`versions.transpile`](commands.versions.md#function-transpile)
-* [`versions.update`](commands.versions.md#function-update)
-* [`workspaces.create`](commands.workspaces.md#function-create): Command to create a Giza Workspace.
-* [`workspaces.delete`](commands.workspaces.md#function-delete)
-* [`workspaces.get`](commands.workspaces.md#function-get)
-* [`cairo.deploy`](frameworks.cairo.md#function-deploy): Command to deploy a specific version of a model. This will create a deployment for the specified version and check the status, once it finishes if COMPLETED the deployment is ready to be used.
-* [`cairo.prove`](frameworks.cairo.md#function-prove): Command to prove as spceific cairo program, previously converted to CASM.
-* [`cairo.transpile`](frameworks.cairo.md#function-transpile): This function is responsible for transpiling a model. The overall objective is to prepare a model for use by converting it into a different format (transpiling).
-* [`ezkl.prove`](frameworks.ezkl.md#function-prove)
-* [`ezkl.setup`](frameworks.ezkl.md#function-setup): This function executes the setup of the model and creates the outputs, handled by Giza.
-* [`ezkl.verify`](frameworks.ezkl.md#function-verify): Create a verification job.
-* [`utils.get_response_info`](utils.md#function-get\_response\_info): Utility to retrieve information of the client response.
-* [`decorators.auth`](utils.decorators.md#function-auth): Check that we have the token and it is not expired before executing
+- [`callbacks.debug_callback`](./callbacks.md#function-debug_callback): If a call adds the `--debug` flag debugging mode is activated for external requests and API Clients.
+- [`callbacks.version_callback`](./callbacks.md#function-version_callback): Prints the current version when `--version` flag is added to a call.
+- [`cli.entrypoint`](./cli.md#function-entrypoint)
+- [`actions.new`](./commands.actions.md#function-new): This command will create a new action by generating a Python project.
+- [`endpoints.delete_endpoint`](./commands.endpoints.md#function-delete_endpoint)
+- [`endpoints.deploy`](./commands.endpoints.md#function-deploy)
+- [`endpoints.download_proof`](./commands.endpoints.md#function-download_proof)
+- [`endpoints.get`](./commands.endpoints.md#function-get)
+- [`endpoints.get_proof`](./commands.endpoints.md#function-get_proof)
+- [`endpoints.list`](./commands.endpoints.md#function-list)
+- [`endpoints.list_jobs`](./commands.endpoints.md#function-list_jobs)
+- [`endpoints.list_proofs`](./commands.endpoints.md#function-list_proofs)
+- [`models.create`](./commands.models.md#function-create): Command to create a model. Asks for the new model's information and validates the input,
+- [`models.get`](./commands.models.md#function-get): Command to create a user. Asks for the new users information and validates the input,
+- [`models.list`](./commands.models.md#function-list): Command to list all models.
+- [`prove.prove`](./commands.prove.md#function-prove)
+- [`reset_password.handle_http_error`](./commands.reset_password.md#function-handle_http_error): Handle an HTTP error.
+- [`reset_password.prompt_for_input`](./commands.reset_password.md#function-prompt_for_input): Prompt the user for input.
+- [`reset_password.request_reset_password_token`](./commands.reset_password.md#function-request_reset_password_token): Request a password reset token for a given email.
+- [`reset_password.reset_password`](./commands.reset_password.md#function-reset_password): Reset the password for a user using a reset token.
+- [`users.create`](./commands.users.md#function-create): Command to create a user. Asks for the new users information and validates the input,
+- [`users.create_api_key`](./commands.users.md#function-create_api_key): Create an API key for your user. You need to be logged in to create an API key.
+- [`users.login`](./commands.users.md#function-login): Logs the current user into Giza. Under the hood this will retrieve the token for the next requests.
+- [`users.me`](./commands.users.md#function-me): Retrieve information about the current user and print it as json to stdout.
+- [`users.resend_email`](./commands.users.md#function-resend_email): Command to resend verification email. Asks for the user's email and sends the request to the API
+- [`verify.verify`](./commands.verify.md#function-verify)
+- [`version.check_version`](./commands.version.md#function-check_version): Check if there is a new version available of the cli in pypi to suggest upgrade
+- [`versions.download`](./commands.versions.md#function-download): Retrieve information about the current user and print it as json to stdout.
+- [`versions.download_original`](./commands.versions.md#function-download_original): Retrieve information about the current user and print it as json to stdout.
+- [`versions.get`](./commands.versions.md#function-get)
+- [`versions.list`](./commands.versions.md#function-list)
+- [`versions.transpile`](./commands.versions.md#function-transpile)
+- [`versions.update`](./commands.versions.md#function-update)
+- [`versions.update_sierra`](./commands.versions.md#function-update_sierra)
+- [`workspaces.create`](./commands.workspaces.md#function-create): Command to create a Giza Workspace.
+- [`workspaces.delete`](./commands.workspaces.md#function-delete)
+- [`workspaces.get`](./commands.workspaces.md#function-get)
+- [`cairo.deploy`](./frameworks.cairo.md#function-deploy): Command to deploy a specific version of a model. This will create an endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
+- [`cairo.prove`](./frameworks.cairo.md#function-prove): Command to prove as spceific cairo program, previously converted to CASM.
+- [`cairo.transpile`](./frameworks.cairo.md#function-transpile): This function is responsible for transpiling a model. The overall objective is to prepare a model for use by converting it into a different format (transpiling).
+- [`cairo.verify`](./frameworks.cairo.md#function-verify): Create a verification job.
+- [`ezkl.deploy`](./frameworks.ezkl.md#function-deploy): Command to deploy a specific version of a model. This will create a endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
+- [`ezkl.prove`](./frameworks.ezkl.md#function-prove)
+- [`ezkl.setup`](./frameworks.ezkl.md#function-setup): This function executes the setup of the model and creates the outputs, handled by Giza.
+- [`ezkl.verify`](./frameworks.ezkl.md#function-verify): Create a verification job.
+- [`utils.get_response_info`](./utils.md#function-get_response_info): Utility to retrieve information of the client response.
+- [`decorators.auth`](./utils.decorators.md#function-auth): Check that we have the token and it is not expired before executing
+- [`misc.download_model_or_sierra`](./utils.misc.md#function-download_model_or_sierra): Download the model or sierra file.
+- [`misc.scarb_build`](./utils.misc.md#function-scarb_build): Build the scarb model.
+- [`misc.zip_folder`](./utils.misc.md#function-zip_folder): Zip the folder to a specific location.
diff --git a/docs/reference/api/cli.md b/docs/reference/api/cli.md
index 197313b..f85e4c1 100644
--- a/docs/reference/api/cli.md
+++ b/docs/reference/api/cli.md
@@ -13,7 +13,7 @@
---
-
+
## function `entrypoint`
diff --git a/docs/reference/api/client.md b/docs/reference/api/client.md
index 8b81e58..9ffd4ab 100644
--- a/docs/reference/api/client.md
+++ b/docs/reference/api/client.md
@@ -17,12 +17,12 @@
---
-
+
## class `ApiClient`
Implementation of the API client to interact with core-services
-
+
### method `__init__`
@@ -46,7 +46,7 @@ __init__(
---
-
+
### method `retrieve_api_key`
@@ -70,7 +70,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -103,12 +103,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
## class `UsersClient`
Client to interact with `users` endpoint.
-
+
### method `__init__`
@@ -132,7 +132,7 @@ __init__(
---
-
+
### method `create`
@@ -156,7 +156,7 @@ Call the API to create a new user
---
-
+
### method `create_api_key`
@@ -174,7 +174,7 @@ Call the API to create a new API key
---
-
+
### method `me`
@@ -192,7 +192,7 @@ Retrieve information about the current user. Must have a valid token to perform
---
-
+
### method `request_reset_password_token`
@@ -216,7 +216,7 @@ Sends a request to the server to generate a password reset token. The token is s
---
-
+
### method `resend_email`
@@ -240,7 +240,7 @@ Resend the verification email to the user.
---
-
+
### method `reset_password`
@@ -265,7 +265,7 @@ Resets the user's password using the provided token and new password.
---
-
+
### method `retrieve_api_key`
@@ -289,7 +289,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -322,12 +322,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
-## class `DeploymentsClient`
-Client to interact with `deployments` endpoint.
+## class `EndpointsClient`
+Client to interact with `endpoints` endpoint.
-
+
### method `__init__`
@@ -351,7 +351,7 @@ __init__(
---
-
+
### method `create`
@@ -359,9 +359,9 @@ __init__(
create(
model_id: int,
version_id: int,
- deployment_create: DeploymentCreate,
+ endpoint_create: EndpointCreate,
f: BufferedReader
-) β Deployment
+) β Endpoint
```
Create a new deployment.
@@ -370,7 +370,7 @@ Create a new deployment.
**Args:**
- - `deployment_create`: Deployment information to create
+ - `endpoint_create`: Endpoint information to create
@@ -379,12 +379,299 @@ Create a new deployment.
---
+
+
+### method `delete`
+
+```python
+delete(endpoint_id: int) β None
+```
+
+Delete an endpoint.
+
+
+
+**Args:**
+
+ - `endpoint_id`: Endpoint identifier
+
+---
+
+
+
+### method `download_proof`
+
+```python
+download_proof(endpoint_id: int, proof_id: int) β bytes
+```
+
+Download a proof.
+
+
+
+**Args:**
+
+ - `proof_id`: Proof identifier
+
+
+
+**Returns:**
+ The proof binary file
+
+---
+
+
+
+### method `get`
+
+```python
+get(endpoint_id: int) β Endpoint
+```
+
+Get a deployment.
+
+
+
+**Args:**
+
+ - `endpoint_id`: Endpoint identifier
+
+
+
+**Returns:**
+ The deployment information
+
+---
+
+
+
+### method `get_proof`
+
+```python
+get_proof(endpoint_id: int, proof_id: int) β Proof
+```
+
+Return information about a specific proof. `proof_if` is the identifier of the proof that can be a integer or the request id.
+
+
+
+**Returns:**
+ A proof created by the user
+
+---
+
+
+
+### method `list`
+
+```python
+list(params: Optional[Dict[str, str]] = None) β EndpointsList
+```
+
+List endpoints.
+
+
+
+**Returns:**
+ A list of endpoints created by the user
+
+---
+
+### method `list_jobs`
+
+```python
+list_jobs(endpoint_id: int) β JobList
+```
+
+List proofs.
+
+
+
+**Returns:**
+ A list of proofs created by the user
+
+---
+
+
+
+### method `list_proofs`
+
+```python
+list_proofs(endpoint_id: int) β ProofList
+```
+
+List proofs.
+
+
+
+**Returns:**
+ A list of proofs created by the user
+
+---
+
+
+
+### method `retrieve_api_key`
+
+```python
+retrieve_api_key() β None
+```
+
+Retrieve the API key from the `~/.giza/.api_key.json` file.
+
+
+
+**Raises:**
+
+ - `Exception`: if the file does not exist
+
+
+
+**Returns:**
+
+ - `str`: the API key
+
+---
+
+
+
+### method `retrieve_token`
+
+```python
+retrieve_token(
+ user: Optional[str] = None,
+ password: Optional[str] = None,
+ renew: bool = False
+) β None
+```
+
+Get the JWT token.
+
+First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials.json. And finally it will try to retrieve it from the API login the user in.
+
+
+
+**Args:**
+
+ - `user`: if provided it will be used to check against current credentials and if provided with `password` used to retrieve a new token.
+ - `password`: if provided with `user` it will be used to retrieve a new token.
+ - `renew`: for renewal of the JWT token by user login.
+
+
+
+**Raises:**
+
+ - `Exception`: if token could not be retrieved in any way
+
+
+---
+
+
+
+## class `EndpointsClient`
+Client to interact with `endpoints` endpoint.
+
+
+
+### method `__init__`
+
+```python
+__init__(
+ host: str,
+ token: Optional[str] = None,
+ api_key: Optional[str] = None,
+ api_version: str = 'v1',
+ verify: bool = True,
+ debug: Optional[bool] = False
+) β None
+```
+
+
+
+
+
+
+
+
+---
+
+
+
+### method `create`
+
+```python
+create(
+ model_id: int,
+ version_id: int,
+ endpoint_create: EndpointCreate,
+ f: BufferedReader
+) β Endpoint
+```
+
+Create a new deployment.
+
+
+
+**Args:**
+
+ - `endpoint_create`: Endpoint information to create
+
+
+
+**Returns:**
+ The recently created deployment information
+
+---
+
+
+
+### method `delete`
+
+```python
+delete(endpoint_id: int) β None
+```
+
+Delete an endpoint.
+
+
+
+**Args:**
+
+ - `endpoint_id`: Endpoint identifier
+
+---
+
+
+
+### method `download_proof`
+
+```python
+download_proof(endpoint_id: int, proof_id: int) β bytes
+```
+
+Download a proof.
+
+
+
+**Args:**
+
+ - `proof_id`: Proof identifier
+
+
+
+**Returns:**
+ The proof binary file
+
+---
+
+
+
### method `get`
```python
-get(model_id: int, version_id: int, deployment_id: int) β Deployment
+get(endpoint_id: int) β Endpoint
```
Get a deployment.
@@ -393,7 +680,7 @@ Get a deployment.
**Args:**
- - `deployment_id`: Deployment identifier
+ - `endpoint_id`: Endpoint identifier
@@ -402,24 +689,75 @@ Get a deployment.
---
-
+
+
+### method `get_proof`
+
+```python
+get_proof(endpoint_id: int, proof_id: int) β Proof
+```
+
+Return information about a specific proof. `proof_if` is the identifier of the proof that can be a integer or the request id.
+
+
+
+**Returns:**
+ A proof created by the user
+
+---
+
+
### method `list`
```python
-list(model_id: int, version_id: int) β List[Deployment]
+list(params: Optional[Dict[str, str]] = None) β EndpointsList
```
-List deployments.
+List endpoints.
**Returns:**
- A list of deployments created by the user
+ A list of endpoints created by the user
---
-
+
+
+### method `list_jobs`
+
+```python
+list_jobs(endpoint_id: int) β JobList
+```
+
+List proofs.
+
+
+
+**Returns:**
+ A list of proofs created by the user
+
+---
+
+
+
+### method `list_proofs`
+
+```python
+list_proofs(endpoint_id: int) β ProofList
+```
+
+List proofs.
+
+
+
+**Returns:**
+ A list of proofs created by the user
+
+---
+
+
### method `retrieve_api_key`
@@ -443,7 +781,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -476,12 +814,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
## class `TranspileClient`
Client to interact with `users` endpoint.
-
+
### method `__init__`
@@ -505,7 +843,7 @@ __init__(
---
-
+
### method `retrieve_api_key`
@@ -529,7 +867,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -561,7 +899,7 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
### method `transpile`
@@ -573,6 +911,34 @@ Make a call to the API transpile endpoint with the model as a file.
+**Args:**
+
+ - `f` (BinaryIO): model to send for transpilation
+
+
+
+**Returns:**
+
+ - `Response`: raw response from the server with the transpiled model as a zip
+
+---
+
+
+
+### method `update_transpilation`
+
+```python
+update_transpilation(
+ model_id: int,
+ version_id: int,
+ f:
+) β None
+```
+
+Make a call to the API transpile endpoint with the model as a file.
+
+
+
**Args:**
- `f` (BinaryIO): model to send for transpilation
@@ -586,12 +952,12 @@ Make a call to the API transpile endpoint with the model as a file.
---
-
+
## class `ModelsClient`
Client to interact with `models` endpoint.
-
+
### method `__init__`
@@ -615,7 +981,7 @@ __init__(
---
-
+
### method `create`
@@ -645,7 +1011,7 @@ Create a new model.
---
-
+
### method `get`
@@ -659,7 +1025,7 @@ Make a call to the API to retrieve model information.
**Args:**
- - `model_id`: Model identifier to retrieve information
+ - `model_id`: Model identfier to retrieve information
@@ -669,7 +1035,7 @@ Make a call to the API to retrieve model information.
---
-
+
### method `get_by_name`
@@ -693,7 +1059,7 @@ Make a call to the API to retrieve model information by its name.
---
-
+
### method `list`
@@ -710,7 +1076,7 @@ List all the models related to the user.
---
-
+
### method `retrieve_api_key`
@@ -734,7 +1100,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -766,7 +1132,7 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
### method `update`
@@ -780,7 +1146,7 @@ Update a model.
**Args:**
- - `model_id`: Model identifier to retrieve information
+ - `model_id`: Model identfier to retrieve information
- `model_update`: body to partially update the model
@@ -792,12 +1158,12 @@ Update a model.
---
-
+
## class `JobsClient`
Client to interact with `jobs` endpoint.
-
+
### method `__init__`
@@ -821,12 +1187,16 @@ __init__(
---
-
+
### method `create`
```python
-create(job_create: JobCreate, f: BufferedReader) β Job
+create(
+ job_create: JobCreate,
+ trace: BufferedReader,
+ memory: Optional[BufferedReader] = None
+) β Job
```
Create a new job.
@@ -852,7 +1222,7 @@ Create a new job.
---
-
+
### method `get`
@@ -866,7 +1236,7 @@ Make a call to the API to retrieve job information.
**Args:**
- - `job_id`: Job identifier to retrieve information
+ - `job_id`: Job identfier to retrieve information
@@ -876,7 +1246,7 @@ Make a call to the API to retrieve job information.
---
-
+
### method `list`
@@ -893,7 +1263,7 @@ List jobs.
---
-
+
### method `retrieve_api_key`
@@ -917,7 +1287,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -950,12 +1320,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
## class `VersionJobsClient`
Client to interact with `jobs` endpoint.
-
+
### method `__init__`
@@ -979,7 +1349,7 @@ __init__(
---
-
+
### method `create`
@@ -1015,7 +1385,7 @@ Create a new job.
---
-
+
### method `get`
@@ -1029,7 +1399,7 @@ Make a call to the API to retrieve job information.
**Args:**
- - `job_id`: Job identifier to retrieve information
+ - `job_id`: Job identfier to retrieve information
@@ -1039,7 +1409,7 @@ Make a call to the API to retrieve job information.
---
-
+
### method `list`
@@ -1056,7 +1426,7 @@ List jobs.
---
-
+
### method `retrieve_api_key`
@@ -1080,7 +1450,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -1113,12 +1483,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
## class `ProofsClient`
Client to interact with `proofs` endpoint.
-
+
### method `__init__`
@@ -1142,7 +1512,7 @@ __init__(
---
-
+
### method `download`
@@ -1165,7 +1535,7 @@ Download a proof.
---
-
+
### method `get`
@@ -1179,7 +1549,7 @@ Make a call to the API to retrieve proof information.
**Args:**
- - `proof_id`: Proof identifier to retrieve information
+ - `proof_id`: Proof identfier to retrieve information
@@ -1189,7 +1559,7 @@ Make a call to the API to retrieve proof information.
---
-
+
### method `get_by_job_id`
@@ -1213,7 +1583,7 @@ Make a call to the API to retrieve proof information based on the job id.
---
-
+
### method `list`
@@ -1230,7 +1600,7 @@ List all the proofs related to the user.
---
-
+
### method `retrieve_api_key`
@@ -1254,7 +1624,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -1287,12 +1657,12 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
## class `VersionsClient`
Client to interact with `versions` endpoint.
-
+
### method `__init__`
@@ -1316,7 +1686,7 @@ __init__(
---
-
+
### method `create`
@@ -1344,12 +1714,12 @@ Create a new version.
---
-
+
### method `download`
```python
-download(model_id: int, version_id: int) β bytes
+download(model_id: int, version_id: int, params: Dict) β Dict[str, bytes]
```
Download a version.
@@ -1360,6 +1730,7 @@ Download a version.
- `model_id`: Model identifier
- `version_id`: Version identifier
+ - `params`: Additional parameters to pass to the request
@@ -1368,7 +1739,7 @@ Download a version.
---
-
+
### method `download_original`
@@ -1392,7 +1763,7 @@ Download the original version.
---
-
+
### method `get`
@@ -1416,7 +1787,7 @@ Get a version.
---
-
+
### method `list`
@@ -1439,7 +1810,7 @@ List all the versions related to a model.
---
-
+
### method `retrieve_api_key`
@@ -1463,7 +1834,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
@@ -1495,7 +1866,7 @@ First, it will try to get it from GIZA_TOKEN. Second, from ~/.giza/.credentials
---
-
+
### method `update`
@@ -1518,15 +1889,39 @@ Update a specific version.
**Returns:**
The updated version information
+---
+
+
+
+### method `upload_cairo`
+
+```python
+upload_cairo(model_id: int, version_id: int, file_path: str) β str
+```
+
+Get the Cairo model URL.
+
+
+
+**Args:**
+
+ - `model_id`: Model identifier
+ - `version_id`: Version identifier
+
+
+
+**Returns:**
+ The Cairo model URL
+
---
-
+
## class `WorkspaceClient`
Client to interact with `workspaces` endpoint.
-
+
### method `__init__`
@@ -1550,7 +1945,7 @@ __init__(
---
-
+
### method `create`
@@ -1568,7 +1963,7 @@ Call the API to create a new workspace. If the workspace already exists it will
---
-
+
### method `delete`
@@ -1585,7 +1980,7 @@ Call the API to delete the workspace. If the workspace does not exist it will re
---
-
+
### method `get`
@@ -1603,7 +1998,7 @@ Make a call to the API to retrieve workspace information. Only one should exist.
---
-
+
### method `retrieve_api_key`
@@ -1627,7 +2022,7 @@ Retrieve the API key from the `~/.giza/.api_key.json` file.
---
-
+
### method `retrieve_token`
diff --git a/docs/reference/api/commands.actions.md b/docs/reference/api/commands.actions.md
index d21639e..66f8adf 100644
--- a/docs/reference/api/commands.actions.md
+++ b/docs/reference/api/commands.actions.md
@@ -15,7 +15,7 @@
## function `new`
```python
-new(project_name: str = )
+new(project_name: str = )
```
This command will create a new action by generating a Python project.
diff --git a/docs/reference/api/commands.deployments.md b/docs/reference/api/commands.deployments.md
deleted file mode 100644
index e7b3964..0000000
--- a/docs/reference/api/commands.deployments.md
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-# module `commands.deployments`
-
-
-
-
-**Global Variables**
----------------
-- **API_HOST**
-
----
-
-
-
-## function `deploy`
-
-```python
-deploy(
- data: str = typer.Argument(None),
- model_id: int = typer.Option(
- None, help="The ID of the model where a deployment will be created"
- ),
- version_id: int = typer.Option(
- None, help="The ID of the version that will be deployed"
- ),
- size: ServiceSize = typer.Option(ServiceSize.S, "--size", "-s"),
- framework: Framework = typer.Option(Framework.CAIRO, "--framework", "-f"),
- debug: Optional[bool] = DEBUG_OPTION,
-) β None
-```
-
-
-
-
-
-
----
-
-
-
-## function `list`
-
-```python
-list(
- model_id: int = typer.Option(None, help="The ID of the model"),
- version_id: int = typer.Option(None, help="The ID of the version"),
- debug: Optional[bool] = DEBUG_OPTION,
-) β None
-```
-
-
-
-
-
-
----
-
-
-
-## function `get`
-
-```python
-get(
- model_id: int = typer.Option(None, help="The ID of the model"),
- version_id: int = typer.Option(None, help="The ID of the version"),
- deployment_id: int = typer.Option(None, help="The ID of the version"),
- debug: Optional[bool] = DEBUG_OPTION,
-) β None
-```
-
-
-
-
-
-
diff --git a/docs/reference/api/commands.endpoints.md b/docs/reference/api/commands.endpoints.md
new file mode 100644
index 0000000..b2dc23e
--- /dev/null
+++ b/docs/reference/api/commands.endpoints.md
@@ -0,0 +1,228 @@
+
+
+
+
+# module `commands.endpoints`
+
+
+
+
+**Global Variables**
+---------------
+- **API_HOST**
+
+---
+
+
+
+## function `deploy`
+
+```python
+deploy(
+ data: str = typer.Argument(None),
+ model_id: int = typer.Option(
+ None,
+ "--model-id",
+ "-m",
+ help="The ID of the model where an endpoint will be created",
+ ),
+ version_id: int = typer.Option(
+ None,
+ "--version-id",
+ "-v",
+ help="The ID of the version that will used in the endpoint",
+ ),
+ size: ServiceSize = typer.Option(ServiceSize.S, "--size", "-s"),
+ framework: Framework = typer.Option(Framework.CAIRO, "--framework", "-f"),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `list`
+
+```python
+list(
+ model_id: int = typer.Option(None, "--model-id", "-m", help="The ID of the model"),
+ version_id: int = typer.Option(
+ None, "--version-id", "-v", help="The ID of the version"
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `get`
+
+```python
+get(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `delete_endpoint`
+
+```python
+delete_endpoint(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `list_proofs`
+
+```python
+list_proofs(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `get_proof`
+
+```python
+get_proof(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ proof_id: str = typer.Option(
+ None, "--proof-id", "-p", help="The ID or request id of the proof"
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `download_proof`
+
+```python
+download_proof(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ proof_id: str = typer.Option(
+ None, "--proof-id", "-p", help="The ID or request id of the proof"
+ ),
+ output_path: str = typer.Option(
+ "zk.proof",
+ "--output-path",
+ "-o",
+ help="The path where the proof will be stored",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
+---
+
+
+
+## function `list_jobs`
+
+```python
+list_jobs(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) β None
+```
+
+
+
+
+
+
diff --git a/docs/reference/api/commands.users.md b/docs/reference/api/commands.users.md
index 5c3b8c1..73d2be1 100644
--- a/docs/reference/api/commands.users.md
+++ b/docs/reference/api/commands.users.md
@@ -87,6 +87,7 @@ Create an API key for your user. You need to be logged in to create an API key.
**Args:**
- `debug` (Optional[bool]): Whether to add debug information, will show requests, extra logs and traceback if there is an Exception. Defaults to DEBUG_OPTION (False)
+ - `renew` (bool): Force the retrieval of the token to create a new one. Defaults to False.
diff --git a/docs/reference/api/commands.versions.md b/docs/reference/api/commands.versions.md
index 7d7f420..1fe1eaf 100644
--- a/docs/reference/api/commands.versions.md
+++ b/docs/reference/api/commands.versions.md
@@ -13,7 +13,22 @@
---
-
+
+
+## function `update_sierra`
+
+```python
+update_sierra(model_id: int, version_id: int, model_path: str)
+```
+
+
+
+
+
+
+---
+
+
## function `get`
@@ -32,7 +47,7 @@ get(
---
-
+
## function `transpile`
@@ -70,7 +85,7 @@ transpile(
---
-
+
## function `update`
@@ -92,7 +107,7 @@ update(
---
-
+
## function `list`
@@ -110,7 +125,7 @@ list(
---
-
+
## function `download`
@@ -136,7 +151,7 @@ Retrieve information about the current user and print it as json to stdout.
---
-
+
## function `download_original`
diff --git a/docs/reference/api/commands.workspaces.md b/docs/reference/api/commands.workspaces.md
index 681d4fb..2789bcd 100644
--- a/docs/reference/api/commands.workspaces.md
+++ b/docs/reference/api/commands.workspaces.md
@@ -67,3 +67,9 @@ delete(
debug: Optional[bool] = DEBUG_OPTION
) β None
```
+
+
+
+
+
+
diff --git a/docs/reference/api/exceptions.md b/docs/reference/api/exceptions.md
index 0060c2d..0929fe4 100644
--- a/docs/reference/api/exceptions.md
+++ b/docs/reference/api/exceptions.md
@@ -22,3 +22,29 @@
+---
+
+
+
+## class `ScarbBuildError`
+
+
+
+
+
+
+
+
+---
+
+
+
+## class `ScarbNotFound`
+
+
+
+
+
+
+
+
diff --git a/docs/reference/api/frameworks.cairo.md b/docs/reference/api/frameworks.cairo.md
index 7ebdc37..4a570c8 100644
--- a/docs/reference/api/frameworks.cairo.md
+++ b/docs/reference/api/frameworks.cairo.md
@@ -13,13 +13,13 @@
---
-
+
## function `prove`
```python
prove(
- data: str,
+ data: list[str],
debug: Optional[bool],
size: JobSize = ,
framework: Framework = ,
@@ -27,7 +27,7 @@ prove(
) β None
```
-Command to prove as specific cairo program, previously converted to CASM. This will create a proving job and check the status, once it finishes if COMPLETED the proof is downloaded at the output path The daily jobs allowed are rate limited by the backend.
+Command to prove as spceific cairo program, previously converted to CASM. This will create a proving job and check the status, once it finishes if COMPLETED the proof is downloaded at the output path The daily jobs allowed are rate limited by the backend.
@@ -48,27 +48,27 @@ Command to prove as specific cairo program, previously converted to CASM. This w
---
-
+
## function `deploy`
```python
deploy(
- data: str,
model_id: int,
version_id: int,
+ data: Optional[str] = None,
size: ServiceSize = ,
debug: Optional[bool] = DEBUG_OPTION
) β str
```
-Command to deploy a specific version of a model. This will create a deployment for the specified version and check the status, once it finishes if COMPLETED the deployment is ready to be used.
+Command to deploy a specific version of a model. This will create an endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
**Args:**
- - `data`: main CASM file
+ - `data`: main SIERRA file
- `model_id`: model id to deploy
- `version_id`: version id to deploy
- `size`: Size of the service, allowed values are S, M, L and XL. Defaults to S.
@@ -84,7 +84,7 @@ Command to deploy a specific version of a model. This will create a deployment f
---
-
+
## function `transpile`
@@ -95,6 +95,8 @@ transpile(
desc: str,
model_desc: str,
output_path: str,
+ download_model: bool,
+ download_sierra: bool,
debug: Optional[bool]
) β None
```
@@ -112,6 +114,8 @@ This function is responsible for transpiling a model. The overall objective is t
- `desc` (int, optional): Description of the version. Defaults to None.
- `model_desc` (int, optional): Description of the Model to create if model_id is not provided. Defaults to None.
- `output_path` (str, optional): The path where the cairo model will be saved. Defaults to "cairo_model".
+ - `download_model` (bool): A flag used to determine whether to download the model or not.
+ - `download_sierra` (bool): A flag used to determine whether to download the sierra or not.
- `debug` (bool, optional): A flag used to determine whether to raise exceptions or not. Defaults to DEBUG_OPTION.
@@ -122,3 +126,23 @@ This function is responsible for transpiling a model. The overall objective is t
- `HTTPError`: If there is an HTTP error while communicating with the server.
+---
+
+
+
+## function `verify`
+
+```python
+verify(
+ proof_id: Optional[int],
+ model_id: Optional[int],
+ version_id: Optional[int],
+ proof: Optional[str] = None,
+ debug: Optional[bool] = False,
+ size: JobSize =
+)
+```
+
+Create a verification job. This command will create a verification job with the provided proof id. The job size, model id, and version id can be optionally specified.
+
+
diff --git a/docs/reference/api/frameworks.ezkl.md b/docs/reference/api/frameworks.ezkl.md
index 786f2a3..65816f3 100644
--- a/docs/reference/api/frameworks.ezkl.md
+++ b/docs/reference/api/frameworks.ezkl.md
@@ -13,7 +13,7 @@
---
-
+
## function `setup`
@@ -34,7 +34,7 @@ This function executes the setup of the model and creates the outputs, handled b
---
-
+
## function `prove`
@@ -56,7 +56,7 @@ prove(
---
-
+
## function `verify`
@@ -74,3 +74,37 @@ verify(
Create a verification job. This command will create a verification job with the provided proof id. The job size, model id, and version id can be optionally specified.
+---
+
+
+
+## function `deploy`
+
+```python
+deploy(
+ model_id: int,
+ version_id: int,
+ size: ServiceSize = ,
+ debug: Optional[bool] = DEBUG_OPTION,
+) β str
+```
+
+Command to deploy a specific version of a model. This will create a endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
+
+
+
+**Args:**
+
+ - `model_id`: model id to deploy
+ - `version_id`: version id to deploy
+ - `size`: Size of the service, allowed values are S, M, L and XL. Defaults to S.
+ - `debug` (Optional[bool], optional): Whether to add debug information, will show requests, extra logs and traceback if there is an Exception. Defaults to DEBUG_OPTION (False).
+
+
+
+**Raises:**
+
+ - `ValidationError`: input fields are validated, if these are not suitable the exception is raised
+ - `HTTPError`: request error to the API, 4XX or 5XX
+
+
diff --git a/docs/reference/api/utils.enums.md b/docs/reference/api/utils.enums.md
index d4181dd..27653ea 100644
--- a/docs/reference/api/utils.enums.md
+++ b/docs/reference/api/utils.enums.md
@@ -24,7 +24,7 @@
---
-
+
## class `JobStatus`
@@ -37,7 +37,7 @@
---
-
+
## class `ServiceSize`
@@ -50,7 +50,7 @@
---
-
+
## class `JobSize`
@@ -63,7 +63,7 @@
---
-
+
## class `Framework`
@@ -76,7 +76,7 @@
---
-
+
## class `JobKind`
diff --git a/docs/reference/api/utils.exception_handling.md b/docs/reference/api/utils.exception_handling.md
new file mode 100644
index 0000000..c19175c
--- /dev/null
+++ b/docs/reference/api/utils.exception_handling.md
@@ -0,0 +1,62 @@
+
+
+
+
+# module `utils.exception_handling`
+
+
+
+
+
+
+---
+
+
+
+## class `ExceptionHandler`
+Context manager to handle exceptions in the CLI.
+
+The main purpose of this class is to handle common exceptions in the CLI and provide a consistent way to handle them.
+
+The CLI commands should be wrapped with this context manager to handle exceptions and provide a consistent way to handle them.
+
+
+
+**Example:**
+ ```python
+with ExceptionHandler():
+ # Your command code here
+ client = Client()
+ client.get() # This will raise an exception if something goes wrong but will be handled in __exit__
+```
+
+
+
+### method `__init__`
+
+```python
+__init__(debug: Optional[bool] = False) β None
+```
+
+
+
+
+
+
+
+
+---
+
+
+
+### method `handle_exit`
+
+```python
+handle_exit()
+```
+
+
+
+
+
+
diff --git a/docs/reference/api/utils.misc.md b/docs/reference/api/utils.misc.md
index 4d3a9d7..587a341 100644
--- a/docs/reference/api/utils.misc.md
+++ b/docs/reference/api/utils.misc.md
@@ -8,4 +8,73 @@
+---
+
+
+
+## function `download_model_or_sierra`
+
+```python
+download_model_or_sierra(
+ content: bytes,
+ output_path: str,
+ name: Optional[str] = None
+)
+```
+
+Download the model or sierra file.
+
+
+
+**Args:**
+
+ - `content` (bytes): file content
+ - `output_path` (str): path to save the file
+ - `name` (str): file name. Defaults to None.
+
+
+---
+
+
+
+## function `zip_folder`
+
+```python
+zip_folder(source_folder: str, dst_folder: str) β str
+```
+
+Zip the folder to a specific location.
+
+
+
+**Args:**
+
+ - `source_folder` (str): path to the folder
+ - `dst_folder` (str): destination folder
+
+
+
+**Returns:**
+
+ - `str`: path to the zip file
+
+
+---
+
+
+
+## function `scarb_build`
+
+```python
+scarb_build(folder) β None
+```
+
+Build the scarb model.
+
+
+
+**Args:**
+
+ - `folder` (str): path to the folder
+
diff --git a/docs/resources/deployments.md b/docs/resources/deployments.md
deleted file mode 100644
index 0f4fc42..0000000
--- a/docs/resources/deployments.md
+++ /dev/null
@@ -1,99 +0,0 @@
-# Deployments
-
-Deployments in our platform provide a mechanism for creating services that accept predictions via a designated endpoint. These services, based on existing platform versions, leverage Cairo under the hood to ensure provable inferences. Using the CLI, users can effortlessly deploy and retrieve information about these machine learning services.
-
-## Deploying a model
-
-To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](versions.md) documentation.
-
-To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint, providing a straightforward method for deploying and utilizing machine learning capabilities.
-
-```console
-> giza deployments deploy --model-id 1 --version-id 1 model.sierra
-β°β°β°β°β°β±β± Creating deployment!
-[giza][2024-02-07 12:31:02.498] Deployment is successful β
-[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 β
-[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
-```
-
-If a model is fully compatible the sierra file is not needed and can be deployed without using it in the command:
-
-```
-> giza deployments deploy --model-id 1 --version-id 1
-β°β°β°β°β°β±β± Creating deployment!
-[giza][2024-02-07 12:31:02.498] Deployment is successful β
-[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 β
-[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
-```
-
-{% hint style="danger" %}
-For a partially compatible model the sierra file must be provided, if not an error will be shown.
-{% endhint %}
-
-### Example request
-
-Now our service is ready to accept predictions at the provided endpoint URL. To test this, we can use the `curl` command to send a POST request to the endpoint with a sample input.
-
-```console
-> curl -X POST https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/cairo_run \
- -H "Content-Type: application/json" \
- -d '{
- "args": "[\"2\", \"2\", \"2\", \"4\", \"1\", \"2\", \"3\", \"4\"]"
- }' | jq
-{
- "result": [
- {
- "value": {
- "val": [
- 1701737587,
- 1919382893,
- 1869750369,
- 1852252262,
- 1864395887,
- 1948284015,
- 1231974517
- ]
- }
- }
- ]
-}
-```
-
-## Listing deployments
-
-The list command is designed to retrieve information about all existing deployments. It provides an overview of the deployed machine learning services, allowing users to monitor and manage multiple deployments efficiently.
-
-```console
-giza deployments list --model-id 1 --version-id 1
-[giza][2024-01-17 17:19:00.631] Listing deployments β
-[
- {
- "id": 1,
- "status": "COMPLETED",
- "uri": "https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app",
- "size": "S",
- "service_name": "deployment-gizabrain-38-1-53427f44",
- "model_id": 1,
- "version_id": 1
- }
-]
-```
-
-Executing this command will display a list of all current deployments, including relevant details such as service names, version numbers, and deployment status.
-
-## Retrieving a deployment
-
-For retrieving detailed information about a specific deployment, users can utilize the get command. This command allows users to query and view specific details of a single deployment, providing insights into the configuration, status, and other pertinent information.
-
-```console
-> giza deployments get --model-id 1 --version-id 1 --deployment-id 1
-{
- "id": 1,
- "status": "COMPLETED",
- "uri": "https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app",
- "size": "S",
- "service_name": "deployment-gizabrain-38-1-53427f44",
- "model_id": 38,
- "version_id": 1
-}
-```
diff --git a/docs/resources/endpoints.md b/docs/resources/endpoints.md
new file mode 100644
index 0000000..c84b8a8
--- /dev/null
+++ b/docs/resources/endpoints.md
@@ -0,0 +1,129 @@
+# Endpoints
+
+Endpoints in our platform provide a mechanism for creating services that accept predictions via a designated endpoint. These services, based on existing platform versions, leverage Cairo under the hood to ensure provable inferences. Using the CLI, users can effortlessly deploy and retrieve information about these machine learning services.
+
+## Deploying a model as an endpoint
+
+To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](versions.md) documentation.
+
+To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint, providing a straightforward method for deploying and utilizing machine learning capabilities.
+
+```console
+> giza endpoints deploy --model-id 1 --version-id 1 model.sierra
+β°β°β°β°β°β±β± Creating endpoint!
+[giza][2024-02-07 12:31:02.498] Endpoint is successful β
+[giza][2024-02-07 12:31:02.501] Endpoint created with id -> 1 β
+[giza][2024-02-07 12:31:02.502] Endpoint created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
+```
+
+If a model is fully compatible the sierra file is not needed and can be deployed without using it in the command:
+
+```
+> giza endpoints deploy --model-id 1 --version-id 1
+β°β°β°β°β°β±β± Creating endpoint!
+[giza][2024-02-07 12:31:02.498] Endpoint is successful β
+[giza][2024-02-07 12:31:02.501] Endpoint created with id -> 1 β
+[giza][2024-02-07 12:31:02.502] Endpoint created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app π
+```
+
+{% hint style="danger" %}
+For a partially compatible model the sierra file must be provided, if not an error will be shown.
+{% endhint %}
+
+### Example request
+
+Now our service is ready to accept predictions at the provided endpoint URL. To test this, we can use the `curl` command to send a POST request to the endpoint with a sample input.
+
+```console
+> curl -X POST https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/cairo_run \
+ -H "Content-Type: application/json" \
+ -d '{
+ "args": "[\"2\", \"2\", \"2\", \"4\", \"1\", \"2\", \"3\", \"4\"]"
+ }' | jq
+{
+ "result": [
+ {
+ "value": {
+ "val": [
+ 1701737587,
+ 1919382893,
+ 1869750369,
+ 1852252262,
+ 1864395887,
+ 1948284015,
+ 1231974517
+ ]
+ }
+ }
+ ]
+}
+```
+
+## Listing endpoints
+
+The list command is designed to retrieve information about all existing endpoints. It provides an overview of the deployed machine learning services, allowing users to monitor and manage multiple endpoints efficiently.
+
+```console
+giza endpoints list
+[giza][2024-01-17 17:19:00.631] Listing endpoints β
+[
+ {
+ "id": 1,
+ "status": "COMPLETED",
+ "uri": "https://deployment-gizabrain-1-1-53427f44-dagsgas-ew.a.run.app",
+ "size": "S",
+ "service_name": "deployment-gizabrain-1-1-53427f44",
+ "model_id": 1,
+ "version_id": 1,
+ "is_active": true
+ },
+ {
+ "id": 2,
+ "status": "COMPLETED",
+ "uri": "https://deployment-gizabrain-1-2-53427f44-dagsgas-ew.a.run.app",
+ "size": "S",
+ "service_name": "deployment-gizabrain-1-2-53427f44",
+ "model_id": 1,
+ "version_id": 2,
+ "is_active": false
+ }
+]
+```
+
+Executing this command will display a list of all current endpoints, including relevant details such as service names, version numbers, and endpoint status.
+
+{% hint style="info" %}
+To list only active endpoints you can use the flag `--only-active/-a` so only active ones are shown.
+{% endhint %}
+
+## Retrieving an endpoint
+
+For retrieving detailed information about a specific endpoint, users can utilize the get command. This command allows users to query and view specific details of a single endpoint, providing insights into the configuration, status, and other pertinent information.
+
+```console
+> giza endpoints get --endpoint-id 1
+{
+ "id": 1,
+ "status": "COMPLETED",
+ "uri": "https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app",
+ "size": "S",
+ "service_name": "deployment-gizabrain-38-1-53427f44",
+ "model_id": 38,
+ "version_id": 1,
+ "is_active": true
+}
+```
+
+## Delete an endpoint
+
+For deleting an endpoint, users can use the delete command. This command facilitates the removal of a machine learning service, allowing users to manage and maintain their deployed services efficiently.
+
+```console
+> giza endpoints delete --endpoint-id 1
+[giza][2024-03-06 18:10:22.548] Deleting endpoint 1 β
+[giza][2024-03-06 18:10:22.830] Endpoint 1 deleted β
+```
+
+{% hint style="info" %}
+The endpoints are not fully deleted, so you can still access the underlying proofs generated by them.
+{% endhint %}
diff --git a/docs/resources/models.md b/docs/resources/models.md
index 10aed9e..0c78fb4 100644
--- a/docs/resources/models.md
+++ b/docs/resources/models.md
@@ -71,7 +71,7 @@ Now we can see that we have a model successfully transpiled! Now if we want we c
**Note:** This is explained extensively in the transpile documentation ([Orion Cairo](../frameworks/cairo/transpile.md) and [EZKL](../frameworks/ezkl/transpile.md)).
{% endhint %}
-Transpiling a model in Giza is a crucial step in the model deployment process. Transpilation is the process of converting your machine learning model into a format that can be executed on Giza. Depending the ZKML framework chosen, this process involves converting the model into a series of Cairo instructions or performing the setup using EZKL.
+Transpiling a model in Giza is a crucial step in the model deployment process as an endpoint. Transpilation is the process of converting your machine learning model into a format that can be executed on Giza. Depending the ZKML framework chosen, this process involves converting the model into a series of Cairo instructions or performing the setup using EZKL.
When you execute the 'transpile' command, it initially checks for the presence of the model on the Giza platform. If no model is found, it automatically generates one and performs the transpilation. Here is an example of the command:
diff --git a/docs/resources/versions.md b/docs/resources/versions.md
index 7f68882..14eb502 100644
--- a/docs/resources/versions.md
+++ b/docs/resources/versions.md
@@ -65,7 +65,7 @@ Here's how you can do it:
**Note:** This is explained extensively in the transpile documentation ([Orion Cairo](../frameworks/cairo/transpile.md) and [EZKL](../frameworks/ezkl/transpile.md)).
{% endhint %}
-Transpiling a model version in Giza is a crucial step in the model deployment process. Transpilation is the process of converting your machine learning model into a format that can be executed on Giza. Depending the ZKML framework chosen, this process involves converting the model into a series of Cairo instructions or performing the setup using EZKL.
+Transpiling a model version in Giza is a crucial step in the model deployment process as an endpoint. Transpilation is the process of converting your machine learning model into a format that can be executed on Giza. Depending the ZKML framework chosen, this process involves converting the model into a series of Cairo instructions or performing the setup using EZKL.
When you transpile a model, you're essentially creating a new version of that model. Each version represents a specific iteration of your machine learning model, allowing you to track and manage the evolution of your models effectively.
diff --git a/examples/mnist/mnist_pytorch.ipynb b/examples/mnist/mnist_pytorch.ipynb
index 6f96d34..c3fe15e 100644
--- a/examples/mnist/mnist_pytorch.ipynb
+++ b/examples/mnist/mnist_pytorch.ipynb
@@ -41,7 +41,7 @@
"Or:\n",
"\n",
"```bash\n",
- "pip install giza-cli==0.12.3 onnx==1.14.1 torch==2.1.0 torchvision==0.16.0\n",
+ "pip install giza-cli==0.14.0 onnx==1.14.1 torch==2.1.0 torchvision==0.16.0\n",
"```\n",
"\n",
"We will use the libraries for the following purposes:\n",
diff --git a/examples/mnist/requirements.txt b/examples/mnist/requirements.txt
index 49c81b3..f52cf0c 100644
--- a/examples/mnist/requirements.txt
+++ b/examples/mnist/requirements.txt
@@ -1,4 +1,4 @@
-giza-cli==0.12.3
+giza-cli==0.14.0
onnx==1.14.1
tf2onnx==1.15.1
torch==2.1.0
diff --git a/giza/__init__.py b/giza/__init__.py
index 80d6b6e..dcfc60e 100644
--- a/giza/__init__.py
+++ b/giza/__init__.py
@@ -1,5 +1,5 @@
import os
-__version__ = "0.12.3"
+__version__ = "0.14.0"
# Until DNS is fixed
API_HOST = os.environ.get("GIZA_API_HOST", "https://api.gizatech.xyz")
diff --git a/giza/cli.py b/giza/cli.py
index bb60f76..1960969 100644
--- a/giza/cli.py
+++ b/giza/cli.py
@@ -4,8 +4,8 @@
from rich.traceback import install
from giza.commands.actions import app as actions_app
-from giza.commands.deployments import app as deployments_app
-from giza.commands.deployments import deploy
+from giza.commands.endpoints import app as deployments_app
+from giza.commands.endpoints import deploy
from giza.commands.models import app as models_app
from giza.commands.prove import prove
from giza.commands.reset_password import request_reset_password_token, reset_password
@@ -15,6 +15,7 @@
from giza.commands.versions import app as versions_app
from giza.commands.versions import transpile
from giza.commands.workspaces import app as workspaces_app
+from giza.utils import echo
install(suppress=[click])
@@ -43,8 +44,19 @@
app.add_typer(
deployments_app,
name="deployments",
- short_help="π Utilities for managing deployments",
- help="""π Utilities for managing deployments""",
+ short_help="π Utilities for managing deployments (deprecated)",
+ help="""π Utilities for managing deployments (deprecated)""",
+ callback=lambda: echo.warning(
+ "The `deployments` command is deprecated and will be removed in the future. Use the `endpoints` command instead."
+ ),
+ deprecated=True,
+)
+
+app.add_typer(
+ deployments_app,
+ name="endpoints",
+ short_help="π Utilities for managing endpoints",
+ help="""π Utilities for managing endpoints""",
)
app.add_typer(
@@ -95,20 +107,17 @@
)(transpile)
app.command(
- short_help="π Creates a deployment for the specified model version. Shortcut for `giza deployments deploy`",
- help="""π Creates a deployment for the specified model version. Shortcut for `giza deployments deploy`.
-
- This command has different behavior depending on the framework:
+ short_help="π Creates an endpoint for the specified model version. Shortcut for `giza endpoints deploy`",
+ help="""π Creates a endpoint for the specified model version. Shortcut for `giza endpoints deploy`.
- * For Cairo, it will create an inference endpoint of the deployment in Giza.
- * For EZKL, not implemented yet.
+ This command will create an inference endpoint in Giza for the vailable frameworks.
This command performs several operations:
- * Creates a deployment for the specified version
+ * Creates an endpoint for the specified version
* Uploads the specified version file
* Polls the version until the status is either FAILED or COMPLETED
- * If the status is COMPLETED, sends back the deployment url to make inference requests
+ * If the status is COMPLETED, sends back the endpoint url to make inference requests
Error handling is also incorporated into this process.
""",
diff --git a/giza/client.py b/giza/client.py
index 3b0fd32..b93e791 100644
--- a/giza/client.py
+++ b/giza/client.py
@@ -13,8 +13,8 @@
from rich import print, print_json
from giza.schemas import users
-from giza.schemas.deployments import Deployment, DeploymentCreate, DeploymentsList
-from giza.schemas.jobs import Job, JobCreate
+from giza.schemas.endpoints import Endpoint, EndpointCreate, EndpointsList
+from giza.schemas.jobs import Job, JobCreate, JobList
from giza.schemas.message import Msg
from giza.schemas.models import Model, ModelCreate, ModelList, ModelUpdate
from giza.schemas.proofs import Proof, ProofList
@@ -435,28 +435,27 @@ def reset_password(self, token: str, new_password: str) -> Msg:
raise Exception("Could not reset the password")
-class DeploymentsClient(ApiClient):
+class EndpointsClient(ApiClient):
"""
- Client to interact with `deployments` endpoint.
+ Client to interact with `endpoints` endpoint.
"""
- DEPLOYMENTS_ENDPOINT = "deployments"
- MODELS_ENDPOINT = "models"
- VERSIONS_ENDPOINT = "versions"
+ # Change once API is updated
+ ENDPOINTS = "endpoints"
@auth
def create(
self,
model_id: int,
version_id: int,
- deployment_create: DeploymentCreate,
+ endpoint_create: EndpointCreate,
f: BufferedReader,
- ) -> Deployment:
+ ) -> Endpoint:
"""
Create a new deployment.
Args:
- deployment_create: Deployment information to create
+ endpoint_create: Endpoint information to create
Returns:
The recently created deployment information
@@ -468,30 +467,27 @@ def create(
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
+ self.ENDPOINTS,
]
),
headers=headers,
- params=deployment_create.model_dump(),
+ params=endpoint_create.model_dump(),
+ data={"model_id": model_id, "version_id": version_id},
files={"sierra": f} if f is not None else None,
)
self._echo_debug(str(response))
response.raise_for_status()
- return Deployment(**response.json())
+ return Endpoint(**response.json())
@auth
- def list(self, model_id: int, version_id: int) -> DeploymentsList:
+ def list(self, params: Optional[Dict[str, str]] = None) -> EndpointsList:
"""
- List deployments.
+ List endpoints.
Returns:
- A list of deployments created by the user
+ A list of endpoints created by the user
"""
headers = copy.deepcopy(self.default_headers)
headers.update(self._get_auth_header())
@@ -500,27 +496,22 @@ def list(self, model_id: int, version_id: int) -> DeploymentsList:
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
+ self.ENDPOINTS,
]
),
headers=headers,
+ params=params,
)
self._echo_debug(str(response))
response.raise_for_status()
- return DeploymentsList(
- root=[Deployment(**deployment) for deployment in response.json()]
+ return EndpointsList(
+ root=[Endpoint(**endpoint) for endpoint in response.json()]
)
@auth
- def list_proofs(
- self, model_id: int, version_id: int, deployment_id: int
- ) -> ProofList:
+ def list_jobs(self, endpoint_id: int) -> JobList:
"""
List proofs.
@@ -534,12 +525,36 @@ def list_proofs(
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
- str(deployment_id),
+ self.ENDPOINTS,
+ str(endpoint_id),
+ "jobs",
+ ]
+ ),
+ headers=headers,
+ )
+ self._echo_debug(str(response))
+
+ response.raise_for_status()
+
+ return JobList(root=[Job(**job) for job in response.json()])
+
+ @auth
+ def list_proofs(self, endpoint_id: int) -> ProofList:
+ """
+ List proofs.
+
+ Returns:
+ A list of proofs created by the user
+ """
+ headers = copy.deepcopy(self.default_headers)
+ headers.update(self._get_auth_header())
+
+ response = self.session.get(
+ "/".join(
+ [
+ self.url,
+ self.ENDPOINTS,
+ str(endpoint_id),
"proofs",
]
),
@@ -552,9 +567,7 @@ def list_proofs(
return ProofList(root=[Proof(**proof) for proof in response.json()])
@auth
- def get_proof(
- self, model_id: int, version_id: int, deployment_id: int, proof_id: int
- ) -> Proof:
+ def get_proof(self, endpoint_id: int, proof_id: int) -> Proof:
"""
Return information about a specific proof.
`proof_if` is the identifier of the proof that can be a integer or the request id.
@@ -569,12 +582,8 @@ def get_proof(
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
- str(deployment_id),
+ self.ENDPOINTS,
+ str(endpoint_id),
"proofs",
str(proof_id),
]
@@ -588,9 +597,7 @@ def get_proof(
return Proof(**response.json())
@auth
- def download_proof(
- self, model_id: int, version_id: int, deployment_id: int, proof_id: int
- ) -> bytes:
+ def download_proof(self, endpoint_id: int, proof_id: int) -> bytes:
"""
Download a proof.
@@ -607,12 +614,8 @@ def download_proof(
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
- str(deployment_id),
+ self.ENDPOINTS,
+ str(endpoint_id),
"proofs",
f"{proof_id}:download",
]
@@ -633,12 +636,12 @@ def download_proof(
return download_response.content
@auth
- def get(self, model_id: int, version_id: int, deployment_id: int) -> Deployment:
+ def get(self, endpoint_id: int) -> Endpoint:
"""
Get a deployment.
Args:
- deployment_id: Deployment identifier
+ endpoint_id: Endpoint identifier
Returns:
The deployment information
@@ -650,12 +653,35 @@ def get(self, model_id: int, version_id: int, deployment_id: int) -> Deployment:
"/".join(
[
self.url,
- self.MODELS_ENDPOINT,
- str(model_id),
- self.VERSIONS_ENDPOINT,
- str(version_id),
- self.DEPLOYMENTS_ENDPOINT,
- str(deployment_id),
+ self.ENDPOINTS,
+ str(endpoint_id),
+ ]
+ ),
+ headers=headers,
+ )
+
+ self._echo_debug(str(response))
+ response.raise_for_status()
+
+ return Endpoint(**response.json())
+
+ @auth
+ def delete(self, endpoint_id: int) -> None:
+ """
+ Delete an endpoint.
+
+ Args:
+ endpoint_id: Endpoint identifier
+ """
+ headers = copy.deepcopy(self.default_headers)
+ headers.update(self._get_auth_header())
+
+ response = self.session.delete(
+ "/".join(
+ [
+ self.url,
+ self.ENDPOINTS,
+ str(endpoint_id),
]
),
headers=headers,
@@ -664,7 +690,9 @@ def get(self, model_id: int, version_id: int, deployment_id: int) -> Deployment:
self._echo_debug(str(response))
response.raise_for_status()
- return Deployment(**response.json())
+
+# For downstream dependencies until they are updated
+DeploymentsClient = EndpointsClient
class TranspileClient(ApiClient):
diff --git a/giza/commands/deployments.py b/giza/commands/endpoints.py
similarity index 53%
rename from giza/commands/deployments.py
rename to giza/commands/endpoints.py
index 8532ea6..3c6f7d5 100644
--- a/giza/commands/deployments.py
+++ b/giza/commands/endpoints.py
@@ -7,13 +7,14 @@
from rich import print_json
from giza import API_HOST
-from giza.client import DeploymentsClient
+from giza.client import EndpointsClient
from giza.frameworks import cairo, ezkl
from giza.options import DEBUG_OPTION
-from giza.schemas.deployments import DeploymentsList
+from giza.schemas.endpoints import EndpointsList
from giza.schemas.proofs import Proof, ProofList
from giza.utils import echo, get_response_info
from giza.utils.enums import Framework, ServiceSize
+from giza.utils.exception_handling import ExceptionHandler
app = typer.Typer()
@@ -24,10 +25,13 @@ def deploy(
None,
"--model-id",
"-m",
- help="The ID of the model where a deployment will be created",
+ help="The ID of the model where an endpoint will be created",
),
version_id: int = typer.Option(
- None, "--version-id", "-v", help="The ID of the version that will be deployed"
+ None,
+ "--version-id",
+ "-v",
+ help="The ID of the version that will used in the endpoint",
),
size: ServiceSize = typer.Option(ServiceSize.S, "--size", "-s"),
framework: Framework = typer.Option(Framework.CAIRO, "--framework", "-f"),
@@ -46,20 +50,17 @@ def deploy(
app.command(
- short_help="π Creates a deployment for the specified model version.",
- help="""π Creates a deployment for the specified model version.
-
- This command has different behavior depending on the framework:
+ short_help="π Creates an endpoint for the specified model version.",
+ help="""π Creates an endpoint for the specified model version.
- * For Cairo, it will create an inference endpoint of the deployment in Giza.
- * For EZKL, not implemented yet.
+ This command will create an inference endpoint in Giza for the available frameworks.
This command performs several operations:
- * Creates a deployment for the specified version
+ * Creates an endpoint for the specified version
* Uploads the specified version file
* Polls the version until the status is either FAILED or COMPLETED
- * If the status is COMPLETED, sends back the deployment url to make inference requests
+ * If the status is COMPLETED, sends back the endpoint url to make inference requests
Error handling is also incorporated into this process.
""",
@@ -67,11 +68,11 @@ def deploy(
@app.command(
- short_help="π List the available deployments.",
- help="""π Lists all the available deployments in Giza.
- This command retrieves and displays a list of all deployments stored in the server.
- Each deployment's information is printed in a json format for easy readability and further processing.
- If there are no deployments available, an empty list is printed.
+ short_help="π List the available endpoints.",
+ help="""π Lists all the available endpoints in Giza.
+ This command retrieves and displays a list of all endpoints stored in the server.
+ Each endpoint information is printed in a json format for easy readability and further processing.
+ If there are no endpoints available, an empty list is printed.
""",
)
def list(
@@ -79,14 +80,24 @@ def list(
version_id: int = typer.Option(
None, "--version-id", "-v", help="The ID of the version"
),
+ only_active: bool = typer.Option(
+ False, "--only-active", "-a", help="Only list active endpoints"
+ ),
debug: Optional[bool] = DEBUG_OPTION,
) -> None:
- echo("Listing deployments β
")
+ echo("Listing endpoints β
")
+ params = {}
try:
- client = DeploymentsClient(API_HOST)
- deployments: DeploymentsList = client.list(model_id, version_id)
+ client = EndpointsClient(API_HOST)
+ if model_id:
+ params["model_id"] = model_id
+ if version_id:
+ params["version_id"] = version_id
+ if only_active:
+ params["is_active"] = True
+ deployments: EndpointsList = client.list(params=params)
except ValidationError as e:
- echo.error("Deployment validation error")
+ echo.error("Endpoint validation error")
echo.error("Review the provided information")
if debug:
raise e
@@ -94,7 +105,7 @@ def list(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error("βοΈCould not list deployments")
+ echo.error("βοΈCould not list endpoints")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -109,29 +120,30 @@ def list(
# giza/commands/deployments.py
@app.command(
- short_help="π― Get a deployment.",
- help="""π― Get a specific deployment in Giza.
- This command retrieves and displays a specific deployment stored in the server.
- The deployment's information is printed in a json format for easy readability and further processing.
- If the deployment is not available, an error message is printed.
+ short_help="π― Get an endpoint.",
+ help="""π― Get a specific endpoint in Giza.
+ This command retrieves and displays a specific endpoint stored in the server.
+ The endpoint information is printed in a json format for easy readability and further processing.
+ If the endpoint is not available, an error message is printed.
""",
)
def get(
- model_id: int = typer.Option(None, "--model-id", "-m", help="The ID of the model"),
- version_id: int = typer.Option(
- None, "--version-id", "-v", help="The ID of the version"
- ),
- deployment_id: int = typer.Option(
- None, "--deployment-id", "-d", help="The ID of the version"
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
),
debug: Optional[bool] = DEBUG_OPTION,
) -> None:
- echo(f"Getting deployment {deployment_id} β
")
+ echo(f"Getting endpoint {endpoint_id} β
")
try:
- client = DeploymentsClient(API_HOST)
- deployment = client.get(model_id, version_id, deployment_id)
+ client = EndpointsClient(API_HOST)
+ deployment = client.get(endpoint_id)
except ValidationError as e:
- echo.error("Deployment validation error")
+ echo.error("Endpoint validation error")
echo.error("Review the provided information")
if debug:
raise e
@@ -139,7 +151,7 @@ def get(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error(f"βοΈCould not get deployment {deployment_id}")
+ echo.error(f"βοΈCould not get endpoint {endpoint_id}")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -152,31 +164,60 @@ def get(
print_json(deployment.model_dump_json())
+@app.command(
+ name="delete",
+ short_help="π‘ Deletes an endpoint.",
+ help="""π‘ Deletes an endpoint and marks it as inactive.
+
+ This command will remove the `endpoint` service but it will mark it as `inactive` so underlying resources are not deleted.
+
+ Information about the inactives endpoint can be retrieved as well as the active ones.
+ """,
+)
+def delete_endpoint(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) -> None:
+ echo(f"Deleting endpoint {endpoint_id} β
")
+ with ExceptionHandler(debug=debug):
+ client = EndpointsClient(API_HOST)
+ client.delete(endpoint_id)
+ echo(f"Endpoint {endpoint_id} deleted β
")
+
+
@app.command(
name="list-proofs",
- short_help="π List proofs from a deployment.",
- help="""π List proofs from a deployment.
- This command retrieves and displays the proofs generated by a specific deployment stored in the server.
+ short_help="π List proofs from an endpoint.",
+ help="""π List proofs from an endpoint.
+ This command retrieves and displays the proofs generated by a specific endpoint stored in the server.
The proofs' information is printed in a json format for easy readability and further processing.
- If the deployment is not available, an error message is printed.
+ If the endpoint is not available, an error message is printed.
""",
)
def list_proofs(
- model_id: int = typer.Option(None, "--model-id", "-m", help="The ID of the model"),
- version_id: int = typer.Option(
- None, "--version-id", "-v", help="The ID of the version"
- ),
- deployment_id: int = typer.Option(
- None, "--deployment-id", "-d", help="The ID of the version"
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
),
debug: Optional[bool] = DEBUG_OPTION,
) -> None:
- echo(f"Getting proofs from deployment {deployment_id} β
")
+ echo(f"Getting proofs from endpoint {endpoint_id} β
")
try:
- client = DeploymentsClient(API_HOST)
- proofs: ProofList = client.list_proofs(model_id, version_id, deployment_id)
+ client = EndpointsClient(API_HOST)
+ proofs: ProofList = client.list_proofs(endpoint_id)
except ValidationError as e:
- echo.error("Could not retrieve proofs from deployment")
+ echo.error("Could not retrieve proofs from endpoint")
echo.error("Review the provided information")
if debug:
raise e
@@ -184,7 +225,7 @@ def list_proofs(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error(f"βοΈCould not get deployment {deployment_id}")
+ echo.error(f"βοΈCould not get endpoint {endpoint_id}")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -199,32 +240,33 @@ def list_proofs(
@app.command(
name="get-proof",
- short_help="π Retrieves information about a proof from a deployment.",
- help="""π Retrieves information about a proof from a deployment.
- This command retrieves and displays the proof generated by a specific deployment stored in the server.
+ short_help="π Retrieves information about a proof from an endpoint.",
+ help="""π Retrieves information about a proof from an endpoint.
+ This command retrieves and displays the proof generated by a specific endpoint stored in the server.
The proof information is printed in a json format for easy readability and further processing.
- If the deployment is not available, an error message is printed.
+ If the endpoint is not available, an error message is printed.
""",
)
def get_proof(
- model_id: int = typer.Option(None, "--model-id", "-m", help="The ID of the model"),
- version_id: int = typer.Option(
- None, "--version-id", "-v", help="The ID of the version"
- ),
- deployment_id: int = typer.Option(
- None, "--deployment-id", "-d", help="The ID of the version"
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
),
proof_id: str = typer.Option(
None, "--proof-id", "-p", help="The ID or request id of the proof"
),
debug: Optional[bool] = DEBUG_OPTION,
) -> None:
- echo(f"Getting proof from deployment {deployment_id} β
")
+ echo(f"Getting proof from endpoint {endpoint_id} β
")
try:
- client = DeploymentsClient(API_HOST)
- proof: Proof = client.get_proof(model_id, version_id, deployment_id, proof_id)
+ client = EndpointsClient(API_HOST)
+ proof: Proof = client.get_proof(endpoint_id, proof_id)
except ValidationError as e:
- echo.error("Could not retrieve proof from deployment")
+ echo.error("Could not retrieve proof from endpoint")
echo.error("Review the provided information")
if debug:
raise e
@@ -232,7 +274,7 @@ def get_proof(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error(f"βοΈCould not get deployment {deployment_id}")
+ echo.error(f"βοΈCould not get endpoint {endpoint_id}")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -247,20 +289,21 @@ def get_proof(
@app.command(
name="download-proof",
- short_help="π Downloads a proof from a deployment to the specified path.",
- help="""π Downloads a proof from a deployment to the specified path.
- This command retrieves the proof created in Giza from a specific deployment.
+ short_help="π Downloads a proof from an endpoint to the specified path.",
+ help="""π Downloads a proof from an endpoint to the specified path.
+ This command retrieves the proof created in Giza from a specific endpoint.
The proof information is stored in the specified path, defaulting to the current path.
- If the deployment is not available, an error message is printed.
+ If the endpoint is not available, an error message is printed.
""",
)
def download_proof(
- model_id: int = typer.Option(None, "--model-id", "-m", help="The ID of the model"),
- version_id: int = typer.Option(
- None, "--version-id", "-v", help="The ID of the version"
- ),
- deployment_id: int = typer.Option(
- None, "--deployment-id", "-d", help="The ID of the version"
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
),
proof_id: str = typer.Option(
None, "--proof-id", "-p", help="The ID or request id of the proof"
@@ -273,16 +316,14 @@ def download_proof(
),
debug: Optional[bool] = DEBUG_OPTION,
) -> None:
- echo(f"Getting proof from deployment {deployment_id} β
")
+ echo(f"Getting proof from endpoint {endpoint_id} β
")
try:
- client = DeploymentsClient(API_HOST)
- proof: bytes = client.download_proof(
- model_id, version_id, deployment_id, proof_id
- )
+ client = EndpointsClient(API_HOST)
+ proof: bytes = client.download_proof(endpoint_id, proof_id)
with open(output_path, "wb") as f:
f.write(proof)
except ValidationError as e:
- echo.error("Could not retrieve proof from deployment")
+ echo.error("Could not retrieve proof from endpoint")
echo.error("Review the provided information")
if debug:
raise e
@@ -290,7 +331,7 @@ def download_proof(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error(f"βοΈCould not get deployment {deployment_id}")
+ echo.error(f"βοΈCould not get endpoint {endpoint_id}")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -301,3 +342,30 @@ def download_proof(
raise e
sys.exit(1)
echo(f"Proof downloaded to {output_path} β
")
+
+
+@app.command(
+ name="list-jobs",
+ short_help="πΌ List jobs from an endpoint.",
+ help="""πΌ List jobs from an endpoint.
+ This command retrieves and displays the jobs created by a specific endpoint to generate a proof of a request.
+ The jobs information is printed in a json format for easy readability and further processing.
+ If the endpoint is not available, an error message is printed.
+ """,
+)
+def list_jobs(
+ endpoint_id: int = typer.Option(
+ None,
+ "--deployment-id",
+ "-d",
+ "--endpoint-id",
+ "-e",
+ help="The ID of the endpoint",
+ ),
+ debug: Optional[bool] = DEBUG_OPTION,
+) -> None:
+ echo(f"Getting jobs from endpoint {endpoint_id} β
")
+ with ExceptionHandler(debug=debug):
+ client = EndpointsClient(API_HOST)
+ jobs = client.list_jobs(endpoint_id)
+ print_json(jobs.json(exclude_unset=True))
diff --git a/giza/frameworks/cairo.py b/giza/frameworks/cairo.py
index bd52a3d..8db4732 100644
--- a/giza/frameworks/cairo.py
+++ b/giza/frameworks/cairo.py
@@ -15,14 +15,14 @@
from giza import API_HOST
from giza.client import (
- DeploymentsClient,
+ EndpointsClient,
JobsClient,
ModelsClient,
ProofsClient,
VersionsClient,
)
from giza.options import DEBUG_OPTION
-from giza.schemas.deployments import DeploymentCreate, DeploymentsList
+from giza.schemas.endpoints import EndpointCreate, EndpointsList
from giza.schemas.jobs import Job, JobCreate
from giza.schemas.models import ModelCreate
from giza.schemas.proofs import Proof
@@ -127,7 +127,7 @@ def deploy(
debug: Optional[bool] = DEBUG_OPTION,
) -> str:
"""
- Command to deploy a specific version of a model. This will create a deployment for the specified version and check the status, once it finishes if COMPLETED the deployment is ready to be used.
+ Command to deploy a specific version of a model. This will create an endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
Args:
data: main SIERRA file
@@ -141,27 +141,29 @@ def deploy(
HTTPError: request error to the API, 4XX or 5XX
"""
try:
- client = DeploymentsClient(API_HOST)
+ client = EndpointsClient(API_HOST)
- deployments_list: DeploymentsList = client.list(model_id, version_id)
- deployments: dict = json.loads(deployments_list.model_dump_json())
+ endpoints_list: EndpointsList = client.list(
+ params={"model_id": model_id, "version_id": version_id, "is_active": True}
+ )
+ endpoints: dict = json.loads(endpoints_list.model_dump_json())
- if len(deployments) > 0:
+ if len(endpoints) > 0:
echo.info(
- f"Deployment for model id {model_id} and version id {version_id} already exists! β
"
+ f"Endpoint for model id {model_id} and version id {version_id} already exists! β
"
)
- echo.info(f"Deployment id -> {deployments[0]['id']} β
")
- echo.info(f'You can start doing inferences at: {deployments[0]["uri"]} π')
+ echo.info(f"Endpoint id -> {endpoints[0]['id']} β
")
+ echo.info(f'You can start doing inferences at: {endpoints[0]["uri"]} π')
sys.exit(1)
- spinner = Spinner(name="aesthetic", text="Creating deployment!")
+ spinner = Spinner(name="aesthetic", text="Creating endpoint!")
with Live(renderable=spinner):
if data is None:
- deployment = client.create(
+ endpoint = client.create(
model_id,
version_id,
- DeploymentCreate(
+ EndpointCreate(
size=size,
model_id=model_id,
version_id=version_id,
@@ -170,10 +172,10 @@ def deploy(
)
else:
with open(data, "rb") as sierra:
- deployment = client.create(
+ endpoint = client.create(
model_id,
version_id,
- DeploymentCreate(
+ EndpointCreate(
size=size,
model_id=model_id,
version_id=version_id,
@@ -182,7 +184,7 @@ def deploy(
)
except ValidationError as e:
- echo.error("Deployment validation error")
+ echo.error("Endpoint validation error")
echo.error("Review the provided information")
if debug:
raise e
@@ -190,7 +192,7 @@ def deploy(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error("βοΈCould not create the deployment")
+ echo.error("βοΈCould not create the endpoint")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -200,10 +202,10 @@ def deploy(
if debug:
raise e
sys.exit(1)
- echo("Deployment is successful β
")
- echo(f"Deployment created with id -> {deployment.id} β
")
- echo(f"Deployment created with endpoint URL: {deployment.uri} π")
- return deployment
+ echo("Endpoint is successful β
")
+ echo(f"Endpoint created with id -> {endpoint.id} β
")
+ echo(f"Endpoint created with endpoint URL: {endpoint.uri} π")
+ return endpoint
def transpile(
diff --git a/giza/frameworks/ezkl.py b/giza/frameworks/ezkl.py
index a3f2332..100e2cd 100644
--- a/giza/frameworks/ezkl.py
+++ b/giza/frameworks/ezkl.py
@@ -12,7 +12,7 @@
from giza import API_HOST
from giza.client import (
- DeploymentsClient,
+ EndpointsClient,
JobsClient,
ModelsClient,
ProofsClient,
@@ -20,7 +20,7 @@
VersionsClient,
)
from giza.options import DEBUG_OPTION
-from giza.schemas.deployments import DeploymentCreate, DeploymentsList
+from giza.schemas.endpoints import EndpointCreate, EndpointsList
from giza.schemas.jobs import Job, JobCreate
from giza.schemas.models import ModelCreate
from giza.schemas.proofs import Proof
@@ -326,7 +326,7 @@ def deploy(
debug: Optional[bool] = DEBUG_OPTION,
) -> str:
"""
- Command to deploy a specific version of a model. This will create a deployment for the specified version and check the status, once it finishes if COMPLETED the deployment is ready to be used.
+ Command to deploy a specific version of a model. This will create a endpoint for the specified version and check the status, once it finishes if COMPLETED the endpoint is ready to be used.
Args:
model_id: model id to deploy
@@ -340,26 +340,28 @@ def deploy(
"""
try:
echo = Echo(debug=debug)
- client = DeploymentsClient(API_HOST)
+ client = EndpointsClient(API_HOST)
- deployments_list: DeploymentsList = client.list(model_id, version_id)
- deployments: dict = json.loads(deployments_list.model_dump_json())
+ endpoints_list: EndpointsList = client.list(
+ params={"model_id": model_id, "version_id": version_id, "is_active": True}
+ )
+ endpoints: dict = json.loads(endpoints_list.model_dump_json())
- if len(deployments) > 0:
+ if len(endpoints) > 0:
echo.info(
- f"Deployment for model id {model_id} and version id {version_id} already exists! β
"
+ f"Endpoint for model id {model_id} and version id {version_id} already exists! β
"
)
- echo.info(f"Deployment id -> {deployments[0]['id']} β
")
- echo.info(f'You can start doing inferences at: {deployments[0]["uri"]} π')
+ echo.info(f"Endpoint id -> {endpoints[0]['id']} β
")
+ echo.info(f'You can start doing inferences at: {endpoints[0]["uri"]} π')
sys.exit(1)
- spinner = Spinner(name="aesthetic", text="Creating deployment!")
+ spinner = Spinner(name="aesthetic", text="Creating endpoint!")
with Live(renderable=spinner):
- deployment = client.create(
+ endpoint = client.create(
model_id,
version_id,
- DeploymentCreate(
+ EndpointCreate(
size=size,
model_id=model_id,
version_id=version_id,
@@ -368,7 +370,7 @@ def deploy(
None,
)
except ValidationError as e:
- echo.error("Deployment validation error")
+ echo.error("Endpoint validation error")
echo.error("Review the provided information")
if debug:
raise e
@@ -376,7 +378,7 @@ def deploy(
sys.exit(1)
except HTTPError as e:
info = get_response_info(e.response)
- echo.error("βοΈCould not create the deployment")
+ echo.error("βοΈCould not create the endpoint")
echo.error(f"βοΈDetail -> {info.get('detail')}βοΈ")
echo.error(f"βοΈStatus code -> {info.get('status_code')}βοΈ")
echo.error(f"βοΈError message -> {info.get('content')}βοΈ")
@@ -386,7 +388,7 @@ def deploy(
if debug:
raise e
sys.exit(1)
- echo("Deployment is successful β
")
- echo(f"Deployment created with id -> {deployment.id} β
")
- echo(f"Deployment created with endpoint URL: {deployment.uri} π")
- return deployment
+ echo("Endpoint is successful β
")
+ echo(f"Endpoint created with id -> {endpoint.id} β
")
+ echo(f"Endpoint created with endpoint URL: {endpoint.uri} π")
+ return endpoint
diff --git a/giza/schemas/deployments.py b/giza/schemas/endpoints.py
similarity index 80%
rename from giza/schemas/deployments.py
rename to giza/schemas/endpoints.py
index efc7da0..6742475 100644
--- a/giza/schemas/deployments.py
+++ b/giza/schemas/endpoints.py
@@ -1,11 +1,11 @@
from typing import Optional
-from pydantic import BaseModel, ConfigDict, RootModel
+from pydantic import BaseModel, ConfigDict
from giza.utils.enums import Framework, ServiceSize
-class DeploymentCreate(BaseModel):
+class EndpointCreate(BaseModel):
file: Optional[str] = None
uri: Optional[str] = None
model_id: Optional[int] = None
@@ -19,7 +19,7 @@ class DeploymentCreate(BaseModel):
model_config["protected_namespaces"] = ()
-class Deployment(BaseModel):
+class Endpoint(BaseModel):
id: int
status: Optional[str] = None
uri: Optional[str] = None
@@ -27,10 +27,11 @@ class Deployment(BaseModel):
service_name: Optional[str] = None
model_id: Optional[int] = None
version_id: Optional[int] = None
+ is_active: bool
model_config = ConfigDict(from_attributes=True)
model_config["protected_namespaces"] = ()
-class DeploymentsList(RootModel):
- root: list[Deployment]
+class EndpointsList(BaseModel):
+ root: list[Endpoint]
diff --git a/giza/schemas/jobs.py b/giza/schemas/jobs.py
index b1652b9..ef7538a 100644
--- a/giza/schemas/jobs.py
+++ b/giza/schemas/jobs.py
@@ -14,6 +14,7 @@ class Job(BaseModel):
elapsed_time: Optional[float] = None
created_date: Optional[datetime.datetime] = None
last_update: Optional[datetime.datetime] = None
+ request_id: Optional[str] = None
class JobCreate(BaseModel):
@@ -26,3 +27,7 @@ class JobCreate(BaseModel):
model_config = ConfigDict(from_attributes=True)
model_config["protected_namespaces"] = ()
+
+
+class JobList(BaseModel):
+ root: list[Job]
diff --git a/giza/schemas/proofs.py b/giza/schemas/proofs.py
index cd1788f..a399df0 100644
--- a/giza/schemas/proofs.py
+++ b/giza/schemas/proofs.py
@@ -11,6 +11,7 @@ class Proof(BaseModel):
cairo_execution_time: Optional[float] = None
metrics: Optional[dict] = None
created_date: datetime.datetime
+ request_id: Optional[str] = None
class ProofList(RootModel):
diff --git a/giza/utils/exception_handling.py b/giza/utils/exception_handling.py
index e42cb5d..f8bae19 100644
--- a/giza/utils/exception_handling.py
+++ b/giza/utils/exception_handling.py
@@ -1,4 +1,5 @@
import sys
+from typing import Optional
from pydantic import ValidationError
from requests import HTTPError
@@ -27,7 +28,7 @@ class ExceptionHandler:
"""
- def __init__(self, debug: bool = False) -> None:
+ def __init__(self, debug: Optional[bool] = False) -> None:
if debug is None:
debug = False
self.debug = debug
diff --git a/pyproject.toml b/pyproject.toml
index 3eeccca..8cda694 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "giza-cli"
-version = "0.12.3"
+version = "0.14.0"
description = "CLI for interacting with Giza"
authors = ["Gonzalo Mellizo-Soto "]
readme = "README.md"
diff --git a/tests/commands/test_deployments.py b/tests/commands/test_endpoints.py
similarity index 75%
rename from tests/commands/test_deployments.py
rename to tests/commands/test_endpoints.py
index 247a4ac..33b26fe 100644
--- a/tests/commands/test_deployments.py
+++ b/tests/commands/test_endpoints.py
@@ -2,9 +2,9 @@
from requests import HTTPError
-from giza.commands.deployments import DeploymentsClient, cairo
+from giza.commands.endpoints import EndpointsClient, cairo
from giza.frameworks import ezkl
-from giza.schemas.deployments import Deployment, DeploymentsList
+from giza.schemas.endpoints import Endpoint, EndpointsList
from tests.conftest import invoke_cli_runner
@@ -12,7 +12,7 @@ def test_deploy_with_cairo_framework():
with patch.object(cairo, "deploy") as mock_deploy:
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"deploy",
"--model-id",
"1",
@@ -34,7 +34,7 @@ def test_deploy_with_ezkl_framework():
with patch.object(ezkl, "deploy") as mock_deploy:
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"deploy",
"--model-id",
"1",
@@ -52,9 +52,9 @@ def test_deploy_with_ezkl_framework():
def test_deploy_ezkl_existing_deployment():
- deploy_list = DeploymentsList(
+ deploy_list = EndpointsList(
root=[
- Deployment(
+ Endpoint(
id=1,
status="COMPLETED",
uri="https://giza-api.com/deployments/1",
@@ -62,15 +62,14 @@ def test_deploy_ezkl_existing_deployment():
service_name="giza-deployment-1",
model_id=1,
version_id=1,
+ is_active=True,
),
]
)
- with patch.object(
- DeploymentsClient, "list", return_value=deploy_list
- ) as mock_deploy:
+ with patch.object(EndpointsClient, "list", return_value=deploy_list) as mock_deploy:
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"deploy",
"--model-id",
"1",
@@ -91,7 +90,7 @@ def test_deploy_ezkl_existing_deployment():
def test_deploy_with_unsupported_framework():
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"deploy",
"--model-id",
"1",
@@ -109,9 +108,9 @@ def test_deploy_with_unsupported_framework():
def test_list_deployments():
- deployments_list = DeploymentsList(
+ deployments_list = EndpointsList(
root=[
- Deployment(
+ Endpoint(
id=1,
status="COMPLETED",
uri="https://giza-api.com/deployments/1",
@@ -119,8 +118,9 @@ def test_list_deployments():
service_name="giza-deployment-1",
model_id=1,
version_id=1,
+ is_active=True,
),
- Deployment(
+ Endpoint(
id=2,
status="COMPLETED",
uri="https://giza-api.com/deployments/2",
@@ -128,14 +128,15 @@ def test_list_deployments():
service_name="giza-deployment-2",
model_id=1,
version_id=1,
+ is_active=True,
),
]
)
with patch.object(
- DeploymentsClient, "list", return_value=deployments_list
+ EndpointsClient, "list", return_value=deployments_list
) as mock_list:
result = invoke_cli_runner(
- ["deployments", "list", "--model-id", "1", "--version-id", "1"],
+ ["endpoints", "list", "--model-id", "1", "--version-id", "1"],
)
mock_list.assert_called_once()
assert result.exit_code == 0
@@ -144,17 +145,17 @@ def test_list_deployments():
def test_list_deployments_http_error():
- with patch.object(DeploymentsClient, "list", side_effect=HTTPError):
+ with patch.object(EndpointsClient, "list", side_effect=HTTPError):
result = invoke_cli_runner(
- ["deployments", "list", "--model-id", "1", "--version-id", "1"],
+ ["endpoints", "list", "--model-id", "1", "--version-id", "1"],
expected_error=True,
)
assert result.exit_code == 1
- assert "Could not list deployments" in result.stdout
+ assert "Could not list endpoints" in result.stdout
def test_get_deployment():
- deployment = Deployment(
+ deployment = Endpoint(
id=1,
status="COMPLETED",
uri="https://giza-api.com/deployments/1",
@@ -162,18 +163,15 @@ def test_get_deployment():
service_name="giza-deployment-1",
model_id=1,
version_id=1,
+ is_active=True,
)
with patch.object(
- DeploymentsClient, "get", return_value=deployment
+ EndpointsClient, "get", return_value=deployment
) as mock_deployment:
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"get",
- "--model-id",
- "1",
- "--version-id",
- "1",
"--deployment-id",
"1",
],
@@ -184,17 +182,11 @@ def test_get_deployment():
def test_get_deployment_http_error():
- with patch.object(
- DeploymentsClient, "get", side_effect=HTTPError
- ) as mock_deployment:
+ with patch.object(EndpointsClient, "get", side_effect=HTTPError) as mock_deployment:
result = invoke_cli_runner(
[
- "deployments",
+ "endpoints",
"get",
- "--model-id",
- "1",
- "--version-id",
- "1",
"--deployment-id",
"1",
],
@@ -202,4 +194,4 @@ def test_get_deployment_http_error():
)
mock_deployment.assert_called_once()
assert result.exit_code == 1
- assert "Could not get deployment" in result.stdout
+ assert "Could not get endpoint" in result.stdout