diff --git a/openapi/download-and-merge-spec.sh b/openapi/download-and-merge-spec.sh index 237a8b940..73892a02a 100755 --- a/openapi/download-and-merge-spec.sh +++ b/openapi/download-and-merge-spec.sh @@ -9,12 +9,13 @@ url_for() { "order") echo "https://api.app.rabbitdata.ch/Order/swagger/v1/swagger.json" ;; "dataset") echo "https://api.app.rabbitdata.ch/Dataset/swagger/v1/swagger.json" ;; "identity") echo "https://api.app.rabbitdata.ch/Identity/swagger/v1/swagger.json" ;; + "validation") echo "https://api.app.rabbitdata.ch/Validation/swagger/v1/swagger.json" ;; *) echo "" ;; esac } # List of keys -keys=("order" "dataset" "identity") +keys=("order" "dataset" "identity" "validation") for key in "${keys[@]}"; do url=$(url_for "$key") diff --git a/openapi/openapi-merge.json b/openapi/openapi-merge.json index 2b912477e..211ec6684 100644 --- a/openapi/openapi-merge.json +++ b/openapi/openapi-merge.json @@ -8,6 +8,9 @@ }, { "inputFile": "./spec/identity.json" + }, + { + "inputFile": "./spec/validation.json" } ], "output": "./output.swagger.json" diff --git a/openapi/output.swagger.json b/openapi/output.swagger.json index b928580a6..a301ff25c 100644 --- a/openapi/output.swagger.json +++ b/openapi/output.swagger.json @@ -1405,7 +1405,24 @@ "summary": "Issues a new auth token using the refresh token.", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/IssueAuthTokenResult" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/IssueAuthTokenResult" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/IssueAuthTokenResult" + } + } + } } } } @@ -1675,6 +1692,287 @@ } } } + }, + "/Coco/Upload": { + "post": { + "tags": [ + "Coco" + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Title": { + "type": "string" + }, + "File": { + "type": "string", + "format": "binary" + } + } + }, + "encoding": { + "Name": { + "style": "form" + }, + "Title": { + "style": "form" + }, + "File": { + "style": "form" + } + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Coco/Submit": { + "post": { + "tags": [ + "Coco" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubmitCocoModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/SubmitCocoModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/SubmitCocoModel" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/QueryValidationSets": { + "get": { + "tags": [ + "Validation" + ], + "parameters": [ + { + "name": "model", + "in": "query", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryValidationSetModel" + } + } + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/GetAvailableValidationSets": { + "get": { + "tags": [ + "Validation" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/CreateValidationSet": { + "post": { + "tags": [ + "Validation" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/AddValidationRapid": { + "post": { + "tags": [ + "Validation" + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "model": { + "$ref": "#/components/schemas/AddValidationRapidModel" + }, + "files": { + "type": "array", + "items": { + "type": "string", + "format": "binary" + } + } + } + }, + "encoding": { + "model": { + "style": "form" + }, + "files": { + "style": "form" + } + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/Import": { + "post": { + "tags": [ + "Validation" + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "Blueprint": { + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptionRapidBlueprint" + }, + { + "$ref": "#/components/schemas/PolygonRapidBlueprint" + }, + { + "$ref": "#/components/schemas/NamedEntityRapidBlueprint" + }, + { + "$ref": "#/components/schemas/LocateRapidBlueprint" + }, + { + "$ref": "#/components/schemas/LineRapidBlueprint" + }, + { + "$ref": "#/components/schemas/FreeTextRapidBlueprint" + }, + { + "$ref": "#/components/schemas/CompareRapidBlueprint" + }, + { + "$ref": "#/components/schemas/AttachCategoryRapidBlueprint" + }, + { + "$ref": "#/components/schemas/BoundingBoxRapidBlueprint" + } + ], + "discriminator": { + "propertyName": "_t" + } + }, + "File": { + "type": "string", + "format": "binary" + } + } + }, + "encoding": { + "Blueprint": { + "style": "form" + }, + "File": { + "style": "form" + } + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/Validation/ImportCompare": { + "post": { + "tags": [ + "Validation" + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "Criteria": { + "type": "string" + }, + "File": { + "type": "string", + "format": "binary" + } + } + }, + "encoding": { + "Criteria": { + "style": "form" + }, + "File": { + "style": "form" + } + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } } }, "components": { @@ -2743,7 +3041,8 @@ }, "region": { "type": "string", - "description": "The region of the S3 bucket." + "description": "The region of the S3 bucket.", + "nullable": true }, "sourcePrefix": { "type": "string", @@ -2751,11 +3050,13 @@ }, "accessKey": { "type": "string", - "description": "The access key to use for the S3 bucket." + "description": "The access key to use for the S3 bucket.", + "nullable": true }, "secretKey": { "type": "string", - "description": "The secret key to use for the S3 bucket." + "description": "The secret key to use for the S3 bucket.", + "nullable": true }, "useCustomAwsCredentials": { "type": "boolean", @@ -3695,7 +3996,8 @@ "email": { "type": "string", "description": "The email of the user submitting the feedback", - "default": null + "default": null, + "nullable": true } }, "additionalProperties": false, @@ -3772,7 +4074,7 @@ "description": "All available Gender options." }, "GenderUserFilterModel": { - "title": "GenderUserFilterModel", + "title": "GenderFilter", "required": [ "_t", "genders" @@ -3781,11 +4083,11 @@ "properties": { "_t": { "enum": [ - "GenderUserFilterModel" + "GenderFilter" ], "type": "string", - "description": "Discriminator value for GenderUserFilterModel", - "example": "GenderUserFilterModel" + "description": "Discriminator value for GenderFilter", + "example": "GenderFilter" }, "genders": { "type": "array", @@ -4197,7 +4499,8 @@ "$ref": "#/components/schemas/SortCriterion" }, "description": "The sorting criteria", - "default": null + "default": null, + "nullable": true } }, "additionalProperties": false, @@ -4561,7 +4864,8 @@ "workflowConfigArtifactId": { "type": "string", "description": "The id of the workflow config artifact in the pipeline. If using the default pipeline this is not needed.", - "default": null + "default": null, + "nullable": true } }, "additionalProperties": false, @@ -4621,8 +4925,9 @@ "title": "WorkflowAggregationStepModel", "required": [ "_t", - "datasetArtifactId", - "fileUploadedArtifactId" + "campaignArtifactId", + "fileUploadedArtifactId", + "workflowArtifactId" ], "type": "object", "properties": { @@ -4634,7 +4939,10 @@ "description": "Discriminator value for WorkflowAggregationStepModel", "example": "WorkflowAggregationStepModel" }, - "datasetArtifactId": { + "campaignArtifactId": { + "type": "string" + }, + "workflowArtifactId": { "type": "string" }, "fileUploadedArtifactId": { @@ -4742,6 +5050,20 @@ "additionalProperties": false, "description": "The model for creating a new client." }, + "IssueAuthTokenResult": { + "required": [ + "token" + ], + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The issued auth token." + } + }, + "additionalProperties": false, + "description": "The result of issuing a auth token." + }, "IssueClientAuthTokenResult": { "required": [ "authToken" @@ -4892,6 +5214,680 @@ } }, "additionalProperties": false + }, + "AddValidationRapidModel": { + "required": [ + "metadata", + "payload", + "randomCorrectProbability", + "truth", + "validationSetId" + ], + "type": "object", + "properties": { + "validationSetId": { + "type": "string" + }, + "payload": { + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptionPayload" + }, + { + "$ref": "#/components/schemas/PolygonPayload" + }, + { + "$ref": "#/components/schemas/NamedEntityPayload" + }, + { + "$ref": "#/components/schemas/LocatePayload" + }, + { + "$ref": "#/components/schemas/LinePayload" + }, + { + "$ref": "#/components/schemas/FreeTextPayload" + }, + { + "$ref": "#/components/schemas/ComparePayload" + }, + { + "$ref": "#/components/schemas/ClassifyPayload" + }, + { + "$ref": "#/components/schemas/BoundingBoxPayload" + } + ], + "discriminator": { + "propertyName": "_t" + } + }, + "metadata": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/PromptMetadataInput" + }, + { + "$ref": "#/components/schemas/PublicTextMetadataInput" + }, + { + "$ref": "#/components/schemas/TranscriptionMetadataInput" + } + ], + "discriminator": { + "propertyName": "_t" + } + } + }, + "truth": { + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptionTruth" + }, + { + "$ref": "#/components/schemas/PolygonTruth" + }, + { + "$ref": "#/components/schemas/NamedEntityTruth" + }, + { + "$ref": "#/components/schemas/LocateBoxTruth" + }, + { + "$ref": "#/components/schemas/LineTruth" + }, + { + "$ref": "#/components/schemas/CompareTruth" + }, + { + "$ref": "#/components/schemas/AttachCategoryTruth" + }, + { + "$ref": "#/components/schemas/BoundingBoxTruth" + }, + { + "$ref": "#/components/schemas/EmptyValidationTruth" + } + ], + "discriminator": { + "propertyName": "_t" + } + }, + "randomCorrectProbability": { + "type": "number", + "format": "double", + "nullable": true + } + }, + "additionalProperties": false + }, + "AttachCategoryTruth": { + "title": "AttachCategoryTruth", + "required": [ + "_t", + "correctCategories" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "AttachCategoryTruth" + ], + "type": "string", + "description": "Discriminator value for AttachCategoryTruth", + "example": "AttachCategoryTruth" + }, + "correctCategories": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "BoundingBoxPayload": { + "title": "BoundingBoxPayload", + "required": [ + "_t", + "target" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "BoundingBoxPayload" + ], + "type": "string", + "description": "Discriminator value for BoundingBoxPayload", + "example": "BoundingBoxPayload" + }, + "target": { + "type": "string" + } + }, + "additionalProperties": false + }, + "BoundingBoxTruth": { + "title": "BoundingBoxTruth", + "required": [ + "_t", + "xMax", + "xMin", + "yMax", + "yMin" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "BoundingBoxTruth" + ], + "type": "string", + "description": "Discriminator value for BoundingBoxTruth", + "example": "BoundingBoxTruth" + }, + "xMin": { + "type": "number", + "format": "double" + }, + "yMin": { + "type": "number", + "format": "double" + }, + "xMax": { + "type": "number", + "format": "double" + }, + "yMax": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + }, + "BoxShape": { + "title": "BoxShape", + "required": [ + "_t" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "BoxShape" + ], + "type": "string", + "description": "Discriminator value for BoxShape", + "example": "BoxShape" + }, + "xMin": { + "type": "number", + "format": "double", + "nullable": true + }, + "yMin": { + "type": "number", + "format": "double", + "nullable": true + }, + "xMax": { + "type": "number", + "format": "double", + "nullable": true + }, + "yMax": { + "type": "number", + "format": "double", + "nullable": true + } + }, + "additionalProperties": false + }, + "ClassifyPayload": { + "title": "ClassifyPayload", + "required": [ + "_t", + "possibleCategories", + "title" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "ClassifyPayload" + ], + "type": "string", + "description": "Discriminator value for ClassifyPayload", + "example": "ClassifyPayload" + }, + "possibleCategories": { + "type": "array", + "items": { + "type": "string" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ComparePayload": { + "title": "ComparePayload", + "required": [ + "_t", + "criteria" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "ComparePayload" + ], + "type": "string", + "description": "Discriminator value for ComparePayload", + "example": "ComparePayload" + }, + "criteria": { + "type": "string" + } + }, + "additionalProperties": false + }, + "CompareTruth": { + "title": "CompareTruth", + "required": [ + "_t", + "winnerId" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "CompareTruth" + ], + "type": "string", + "description": "Discriminator value for CompareTruth", + "example": "CompareTruth" + }, + "winnerId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "EmptyValidationTruth": { + "title": "EmptyValidationTruth", + "required": [ + "_t" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "EmptyValidationTruth" + ], + "type": "string", + "description": "Discriminator value for EmptyValidationTruth", + "example": "EmptyValidationTruth" + } + }, + "additionalProperties": false + }, + "FreeTextPayload": { + "title": "FreeTextPayload", + "required": [ + "_t", + "question" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "FreeTextPayload" + ], + "type": "string", + "description": "Discriminator value for FreeTextPayload", + "example": "FreeTextPayload" + }, + "question": { + "type": "string" + } + }, + "additionalProperties": false + }, + "LinePayload": { + "title": "LinePayload", + "required": [ + "_t", + "target" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "LinePayload" + ], + "type": "string", + "description": "Discriminator value for LinePayload", + "example": "LinePayload" + }, + "target": { + "type": "string" + } + }, + "additionalProperties": false + }, + "LineTruth": { + "title": "LineTruth", + "required": [ + "_t" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "LineTruth" + ], + "type": "string", + "description": "Discriminator value for LineTruth", + "example": "LineTruth" + } + }, + "additionalProperties": false + }, + "LocateBoxTruth": { + "title": "LocateBoxTruth", + "required": [ + "_t", + "boundingBoxes" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "LocateBoxTruth" + ], + "type": "string", + "description": "Discriminator value for LocateBoxTruth", + "example": "LocateBoxTruth" + }, + "boundingBoxes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BoxShape" + } + } + }, + "additionalProperties": false + }, + "LocatePayload": { + "title": "LocatePayload", + "required": [ + "_t", + "target" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "LocatePayload" + ], + "type": "string", + "description": "Discriminator value for LocatePayload", + "example": "LocatePayload" + }, + "target": { + "type": "string" + } + }, + "additionalProperties": false + }, + "NamedClassification": { + "title": "NamedClassification", + "required": [ + "_t", + "classification", + "end", + "start" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "NamedClassification" + ], + "type": "string", + "description": "Discriminator value for NamedClassification", + "example": "NamedClassification" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "classification": { + "type": "string" + } + }, + "additionalProperties": false + }, + "NamedEntityPayload": { + "title": "NamedEntityPayload", + "required": [ + "_t", + "classes", + "target" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "NamedEntityPayload" + ], + "type": "string", + "description": "Discriminator value for NamedEntityPayload", + "example": "NamedEntityPayload" + }, + "target": { + "type": "string" + }, + "classes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "NamedEntityTruth": { + "title": "NamedEntityTruth", + "required": [ + "_t", + "classifications" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "NamedEntityTruth" + ], + "type": "string", + "description": "Discriminator value for NamedEntityTruth", + "example": "NamedEntityTruth" + }, + "classifications": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NamedClassification" + } + } + }, + "additionalProperties": false + }, + "PolygonPayload": { + "title": "PolygonPayload", + "required": [ + "_t", + "target" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "PolygonPayload" + ], + "type": "string", + "description": "Discriminator value for PolygonPayload", + "example": "PolygonPayload" + }, + "target": { + "type": "string" + } + }, + "additionalProperties": false + }, + "PolygonTruth": { + "title": "PolygonTruth", + "required": [ + "_t" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "PolygonTruth" + ], + "type": "string", + "description": "Discriminator value for PolygonTruth", + "example": "PolygonTruth" + } + }, + "additionalProperties": false + }, + "QueryValidationSetModel": { + "type": "object", + "properties": { + "pageInfo": { + "$ref": "#/components/schemas/PageInfo" + }, + "filter": { + "$ref": "#/components/schemas/RootFilter" + }, + "sortCriteria": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SortCriterion" + }, + "default": null, + "nullable": true + } + }, + "additionalProperties": false + }, + "SubmitCocoModel": { + "required": [ + "categories", + "cocoSetId", + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "cocoSetId": { + "type": "string" + }, + "categories": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "TranscriptionPayload": { + "title": "TranscriptionPayload", + "required": [ + "_t", + "title", + "transcription" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "TranscriptionPayload" + ], + "type": "string", + "description": "Discriminator value for TranscriptionPayload", + "example": "TranscriptionPayload" + }, + "title": { + "type": "string" + }, + "transcription": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TranscriptionWord" + } + } + }, + "additionalProperties": false + }, + "TranscriptionTruth": { + "title": "TranscriptionTruth", + "required": [ + "_t", + "correctWords" + ], + "type": "object", + "properties": { + "_t": { + "enum": [ + "TranscriptionTruth" + ], + "type": "string", + "description": "Discriminator value for TranscriptionTruth", + "example": "TranscriptionTruth" + }, + "correctWords": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TranscriptionWord" + } + }, + "strictGrading": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "TranscriptionWord": { + "required": [ + "word", + "wordIndex" + ], + "type": "object", + "properties": { + "word": { + "type": "string" + }, + "wordIndex": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } }, "securitySchemes": { diff --git a/rapidata/rapidata_client/order/dataset/rapidata_dataset.py b/rapidata/rapidata_client/order/dataset/rapidata_dataset.py index 8cd25dc37..0631d0b09 100644 --- a/rapidata/rapidata_client/order/dataset/rapidata_dataset.py +++ b/rapidata/rapidata_client/order/dataset/rapidata_dataset.py @@ -21,6 +21,10 @@ def add_texts(self, texts: list[str]): self.openapi_service.dataset_api.dataset_upload_text_sources_to_dataset_post(model) def add_media_from_paths(self, image_paths: list[str]): - model = DatapointMetadataModel(datasetId=self.dataset_id, metadata=[]) - self.openapi_service.dataset_api.dataset_create_datapoint_post(model=model, files=image_paths) # type: ignore \ No newline at end of file + for image_path in image_paths: + if not os.path.exists(image_path): + raise FileNotFoundError(f"File not found: {image_path}") + model = DatapointMetadataModel(datasetId=self.dataset_id, metadata=[]) + + self.openapi_service.dataset_api.dataset_create_datapoint_post(model=model, files=[image_path]) # type: ignore \ No newline at end of file diff --git a/rapidata/rapidata_client/order/dataset/validation_dataset_builder.py b/rapidata/rapidata_client/order/dataset/validation_dataset_builder.py new file mode 100644 index 000000000..056447e9a --- /dev/null +++ b/rapidata/rapidata_client/order/dataset/validation_dataset_builder.py @@ -0,0 +1,65 @@ +from openapi_client.models.add_validation_rapid_model import AddValidationRapidModel +from openapi_client.models.add_validation_rapid_model_payload import ( + AddValidationRapidModelPayload, +) +from openapi_client.models.add_validation_rapid_model_truth import ( + AddValidationRapidModelTruth, +) +from openapi_client.models.attach_category_truth import AttachCategoryTruth +from openapi_client.models.classify_payload import ClassifyPayload +from rapidata.service.openapi_service import OpenAPIService + + +class ValidationDatasetBuilder: + + def __init__(self, name: str, openapi_service: OpenAPIService): + self.name = name + self.openapi_service = openapi_service + self.validationSetId: str | None = None + + def create(self): + result = ( + self.openapi_service.validation_api.validation_create_validation_set_post( + name=self.name + ) + ) + self.validationSetId = result.id + + def classify_rapid( + self, media_path: str, question: str, categories: list[str], truths: list[str] + ): + if self.validationSetId is None: + raise ValueError("ValidataionSet ID is not set. Call create() first.") + + model = { + "validationSetId": self.validationSetId, + "truth": {"_t": "AttachCategoryTruth", "correctCategories": truths}, + "metadata": [], + "randomCorrectProbability": len(truths) / len(categories), + "payload": { + "_t": "ClassifyPayload", + "title": question, + "possibleCategories": categories, + }, + } + + payload = ClassifyPayload( + _t="ClassifyPaylod", possibleCategories=categories, title=question + ) + model_truth = AttachCategoryTruth( + correctCategories=truths, _t="AttachCategoryTruth" + ) + + model = AddValidationRapidModel( + validationSetId=self.validationSetId, + payload=AddValidationRapidModelPayload(payload), + metadata=[], + randomCorrectProbability=len(truths) / len(categories), + truth=AddValidationRapidModelTruth(model_truth), + ) + + response = ( + self.openapi_service.validation_api.validation_add_validation_rapid_post( + model=model, files=[media_path] + ) + ) diff --git a/rapidata/rapidata_client/order/rapidata_order_builder.py b/rapidata/rapidata_client/order/rapidata_order_builder.py index ea3cc1d78..deb8a6b9d 100644 --- a/rapidata/rapidata_client/order/rapidata_order_builder.py +++ b/rapidata/rapidata_client/order/rapidata_order_builder.py @@ -24,8 +24,8 @@ class RapidataOrderBuilder: def __init__( self, - openapi_service: OpenAPIService, name: str, + openapi_service: OpenAPIService, ): self._name = name self._openapi_service = openapi_service diff --git a/rapidata/rapidata_client/rapidata_client.py b/rapidata/rapidata_client/rapidata_client.py index aee1eae4f..101506543 100644 --- a/rapidata/rapidata_client/rapidata_client.py +++ b/rapidata/rapidata_client/rapidata_client.py @@ -1,6 +1,7 @@ from openapi_client.api_client import ApiClient from openapi_client.configuration import Configuration from openapi_client.api.identity_api import IdentityApi +from rapidata.rapidata_client.order.dataset.validation_dataset_builder import ValidationDatasetBuilder from rapidata.rapidata_client.order.rapidata_order_builder import RapidataOrderBuilder from rapidata.service.openapi_service import OpenAPIService @@ -36,3 +37,13 @@ def new_order(self, name: str) -> RapidataOrderBuilder: :return: A RapidataOrderBuilder instance. """ return RapidataOrderBuilder(openapi_service=self.openapi_service, name=name) + + def new_validation_set(self, name: str) -> ValidationDatasetBuilder: + """ + Create a new validation set using a ValidationDatasetBuilder instance. + + :param name: The name of the validation set. + :return: A ValidationDatasetBuilder instance. + """ + return ValidationDatasetBuilder(name=name, openapi_service=self.openapi_service) + diff --git a/rapidata/service/openapi_service.py b/rapidata/service/openapi_service.py index 32970636b..00c96be52 100644 --- a/rapidata/service/openapi_service.py +++ b/rapidata/service/openapi_service.py @@ -1,6 +1,7 @@ from openapi_client.api.dataset_api import DatasetApi from openapi_client.api.identity_api import IdentityApi from openapi_client.api.order_api import OrderApi +from openapi_client.api.validation_api import ValidationApi from openapi_client.api_client import ApiClient from openapi_client.configuration import Configuration @@ -27,6 +28,7 @@ def __init__( self._api_client = ApiClient() self._order_api = OrderApi(self.api_client) self._dataset_api = DatasetApi(self.api_client) + self._validation_api = ValidationApi(self.api_client) @property def order_api(self) -> OrderApi: @@ -35,3 +37,7 @@ def order_api(self) -> OrderApi: @property def dataset_api(self) -> DatasetApi: return self._dataset_api + + @property + def validation_api(self) -> ValidationApi: + return self._validation_api