From 2c8a51a474693f56ebb2c33e698d4e0a712fd5e9 Mon Sep 17 00:00:00 2001 From: OlivierDehaene <23298448+OlivierDehaene@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:20:20 +0200 Subject: [PATCH] update doc --- docs/openapi.json | 13 +++++++++---- router/src/sagemaker.rs | 14 +++++++------- update_doc.py | 2 ++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 5f1946b39a4..e7da2d40c54 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -321,6 +321,7 @@ "tags": [ "Text Generation Inference" ], + "summary": "Generate tokens from Sagemaker request", "operationId": "sagemaker_compatibility", "requestBody": { "content": { @@ -356,7 +357,8 @@ "$ref": "#/components/schemas/ErrorResponse" }, "example": { - "error": "Input validation error" + "error": "Input validation error", + "error_type": "validation" } } } @@ -369,7 +371,8 @@ "$ref": "#/components/schemas/ErrorResponse" }, "example": { - "error": "Request failed during generation" + "error": "Request failed during generation", + "error_type": "generation" } } } @@ -382,7 +385,8 @@ "$ref": "#/components/schemas/ErrorResponse" }, "example": { - "error": "Model is overloaded" + "error": "Model is overloaded", + "error_type": "overloaded" } } } @@ -395,7 +399,8 @@ "$ref": "#/components/schemas/ErrorResponse" }, "example": { - "error": "Incomplete generation" + "error": "Incomplete generation", + "error_type": "incomplete_generation" } } } diff --git a/router/src/sagemaker.rs b/router/src/sagemaker.rs index 1ba8cabe538..750ef222bb5 100644 --- a/router/src/sagemaker.rs +++ b/router/src/sagemaker.rs @@ -20,7 +20,7 @@ pub(crate) enum SagemakerRequest { Completion(CompletionRequest), } -/// Used for OpenAPI specs +// Used for OpenAPI specs #[allow(dead_code)] #[derive(Serialize, ToSchema)] #[serde(untagged)] @@ -30,7 +30,7 @@ pub(crate) enum SagemakerResponse { Completion(CompletionFinal), } -/// Used for OpenAPI specs +// Used for OpenAPI specs #[allow(dead_code)] #[derive(Serialize, ToSchema)] #[serde(untagged)] @@ -40,7 +40,7 @@ pub(crate) enum SagemakerStreamResponse { Completion(Chunk), } -// Generate tokens from Sagemaker request +/// Generate tokens from Sagemaker request #[utoipa::path( post, tag = "Text Generation Inference", @@ -53,13 +53,13 @@ content( ("text/event-stream" = SagemakerStreamResponse), )), (status = 424, description = "Generation Error", body = ErrorResponse, -example = json ! ({"error": "Request failed during generation"})), +example = json ! ({"error": "Request failed during generation", "error_type": "generation"})), (status = 429, description = "Model is overloaded", body = ErrorResponse, -example = json ! ({"error": "Model is overloaded"})), +example = json ! ({"error": "Model is overloaded", "error_type": "overloaded"})), (status = 422, description = "Input validation error", body = ErrorResponse, -example = json ! ({"error": "Input validation error"})), +example = json ! ({"error": "Input validation error", "error_type": "validation"})), (status = 500, description = "Incomplete generation", body = ErrorResponse, -example = json ! ({"error": "Incomplete generation"})), +example = json ! ({"error": "Incomplete generation", "error_type": "incomplete_generation"})), ) )] #[instrument(skip_all)] diff --git a/update_doc.py b/update_doc.py index 203aaced025..6357cc0061b 100644 --- a/update_doc.py +++ b/update_doc.py @@ -172,6 +172,8 @@ def check_openapi(check: bool): # allow for trailing whitespace since it's not significant # and the precommit hook will remove it "lint", + "--skip-rule", + "security-defined", filename, ], capture_output=True,