Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierDehaene committed Oct 23, 2024
1 parent 7048342 commit 2c8a51a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
13 changes: 9 additions & 4 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"tags": [
"Text Generation Inference"
],
"summary": "Generate tokens from Sagemaker request",
"operationId": "sagemaker_compatibility",
"requestBody": {
"content": {
Expand Down Expand Up @@ -356,7 +357,8 @@
"$ref": "#/components/schemas/ErrorResponse"
},
"example": {
"error": "Input validation error"
"error": "Input validation error",
"error_type": "validation"
}
}
}
Expand All @@ -369,7 +371,8 @@
"$ref": "#/components/schemas/ErrorResponse"
},
"example": {
"error": "Request failed during generation"
"error": "Request failed during generation",
"error_type": "generation"
}
}
}
Expand All @@ -382,7 +385,8 @@
"$ref": "#/components/schemas/ErrorResponse"
},
"example": {
"error": "Model is overloaded"
"error": "Model is overloaded",
"error_type": "overloaded"
}
}
}
Expand All @@ -395,7 +399,8 @@
"$ref": "#/components/schemas/ErrorResponse"
},
"example": {
"error": "Incomplete generation"
"error": "Incomplete generation",
"error_type": "incomplete_generation"
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions router/src/sagemaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand All @@ -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",
Expand All @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions update_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2c8a51a

Please sign in to comment.