diff --git a/k8s.yaml b/k8s.yaml index be0e472..73f69ed 100644 --- a/k8s.yaml +++ b/k8s.yaml @@ -33,6 +33,7 @@ spec: { "url": "/app_openapi.json", "name": "Product matcher" }, { "url": "/uc_openapi.json", "name": "Unit converter" }, { "url": "/rc_openapi.json", "name": "Product matcher (region)" } + { "url": "/classifier_products_services_openapi.json", "name": "Classifier products services" } ] - name: URLS_PRIMARY_NAME value: "Product matcher (region)" diff --git a/www/classifier_products_services_openapi.json b/www/classifier_products_services_openapi.json new file mode 100644 index 0000000..7fb72b8 --- /dev/null +++ b/www/classifier_products_services_openapi.json @@ -0,0 +1,165 @@ +{ + "openapi": "3.1.0", + "info": { "title": "API Классификатор товаров и услуг", "version": "0.0.0" }, + "servers": [{ "url": "/classifier_products_services" }], + "paths": { + "/api/v1/health": { + "get": { + "tags": ["System"], + "summary": "Health", + "operationId": "health_api_v1_health_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HealthResponse" } + } + } + } + } + } + }, + "/api/v1/predict": { + "post": { + "tags": ["Inference"], + "summary": "Predict", + "operationId": "predict_api_v1_predict_post", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PredictRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PredictResponse" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "HTTPValidationError": { + "properties": { + "detail": { + "items": { "$ref": "#/components/schemas/ValidationError" }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + }, + "HealthResponse": { + "properties": { + "status": { "type": "string", "title": "Status" }, + "device": { "type": "string", "title": "Device" }, + "model_path": { "type": "string", "title": "Model Path" } + }, + "type": "object", + "required": ["status", "device", "model_path"], + "title": "HealthResponse" + }, + "PredictRequest": { + "properties": { + "texts": { + "items": { "type": "string" }, + "type": "array", + "maxItems": 1024, + "minItems": 1, + "title": "Texts", + "description": "Список строк для классификации" + }, + "threshold": { + "anyOf": [ + { "type": "number", "maximum": 1.0, "minimum": 0.0 }, + { "type": "null" } + ], + "title": "Threshold", + "description": "порог (default=0.65)" + }, + "batch_size": { + "anyOf": [ + { "type": "integer", "maximum": 512.0, "minimum": 1.0 }, + { "type": "null" } + ], + "title": "Batch Size", + "description": "batch size" + } + }, + "type": "object", + "required": ["texts"], + "title": "PredictRequest", + "example": { + "texts": ["Щебень фракции от 20 до 40 мм", "Установка боллардов"], + "threshold": 0.65 + } + }, + "PredictResponse": { + "properties": { + "predictions": { + "items": { "$ref": "#/components/schemas/PredictionItem" }, + "type": "array", + "title": "Predictions" + }, + "model_path": { "type": "string", "title": "Model Path" }, + "threshold_used": { "type": "number", "title": "Threshold Used" } + }, + "type": "object", + "required": ["predictions", "model_path", "threshold_used"], + "title": "PredictResponse" + }, + "PredictionItem": { + "properties": { + "text": { "type": "string", "title": "Text" }, + "label": { + "type": "integer", + "title": "Label", + "description": "0 - услуга, 1 - товар" + }, + "probability": { + "type": "number", + "title": "Probability", + "description": "Вероятность" + } + }, + "type": "object", + "required": ["text", "label", "probability"], + "title": "PredictionItem" + }, + "ValidationError": { + "properties": { + "loc": { + "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }, + "type": "array", + "title": "Location" + }, + "msg": { "type": "string", "title": "Message" }, + "type": { "type": "string", "title": "Error Type" }, + "input": { "title": "Input" }, + "ctx": { "type": "object", "title": "Context" } + }, + "type": "object", + "required": ["loc", "msg", "type"], + "title": "ValidationError" + } + } + } +}