Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🦺 Initial request validation #42

Merged
merged 15 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
url = "2.5.0"
uuid = { version = "1.8.0", features = ["v4", "fast-rng"] }
validator = { version = "0.18.1", features = ["derive"] } # For API validation

[build-dependencies]
tonic-build = "0.11.0"
Expand Down
56 changes: 24 additions & 32 deletions docs/api/orchestrator_openapi_0_1_0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ClassifiedGeneratedTextResult'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
$ref: '#/components/schemas/Error'
/api/v1/task/server-streaming-classification-with-text-generation:
post:
tags:
Expand All @@ -49,12 +55,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ClassifiedGeneratedTextStreamResult'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
$ref: '#/components/schemas/Error'
components:
schemas:
ClassifiedGeneratedTextResult:
Expand Down Expand Up @@ -156,6 +168,16 @@ components:
required: ["input_token_count", "token_classification_results", "start_index"]
type: object
title: ClassifiedGeneratedTextStreamResult
Error:
type: object
properties:
code:
type: string
details:
type: string
required:
- code
- details
ExponentialDecayLengthPenalty:
properties:
start_index:
Expand Down Expand Up @@ -299,15 +321,6 @@ components:
additionalProperties: false
type: object
title: GuardrailsTextGenerationParameters
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
InputWarning:
properties:
id:
Expand Down Expand Up @@ -368,24 +381,3 @@ components:
required: ["start", "end", "word", "entity", "entity_group", "score"]
type: object
title: TokenClassificationResult
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError
4 changes: 2 additions & 2 deletions src/clients/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub struct DetectorResponse {
impl From<Detection> for crate::models::TokenClassificationResult {
fn from(value: Detection) -> Self {
Self {
start: value.start as i32,
end: value.end as i32,
start: value.start as u32,
end: value.end as u32,
word: value.text,
entity: value.detection,
entity_group: value.detection_type,
Expand Down
Loading