From c615648726ef085b938ffb2f207818991ca1c0f5 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Thu, 6 Nov 2025 15:02:18 +0530 Subject: [PATCH 1/3] SK-2353: update generated code with updated openapi spec file --- skyflow/generated/rest/__init__.py | 204 ++- skyflow/generated/rest/audit/client.py | 64 + skyflow/generated/rest/client.py | 16 +- skyflow/generated/rest/core/client_wrapper.py | 19 +- skyflow/generated/rest/files/__init__.py | 64 +- skyflow/generated/rest/files/client.py | 1492 +++++++++-------- skyflow/generated/rest/files/raw_client.py | 1395 +++++++-------- .../generated/rest/files/types/__init__.py | 84 +- ...identify_audio_request_file_data_format.py | 5 - ...tify_audio_request_output_transcription.py | 14 - ...ntify_document_request_file_data_format.py | 5 - ...uest_deidentify_audio_entity_types_item.py | 79 + ...t_deidentify_audio_output_transcription.py | 10 + ...equest_deidentify_pdf_entity_types_item.py | 79 + ...uest_deidentify_image_entity_types_item.py | 79 + ...request_deidentify_image_masking_method.py | 5 + ...t_deidentify_document_entity_types_item.py | 79 + ...identify_presentation_entity_types_item.py | 79 + ...eidentify_spreadsheet_entity_types_item.py | 79 + ...ntify_structured_text_entity_types_item.py | 79 + ...quest_deidentify_text_entity_types_item.py | 79 + ...identify_file_request_entity_types_item.py | 79 + ...identify_image_request_file_data_format.py | 7 - ...deidentify_image_request_masking_method.py | 5 - .../deidentify_presentation_request_file.py | 34 - ...y_presentation_request_file_data_format.py | 5 - ...fy_spreadsheet_request_file_data_format.py | 5 - ...deidentify_structured_text_request_file.py | 34 - ...tructured_text_request_file_data_format.py | 5 - .../types/reidentify_file_request_file.py | 34 - ...eidentify_file_request_file_data_format.py | 7 - skyflow/generated/rest/guardrails/client.py | 49 +- .../generated/rest/guardrails/raw_client.py | 45 +- skyflow/generated/rest/records/client.py | 20 + skyflow/generated/rest/strings/__init__.py | 4 +- skyflow/generated/rest/strings/client.py | 150 +- skyflow/generated/rest/strings/raw_client.py | 152 +- .../generated/rest/strings/types/__init__.py | 4 +- ...entify_string_request_entity_types_item.py | 79 + .../types/reidentify_string_request_format.py | 37 - skyflow/generated/rest/types/__init__.py | 136 +- skyflow/generated/rest/types/allow_regex.py | 5 - .../check_guardrails_response_validation.py | 5 - .../generated/rest/types/configuration_id.py | 3 - .../rest/types/deidentified_file_output.py | 46 + ...ed_file_output_processed_file_extension.py | 29 + ...tified_file_output_processed_file_type.py} | 13 +- .../rest/types/deidentify_file_response.py | 6 +- .../rest/types/deidentify_status_response.py | 74 - .../deidentify_status_response_output_type.py | 5 - .../deidentify_status_response_status.py | 5 - .../rest/types/deidentify_string_response.py | 10 +- ...ponse.py => detect_guardrails_response.py} | 20 +- .../detect_guardrails_response_validation.py | 5 + .../rest/types/detect_runs_response.py | 72 + .../types/detect_runs_response_output_type.py | 5 + .../rest/types/detect_runs_response_status.py | 5 + .../generated/rest/types/entity_location.py | 41 - skyflow/generated/rest/types/entity_types.py | 7 - .../rest/types/error_response_error.py | 13 +- skyflow/generated/rest/types/error_string.py | 3 - ...y_file_response_output.py => file_data.py} | 16 +- .../file_data_data_format.py} | 29 +- .../file_data_deidentify_audio.py} | 16 +- .../file_data_deidentify_audio_data_format.py | 5 + .../file_data_deidentify_document.py} | 16 +- ...le_data_deidentify_document_data_format.py | 5 + .../file_data_deidentify_image.py} | 16 +- .../file_data_deidentify_image_data_format.py | 5 + .../file_data_deidentify_pdf.py} | 12 +- .../file_data_deidentify_presentation.py | 34 + ...ata_deidentify_presentation_data_format.py | 5 + .../file_data_deidentify_spreadsheet.py} | 16 +- ...data_deidentify_spreadsheet_data_format.py | 5 + .../file_data_deidentify_structured_text.py} | 16 +- ..._deidentify_structured_text_data_format.py | 5 + .../file_data_deidentify_text.py} | 12 +- .../rest/types/file_data_reidentify_file.py | 34 + .../file_data_reidentify_file_data_format.py | 7 + .../format.py} | 14 +- .../{entity_type.py => format_masked_item.py} | 72 +- .../rest/types/format_plaintext_item.py | 79 + .../rest/types/format_redacted_item.py | 79 + .../rest/types/{vault_id.py => http_code.py} | 2 +- ...tring_response.py => identify_response.py} | 6 +- ..._output.py => reidentified_file_output.py} | 14 +- ...ed_file_output_processed_file_extension.py | 29 + .../rest/types/reidentify_file_response.py | 13 +- .../reidentify_file_response_output_type.py | 2 +- .../types/reidentify_file_response_status.py | 2 +- .../generated/rest/types/restrict_regex.py | 5 - ...rmations_shift_dates.py => shift_dates.py} | 14 +- .../types/shift_dates_entity_types_item.py | 5 + ..._entity.py => string_response_entities.py} | 8 +- skyflow/generated/rest/types/token_type.py | 39 - .../rest/types/token_type_default.py | 5 - .../rest/types/token_type_mapping.py | 47 + .../rest/types/token_type_mapping_default.py | 5 + .../token_type_mapping_entity_only_item.py | 79 + ...en_type_mapping_entity_unq_counter_item.py | 79 + .../token_type_mapping_vault_token_item.py | 79 + .../rest/types/token_type_without_vault.py | 34 - .../types/token_type_without_vault_default.py | 5 - .../generated/rest/types/transformations.py | 9 +- ...ormations_shift_dates_entity_types_item.py | 5 - .../rest/types/word_character_count.py | 37 + skyflow/generated/rest/version.py | 4 +- skyflow/utils/__init__.py | 2 +- skyflow/utils/_utils.py | 12 +- skyflow/utils/validations/_validations.py | 1 - skyflow/vault/controller/_detect.py | 59 +- tests/vault/controller/test__detect.py | 13 +- 112 files changed, 3912 insertions(+), 2472 deletions(-) delete mode 100644 skyflow/generated/rest/files/types/deidentify_audio_request_file_data_format.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_audio_request_output_transcription.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_document_request_file_data_format.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_output_transcription.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_masking_method.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_deidentify_document_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_deidentify_presentation_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_deidentify_spreadsheet_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_deidentify_structured_text_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_deidentify_text_entity_types_item.py create mode 100644 skyflow/generated/rest/files/types/deidentify_file_request_entity_types_item.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_image_request_file_data_format.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_presentation_request_file.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_presentation_request_file_data_format.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file_data_format.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_structured_text_request_file.py delete mode 100644 skyflow/generated/rest/files/types/deidentify_structured_text_request_file_data_format.py delete mode 100644 skyflow/generated/rest/files/types/reidentify_file_request_file.py delete mode 100644 skyflow/generated/rest/files/types/reidentify_file_request_file_data_format.py create mode 100644 skyflow/generated/rest/strings/types/deidentify_string_request_entity_types_item.py delete mode 100644 skyflow/generated/rest/strings/types/reidentify_string_request_format.py delete mode 100644 skyflow/generated/rest/types/allow_regex.py delete mode 100644 skyflow/generated/rest/types/check_guardrails_response_validation.py delete mode 100644 skyflow/generated/rest/types/configuration_id.py create mode 100644 skyflow/generated/rest/types/deidentified_file_output.py create mode 100644 skyflow/generated/rest/types/deidentified_file_output_processed_file_extension.py rename skyflow/generated/rest/types/{deidentify_file_output_processed_file_type.py => deidentified_file_output_processed_file_type.py} (55%) delete mode 100644 skyflow/generated/rest/types/deidentify_status_response.py delete mode 100644 skyflow/generated/rest/types/deidentify_status_response_output_type.py delete mode 100644 skyflow/generated/rest/types/deidentify_status_response_status.py rename skyflow/generated/rest/types/{check_guardrails_response.py => detect_guardrails_response.py} (52%) create mode 100644 skyflow/generated/rest/types/detect_guardrails_response_validation.py create mode 100644 skyflow/generated/rest/types/detect_runs_response.py create mode 100644 skyflow/generated/rest/types/detect_runs_response_output_type.py create mode 100644 skyflow/generated/rest/types/detect_runs_response_status.py delete mode 100644 skyflow/generated/rest/types/entity_location.py delete mode 100644 skyflow/generated/rest/types/entity_types.py delete mode 100644 skyflow/generated/rest/types/error_string.py rename skyflow/generated/rest/types/{reidentify_file_response_output.py => file_data.py} (53%) rename skyflow/generated/rest/{files/types/deidentify_file_request_file_data_format.py => types/file_data_data_format.py} (89%) rename skyflow/generated/rest/{files/types/deidentify_file_request_file.py => types/file_data_deidentify_audio.py} (53%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_audio_data_format.py rename skyflow/generated/rest/{files/types/deidentify_audio_request_file.py => types/file_data_deidentify_document.py} (54%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_document_data_format.py rename skyflow/generated/rest/{files/types/deidentify_image_request_file.py => types/file_data_deidentify_image.py} (53%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_image_data_format.py rename skyflow/generated/rest/{files/types/deidentify_pdf_request_file.py => types/file_data_deidentify_pdf.py} (66%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_presentation.py create mode 100644 skyflow/generated/rest/types/file_data_deidentify_presentation_data_format.py rename skyflow/generated/rest/{files/types/deidentify_document_request_file.py => types/file_data_deidentify_spreadsheet.py} (53%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_spreadsheet_data_format.py rename skyflow/generated/rest/{files/types/deidentify_spreadsheet_request_file.py => types/file_data_deidentify_structured_text.py} (53%) create mode 100644 skyflow/generated/rest/types/file_data_deidentify_structured_text_data_format.py rename skyflow/generated/rest/{files/types/deidentify_text_request_file.py => types/file_data_deidentify_text.py} (66%) create mode 100644 skyflow/generated/rest/types/file_data_reidentify_file.py create mode 100644 skyflow/generated/rest/types/file_data_reidentify_file_data_format.py rename skyflow/generated/rest/{files/types/reidentify_file_request_format.py => types/format.py} (58%) rename skyflow/generated/rest/types/{entity_type.py => format_masked_item.py} (98%) create mode 100644 skyflow/generated/rest/types/format_plaintext_item.py create mode 100644 skyflow/generated/rest/types/format_redacted_item.py rename skyflow/generated/rest/types/{vault_id.py => http_code.py} (81%) rename skyflow/generated/rest/types/{reidentify_string_response.py => identify_response.py} (78%) rename skyflow/generated/rest/types/{deidentify_file_output.py => reidentified_file_output.py} (56%) create mode 100644 skyflow/generated/rest/types/reidentified_file_output_processed_file_extension.py delete mode 100644 skyflow/generated/rest/types/restrict_regex.py rename skyflow/generated/rest/types/{transformations_shift_dates.py => shift_dates.py} (75%) create mode 100644 skyflow/generated/rest/types/shift_dates_entity_types_item.py rename skyflow/generated/rest/types/{detected_entity.py => string_response_entities.py} (82%) delete mode 100644 skyflow/generated/rest/types/token_type.py delete mode 100644 skyflow/generated/rest/types/token_type_default.py create mode 100644 skyflow/generated/rest/types/token_type_mapping.py create mode 100644 skyflow/generated/rest/types/token_type_mapping_default.py create mode 100644 skyflow/generated/rest/types/token_type_mapping_entity_only_item.py create mode 100644 skyflow/generated/rest/types/token_type_mapping_entity_unq_counter_item.py create mode 100644 skyflow/generated/rest/types/token_type_mapping_vault_token_item.py delete mode 100644 skyflow/generated/rest/types/token_type_without_vault.py delete mode 100644 skyflow/generated/rest/types/token_type_without_vault_default.py delete mode 100644 skyflow/generated/rest/types/transformations_shift_dates_entity_types_item.py create mode 100644 skyflow/generated/rest/types/word_character_count.py diff --git a/skyflow/generated/rest/__init__.py b/skyflow/generated/rest/__init__.py index 7eda9318..8a59c25d 100644 --- a/skyflow/generated/rest/__init__.py +++ b/skyflow/generated/rest/__init__.py @@ -3,49 +3,69 @@ # isort: skip_file from .types import ( - AllowRegex, AuditEventAuditResourceType, AuditEventContext, AuditEventData, AuditEventHttpInfo, BatchRecordMethod, - CheckGuardrailsResponse, - CheckGuardrailsResponseValidation, - ConfigurationId, ContextAccessType, ContextAuthMode, - DeidentifyFileOutput, - DeidentifyFileOutputProcessedFileType, + DeidentifiedFileOutput, + DeidentifiedFileOutputProcessedFileExtension, + DeidentifiedFileOutputProcessedFileType, DeidentifyFileResponse, - DeidentifyStatusResponse, - DeidentifyStatusResponseOutputType, - DeidentifyStatusResponseStatus, DeidentifyStringResponse, - DetectedEntity, + DetectGuardrailsResponse, + DetectGuardrailsResponseValidation, + DetectRunsResponse, + DetectRunsResponseOutputType, + DetectRunsResponseStatus, DetokenizeRecordResponseValueType, - EntityLocation, - EntityType, - EntityTypes, ErrorResponse, ErrorResponseError, - ErrorString, + FileData, + FileDataDataFormat, + FileDataDeidentifyAudio, + FileDataDeidentifyAudioDataFormat, + FileDataDeidentifyDocument, + FileDataDeidentifyDocumentDataFormat, + FileDataDeidentifyImage, + FileDataDeidentifyImageDataFormat, + FileDataDeidentifyPdf, + FileDataDeidentifyPresentation, + FileDataDeidentifyPresentationDataFormat, + FileDataDeidentifySpreadsheet, + FileDataDeidentifySpreadsheetDataFormat, + FileDataDeidentifyStructuredText, + FileDataDeidentifyStructuredTextDataFormat, + FileDataDeidentifyText, + FileDataReidentifyFile, + FileDataReidentifyFileDataFormat, + Format, + FormatMaskedItem, + FormatPlaintextItem, + FormatRedactedItem, GooglerpcStatus, + HttpCode, + IdentifyResponse, ProtobufAny, RedactionEnumRedaction, + ReidentifiedFileOutput, + ReidentifiedFileOutputProcessedFileExtension, ReidentifyFileResponse, - ReidentifyFileResponseOutput, + ReidentifyFileResponseOutputType, ReidentifyFileResponseStatus, - ReidentifyStringResponse, RequestActionType, ResourceId, - RestrictRegex, - TokenType, - TokenTypeDefault, - TokenTypeWithoutVault, - TokenTypeWithoutVaultDefault, + ShiftDates, + ShiftDatesEntityTypesItem, + StringResponseEntities, + TokenTypeMapping, + TokenTypeMappingDefault, + TokenTypeMappingEntityOnlyItem, + TokenTypeMappingEntityUnqCounterItem, + TokenTypeMappingVaultTokenItem, Transformations, - TransformationsShiftDates, - TransformationsShiftDatesEntityTypesItem, UploadFileV2Response, Uuid, V1AuditAfterOptions, @@ -79,7 +99,7 @@ V1UpdateRecordResponse, V1VaultFieldMapping, V1VaultSchemaConfig, - VaultId, + WordCharacterCount, ) from .errors import BadRequestError, InternalServerError, NotFoundError, UnauthorizedError from . import audit, authentication, bin_lookup, files, guardrails, query, records, strings, tokens @@ -94,38 +114,27 @@ from .client import AsyncSkyflow, Skyflow from .environment import SkyflowEnvironment from .files import ( - DeidentifyAudioRequestFile, - DeidentifyAudioRequestFileDataFormat, - DeidentifyAudioRequestOutputTranscription, - DeidentifyDocumentRequestFile, - DeidentifyDocumentRequestFileDataFormat, - DeidentifyFileRequestFile, - DeidentifyFileRequestFileDataFormat, - DeidentifyImageRequestFile, - DeidentifyImageRequestFileDataFormat, - DeidentifyImageRequestMaskingMethod, - DeidentifyPdfRequestFile, - DeidentifyPresentationRequestFile, - DeidentifyPresentationRequestFileDataFormat, - DeidentifySpreadsheetRequestFile, - DeidentifySpreadsheetRequestFileDataFormat, - DeidentifyStructuredTextRequestFile, - DeidentifyStructuredTextRequestFileDataFormat, - DeidentifyTextRequestFile, - ReidentifyFileRequestFile, - ReidentifyFileRequestFileDataFormat, - ReidentifyFileRequestFormat, + DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, + DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, + DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, + DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, + DeidentifyFileImageRequestDeidentifyImageMaskingMethod, + DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, + DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, + DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, + DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, + DeidentifyFileRequestDeidentifyTextEntityTypesItem, + DeidentifyFileRequestEntityTypesItem, ) from .records import ( RecordServiceBulkGetRecordRequestOrderBy, RecordServiceBulkGetRecordRequestRedaction, RecordServiceGetRecordRequestRedaction, ) -from .strings import ReidentifyStringRequestFormat +from .strings import DeidentifyStringRequestEntityTypesItem from .version import __version__ __all__ = [ - "AllowRegex", "AsyncSkyflow", "AuditEventAuditResourceType", "AuditEventContext", @@ -139,45 +148,58 @@ "AuditServiceListAuditEventsRequestSortOpsOrderBy", "BadRequestError", "BatchRecordMethod", - "CheckGuardrailsResponse", - "CheckGuardrailsResponseValidation", - "ConfigurationId", "ContextAccessType", "ContextAuthMode", - "DeidentifyAudioRequestFile", - "DeidentifyAudioRequestFileDataFormat", - "DeidentifyAudioRequestOutputTranscription", - "DeidentifyDocumentRequestFile", - "DeidentifyDocumentRequestFileDataFormat", - "DeidentifyFileOutput", - "DeidentifyFileOutputProcessedFileType", - "DeidentifyFileRequestFile", - "DeidentifyFileRequestFileDataFormat", + "DeidentifiedFileOutput", + "DeidentifiedFileOutputProcessedFileExtension", + "DeidentifiedFileOutputProcessedFileType", + "DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem", + "DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription", + "DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageMaskingMethod", + "DeidentifyFileRequestDeidentifyDocumentEntityTypesItem", + "DeidentifyFileRequestDeidentifyPresentationEntityTypesItem", + "DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem", + "DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem", + "DeidentifyFileRequestDeidentifyTextEntityTypesItem", + "DeidentifyFileRequestEntityTypesItem", "DeidentifyFileResponse", - "DeidentifyImageRequestFile", - "DeidentifyImageRequestFileDataFormat", - "DeidentifyImageRequestMaskingMethod", - "DeidentifyPdfRequestFile", - "DeidentifyPresentationRequestFile", - "DeidentifyPresentationRequestFileDataFormat", - "DeidentifySpreadsheetRequestFile", - "DeidentifySpreadsheetRequestFileDataFormat", - "DeidentifyStatusResponse", - "DeidentifyStatusResponseOutputType", - "DeidentifyStatusResponseStatus", + "DeidentifyStringRequestEntityTypesItem", "DeidentifyStringResponse", - "DeidentifyStructuredTextRequestFile", - "DeidentifyStructuredTextRequestFileDataFormat", - "DeidentifyTextRequestFile", - "DetectedEntity", + "DetectGuardrailsResponse", + "DetectGuardrailsResponseValidation", + "DetectRunsResponse", + "DetectRunsResponseOutputType", + "DetectRunsResponseStatus", "DetokenizeRecordResponseValueType", - "EntityLocation", - "EntityType", - "EntityTypes", "ErrorResponse", "ErrorResponseError", - "ErrorString", + "FileData", + "FileDataDataFormat", + "FileDataDeidentifyAudio", + "FileDataDeidentifyAudioDataFormat", + "FileDataDeidentifyDocument", + "FileDataDeidentifyDocumentDataFormat", + "FileDataDeidentifyImage", + "FileDataDeidentifyImageDataFormat", + "FileDataDeidentifyPdf", + "FileDataDeidentifyPresentation", + "FileDataDeidentifyPresentationDataFormat", + "FileDataDeidentifySpreadsheet", + "FileDataDeidentifySpreadsheetDataFormat", + "FileDataDeidentifyStructuredText", + "FileDataDeidentifyStructuredTextDataFormat", + "FileDataDeidentifyText", + "FileDataReidentifyFile", + "FileDataReidentifyFileDataFormat", + "Format", + "FormatMaskedItem", + "FormatPlaintextItem", + "FormatRedactedItem", "GooglerpcStatus", + "HttpCode", + "IdentifyResponse", "InternalServerError", "NotFoundError", "ProtobufAny", @@ -185,26 +207,24 @@ "RecordServiceBulkGetRecordRequestRedaction", "RecordServiceGetRecordRequestRedaction", "RedactionEnumRedaction", - "ReidentifyFileRequestFile", - "ReidentifyFileRequestFileDataFormat", - "ReidentifyFileRequestFormat", + "ReidentifiedFileOutput", + "ReidentifiedFileOutputProcessedFileExtension", "ReidentifyFileResponse", - "ReidentifyFileResponseOutput", + "ReidentifyFileResponseOutputType", "ReidentifyFileResponseStatus", - "ReidentifyStringRequestFormat", - "ReidentifyStringResponse", "RequestActionType", "ResourceId", - "RestrictRegex", + "ShiftDates", + "ShiftDatesEntityTypesItem", "Skyflow", "SkyflowEnvironment", - "TokenType", - "TokenTypeDefault", - "TokenTypeWithoutVault", - "TokenTypeWithoutVaultDefault", + "StringResponseEntities", + "TokenTypeMapping", + "TokenTypeMappingDefault", + "TokenTypeMappingEntityOnlyItem", + "TokenTypeMappingEntityUnqCounterItem", + "TokenTypeMappingVaultTokenItem", "Transformations", - "TransformationsShiftDates", - "TransformationsShiftDatesEntityTypesItem", "UnauthorizedError", "UploadFileV2Response", "Uuid", @@ -239,7 +259,7 @@ "V1UpdateRecordResponse", "V1VaultFieldMapping", "V1VaultSchemaConfig", - "VaultId", + "WordCharacterCount", "__version__", "audit", "authentication", diff --git a/skyflow/generated/rest/audit/client.py b/skyflow/generated/rest/audit/client.py index 34d589d1..6f1d1039 100644 --- a/skyflow/generated/rest/audit/client.py +++ b/skyflow/generated/rest/audit/client.py @@ -205,7 +205,39 @@ def audit_service_list_audit_events( token="YOUR_TOKEN", ) client.audit.audit_service_list_audit_events( + filter_ops_context_change_id="filterOps.context.changeID", + filter_ops_context_request_id="filterOps.context.requestID", + filter_ops_context_trace_id="filterOps.context.traceID", + filter_ops_context_session_id="filterOps.context.sessionID", + filter_ops_context_actor="filterOps.context.actor", + filter_ops_context_actor_type="NONE", + filter_ops_context_access_type="ACCESS_NONE", + filter_ops_context_ip_address="filterOps.context.ipAddress", + filter_ops_context_origin="filterOps.context.origin", + filter_ops_context_auth_mode="AUTH_NONE", + filter_ops_context_jwt_id="filterOps.context.jwtID", + filter_ops_context_bearer_token_context_id="filterOps.context.bearerTokenContextID", + filter_ops_parent_account_id="filterOps.parentAccountID", filter_ops_account_id="filterOps.accountID", + filter_ops_workspace_id="filterOps.workspaceID", + filter_ops_vault_id="filterOps.vaultID", + filter_ops_resource_i_ds="filterOps.resourceIDs", + filter_ops_action_type="NONE", + filter_ops_resource_type="NONE_API", + filter_ops_tags="filterOps.tags", + filter_ops_response_code=1, + filter_ops_start_time="filterOps.startTime", + filter_ops_end_time="filterOps.endTime", + filter_ops_api_name="filterOps.apiName", + filter_ops_response_message="filterOps.responseMessage", + filter_ops_http_method="filterOps.httpMethod", + filter_ops_http_uri="filterOps.httpURI", + sort_ops_sort_by="sortOps.sortBy", + sort_ops_order_by="ASCENDING", + after_ops_timestamp="afterOps.timestamp", + after_ops_change_id="afterOps.changeID", + limit=1000000, + offset=1000000, ) """ _response = self._raw_client.audit_service_list_audit_events( @@ -431,7 +463,39 @@ async def audit_service_list_audit_events( async def main() -> None: await client.audit.audit_service_list_audit_events( + filter_ops_context_change_id="filterOps.context.changeID", + filter_ops_context_request_id="filterOps.context.requestID", + filter_ops_context_trace_id="filterOps.context.traceID", + filter_ops_context_session_id="filterOps.context.sessionID", + filter_ops_context_actor="filterOps.context.actor", + filter_ops_context_actor_type="NONE", + filter_ops_context_access_type="ACCESS_NONE", + filter_ops_context_ip_address="filterOps.context.ipAddress", + filter_ops_context_origin="filterOps.context.origin", + filter_ops_context_auth_mode="AUTH_NONE", + filter_ops_context_jwt_id="filterOps.context.jwtID", + filter_ops_context_bearer_token_context_id="filterOps.context.bearerTokenContextID", + filter_ops_parent_account_id="filterOps.parentAccountID", filter_ops_account_id="filterOps.accountID", + filter_ops_workspace_id="filterOps.workspaceID", + filter_ops_vault_id="filterOps.vaultID", + filter_ops_resource_i_ds="filterOps.resourceIDs", + filter_ops_action_type="NONE", + filter_ops_resource_type="NONE_API", + filter_ops_tags="filterOps.tags", + filter_ops_response_code=1, + filter_ops_start_time="filterOps.startTime", + filter_ops_end_time="filterOps.endTime", + filter_ops_api_name="filterOps.apiName", + filter_ops_response_message="filterOps.responseMessage", + filter_ops_http_method="filterOps.httpMethod", + filter_ops_http_uri="filterOps.httpURI", + sort_ops_sort_by="sortOps.sortBy", + sort_ops_order_by="ASCENDING", + after_ops_timestamp="afterOps.timestamp", + after_ops_change_id="afterOps.changeID", + limit=1000000, + offset=1000000, ) diff --git a/skyflow/generated/rest/client.py b/skyflow/generated/rest/client.py index e111c0b2..e8abdf54 100644 --- a/skyflow/generated/rest/client.py +++ b/skyflow/generated/rest/client.py @@ -34,7 +34,7 @@ class Skyflow: - token : typing.Union[str, typing.Callable[[], str]] + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] headers : typing.Optional[typing.Dict[str, str]] Additional headers to send with every request. @@ -61,7 +61,7 @@ def __init__( *, base_url: typing.Optional[str] = None, environment: SkyflowEnvironment = SkyflowEnvironment.PRODUCTION, - token: typing.Union[str, typing.Callable[[], str]], + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -87,9 +87,9 @@ def __init__( self.tokens = TokensClient(client_wrapper=self._client_wrapper) self.query = QueryClient(client_wrapper=self._client_wrapper) self.authentication = AuthenticationClient(client_wrapper=self._client_wrapper) - self.guardrails = GuardrailsClient(client_wrapper=self._client_wrapper) - self.strings = StringsClient(client_wrapper=self._client_wrapper) self.files = FilesClient(client_wrapper=self._client_wrapper) + self.strings = StringsClient(client_wrapper=self._client_wrapper) + self.guardrails = GuardrailsClient(client_wrapper=self._client_wrapper) class AsyncSkyflow: @@ -110,7 +110,7 @@ class AsyncSkyflow: - token : typing.Union[str, typing.Callable[[], str]] + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] headers : typing.Optional[typing.Dict[str, str]] Additional headers to send with every request. @@ -137,7 +137,7 @@ def __init__( *, base_url: typing.Optional[str] = None, environment: SkyflowEnvironment = SkyflowEnvironment.PRODUCTION, - token: typing.Union[str, typing.Callable[[], str]], + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -163,9 +163,9 @@ def __init__( self.tokens = AsyncTokensClient(client_wrapper=self._client_wrapper) self.query = AsyncQueryClient(client_wrapper=self._client_wrapper) self.authentication = AsyncAuthenticationClient(client_wrapper=self._client_wrapper) - self.guardrails = AsyncGuardrailsClient(client_wrapper=self._client_wrapper) - self.strings = AsyncStringsClient(client_wrapper=self._client_wrapper) self.files = AsyncFilesClient(client_wrapper=self._client_wrapper) + self.strings = AsyncStringsClient(client_wrapper=self._client_wrapper) + self.guardrails = AsyncGuardrailsClient(client_wrapper=self._client_wrapper) def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyflowEnvironment) -> str: diff --git a/skyflow/generated/rest/core/client_wrapper.py b/skyflow/generated/rest/core/client_wrapper.py index a3210a7e..355d775e 100644 --- a/skyflow/generated/rest/core/client_wrapper.py +++ b/skyflow/generated/rest/core/client_wrapper.py @@ -10,7 +10,7 @@ class BaseClientWrapper: def __init__( self, *, - token: typing.Union[str, typing.Callable[[], str]], + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -22,16 +22,19 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { + "User-Agent": "skyflow/1.16.1", "X-Fern-Language": "Python", - "X-Fern-SDK-Name": "skyflow_vault", - "X-Fern-SDK-Version": "0.0.252", + "X-Fern-SDK-Name": "skyflow", + "X-Fern-SDK-Version": "1.16.1", **(self.get_custom_headers() or {}), } - headers["Authorization"] = f"Bearer {self._get_token()}" + token = self._get_token() + if token is not None: + headers["Authorization"] = f"Bearer {token}" return headers - def _get_token(self) -> str: - if isinstance(self._token, str): + def _get_token(self) -> typing.Optional[str]: + if isinstance(self._token, str) or self._token is None: return self._token else: return self._token() @@ -50,7 +53,7 @@ class SyncClientWrapper(BaseClientWrapper): def __init__( self, *, - token: typing.Union[str, typing.Callable[[], str]], + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -69,7 +72,7 @@ class AsyncClientWrapper(BaseClientWrapper): def __init__( self, *, - token: typing.Union[str, typing.Callable[[], str]], + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, diff --git a/skyflow/generated/rest/files/__init__.py b/skyflow/generated/rest/files/__init__.py index b1679867..f313ad67 100644 --- a/skyflow/generated/rest/files/__init__.py +++ b/skyflow/generated/rest/files/__init__.py @@ -3,49 +3,29 @@ # isort: skip_file from .types import ( - DeidentifyAudioRequestFile, - DeidentifyAudioRequestFileDataFormat, - DeidentifyAudioRequestOutputTranscription, - DeidentifyDocumentRequestFile, - DeidentifyDocumentRequestFileDataFormat, - DeidentifyFileRequestFile, - DeidentifyFileRequestFileDataFormat, - DeidentifyImageRequestFile, - DeidentifyImageRequestFileDataFormat, - DeidentifyImageRequestMaskingMethod, - DeidentifyPdfRequestFile, - DeidentifyPresentationRequestFile, - DeidentifyPresentationRequestFileDataFormat, - DeidentifySpreadsheetRequestFile, - DeidentifySpreadsheetRequestFileDataFormat, - DeidentifyStructuredTextRequestFile, - DeidentifyStructuredTextRequestFileDataFormat, - DeidentifyTextRequestFile, - ReidentifyFileRequestFile, - ReidentifyFileRequestFileDataFormat, - ReidentifyFileRequestFormat, + DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, + DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, + DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, + DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, + DeidentifyFileImageRequestDeidentifyImageMaskingMethod, + DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, + DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, + DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, + DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, + DeidentifyFileRequestDeidentifyTextEntityTypesItem, + DeidentifyFileRequestEntityTypesItem, ) __all__ = [ - "DeidentifyAudioRequestFile", - "DeidentifyAudioRequestFileDataFormat", - "DeidentifyAudioRequestOutputTranscription", - "DeidentifyDocumentRequestFile", - "DeidentifyDocumentRequestFileDataFormat", - "DeidentifyFileRequestFile", - "DeidentifyFileRequestFileDataFormat", - "DeidentifyImageRequestFile", - "DeidentifyImageRequestFileDataFormat", - "DeidentifyImageRequestMaskingMethod", - "DeidentifyPdfRequestFile", - "DeidentifyPresentationRequestFile", - "DeidentifyPresentationRequestFileDataFormat", - "DeidentifySpreadsheetRequestFile", - "DeidentifySpreadsheetRequestFileDataFormat", - "DeidentifyStructuredTextRequestFile", - "DeidentifyStructuredTextRequestFileDataFormat", - "DeidentifyTextRequestFile", - "ReidentifyFileRequestFile", - "ReidentifyFileRequestFileDataFormat", - "ReidentifyFileRequestFormat", + "DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem", + "DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription", + "DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageMaskingMethod", + "DeidentifyFileRequestDeidentifyDocumentEntityTypesItem", + "DeidentifyFileRequestDeidentifyPresentationEntityTypesItem", + "DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem", + "DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem", + "DeidentifyFileRequestDeidentifyTextEntityTypesItem", + "DeidentifyFileRequestEntityTypesItem", ] diff --git a/skyflow/generated/rest/files/client.py b/skyflow/generated/rest/files/client.py index 4d5d548b..539d2161 100644 --- a/skyflow/generated/rest/files/client.py +++ b/skyflow/generated/rest/files/client.py @@ -4,32 +4,54 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions -from ..types.allow_regex import AllowRegex -from ..types.configuration_id import ConfigurationId from ..types.deidentify_file_response import DeidentifyFileResponse -from ..types.deidentify_status_response import DeidentifyStatusResponse -from ..types.entity_types import EntityTypes +from ..types.detect_runs_response import DetectRunsResponse +from ..types.file_data import FileData +from ..types.file_data_deidentify_audio import FileDataDeidentifyAudio +from ..types.file_data_deidentify_document import FileDataDeidentifyDocument +from ..types.file_data_deidentify_image import FileDataDeidentifyImage +from ..types.file_data_deidentify_pdf import FileDataDeidentifyPdf +from ..types.file_data_deidentify_presentation import FileDataDeidentifyPresentation +from ..types.file_data_deidentify_spreadsheet import FileDataDeidentifySpreadsheet +from ..types.file_data_deidentify_structured_text import FileDataDeidentifyStructuredText +from ..types.file_data_deidentify_text import FileDataDeidentifyText +from ..types.file_data_reidentify_file import FileDataReidentifyFile +from ..types.format import Format from ..types.reidentify_file_response import ReidentifyFileResponse -from ..types.resource_id import ResourceId -from ..types.restrict_regex import RestrictRegex -from ..types.token_type_without_vault import TokenTypeWithoutVault +from ..types.token_type_mapping import TokenTypeMapping from ..types.transformations import Transformations -from ..types.uuid_ import Uuid -from ..types.vault_id import VaultId from .raw_client import AsyncRawFilesClient, RawFilesClient -from .types.deidentify_audio_request_file import DeidentifyAudioRequestFile -from .types.deidentify_audio_request_output_transcription import DeidentifyAudioRequestOutputTranscription -from .types.deidentify_document_request_file import DeidentifyDocumentRequestFile -from .types.deidentify_file_request_file import DeidentifyFileRequestFile -from .types.deidentify_image_request_file import DeidentifyImageRequestFile -from .types.deidentify_image_request_masking_method import DeidentifyImageRequestMaskingMethod -from .types.deidentify_pdf_request_file import DeidentifyPdfRequestFile -from .types.deidentify_presentation_request_file import DeidentifyPresentationRequestFile -from .types.deidentify_spreadsheet_request_file import DeidentifySpreadsheetRequestFile -from .types.deidentify_structured_text_request_file import DeidentifyStructuredTextRequestFile -from .types.deidentify_text_request_file import DeidentifyTextRequestFile -from .types.reidentify_file_request_file import ReidentifyFileRequestFile -from .types.reidentify_file_request_format import ReidentifyFileRequestFormat +from .types.deidentify_file_audio_request_deidentify_audio_entity_types_item import ( + DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, +) +from .types.deidentify_file_audio_request_deidentify_audio_output_transcription import ( + DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, +) +from .types.deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item import ( + DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, +) +from .types.deidentify_file_image_request_deidentify_image_entity_types_item import ( + DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, +) +from .types.deidentify_file_image_request_deidentify_image_masking_method import ( + DeidentifyFileImageRequestDeidentifyImageMaskingMethod, +) +from .types.deidentify_file_request_deidentify_document_entity_types_item import ( + DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_presentation_entity_types_item import ( + DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_spreadsheet_entity_types_item import ( + DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_structured_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyTextEntityTypesItem, +) +from .types.deidentify_file_request_entity_types_item import DeidentifyFileRequestEntityTypesItem # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -53,14 +75,14 @@ def with_raw_response(self) -> RawFilesClient: def deidentify_file( self, *, - vault_id: VaultId, - file: DeidentifyFileRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileData, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ @@ -68,439 +90,492 @@ def deidentify_file( Parameters ---------- - vault_id : VaultId + file : FileData - file : DeidentifyFileRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyFileRequestFile + from skyflow import FileData, Skyflow client = Skyflow( token="YOUR_TOKEN", ) client.files.deidentify_file( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyFileRequestFile( - base_64="Zm9vYmFy", - data_format="txt", + file=FileData( + base_64="base64", + data_format="mp3", ), + vault_id="vault_id", ) """ _response = self._raw_client.deidentify_file( - vault_id=vault_id, file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_document( + def deidentify_audio( self, *, - vault_id: VaultId, - file: DeidentifyDocumentRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyAudio, + vault_id: str, + output_transcription: typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] = OMIT, + output_processed_audio: typing.Optional[bool] = OMIT, + bleep_start_padding: typing.Optional[float] = OMIT, + bleep_stop_padding: typing.Optional[float] = OMIT, + bleep_frequency: typing.Optional[int] = OMIT, + bleep_gain: typing.Optional[int] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. + De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyAudio - file : DeidentifyDocumentRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + output_transcription : typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] + Type of transcription to output. - entity_types : typing.Optional[EntityTypes] + output_processed_audio : typing.Optional[bool] + Whether to include the processed audio file in the response. - token_type : typing.Optional[TokenTypeWithoutVault] + bleep_start_padding : typing.Optional[float] + Padding added to the beginning of a bleep, in seconds. - allow_regex : typing.Optional[AllowRegex] + bleep_stop_padding : typing.Optional[float] + Padding added to the end of a bleep, in seconds. - restrict_regex : typing.Optional[RestrictRegex] + bleep_frequency : typing.Optional[int] + The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. + + bleep_gain : typing.Optional[int] + Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. + + entity_types : typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] + Entities to detect and de-identify. + + token_type : typing.Optional[TokenTypeMapping] + + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. + + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyDocumentRequestFile + from skyflow import FileDataDeidentifyAudio, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_document( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyDocumentRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="docx", + client.files.deidentify_audio( + file=FileDataDeidentifyAudio( + base_64="base64", + data_format="mp3", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_document( - vault_id=vault_id, + _response = self._raw_client.deidentify_audio( file=file, - configuration_id=configuration_id, + vault_id=vault_id, + output_transcription=output_transcription, + output_processed_audio=output_processed_audio, + bleep_start_padding=bleep_start_padding, + bleep_stop_padding=bleep_stop_padding, + bleep_frequency=bleep_frequency, + bleep_gain=bleep_gain, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_pdf( + def deidentify_document( self, *, - vault_id: VaultId, - file: DeidentifyPdfRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - density: typing.Optional[float] = OMIT, - max_resolution: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyDocument, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. + De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyDocument - file : DeidentifyPdfRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] + Entities to detect and de-identify. - density : typing.Optional[float] - Pixel density at which to process the PDF file. + token_type : typing.Optional[TokenTypeMapping] - max_resolution : typing.Optional[float] - Max resolution at which to process the PDF file. + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - entity_types : typing.Optional[EntityTypes] - - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyPdfRequestFile + from skyflow import FileDataDeidentifyDocument, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_pdf( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyPdfRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", + client.files.deidentify_document( + file=FileDataDeidentifyDocument( + base_64="base64", + data_format="pdf", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_pdf( - vault_id=vault_id, + _response = self._raw_client.deidentify_document( file=file, - configuration_id=configuration_id, - density=density, - max_resolution=max_resolution, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_image( + def deidentify_pdf( self, *, - vault_id: VaultId, - file: DeidentifyImageRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_image: typing.Optional[bool] = OMIT, - output_ocr_text: typing.Optional[bool] = OMIT, - masking_method: typing.Optional[DeidentifyImageRequestMaskingMethod] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPdf, + vault_id: str, + density: typing.Optional[int] = OMIT, + max_resolution: typing.Optional[int] = OMIT, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyImageRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyPdf - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - output_processed_image : typing.Optional[bool] - If `true`, includes processed image in the output. - - output_ocr_text : typing.Optional[bool] - If `true`, includes OCR text output in the response. + density : typing.Optional[int] + Pixel density at which to process the PDF file. - masking_method : typing.Optional[DeidentifyImageRequestMaskingMethod] - Method to mask the entities in the image. + max_resolution : typing.Optional[int] + Max resolution at which to process the PDF file. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyImageRequestFile + from skyflow import FileDataDeidentifyPdf, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_image( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyImageRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="jpg", + client.files.deidentify_pdf( + file=FileDataDeidentifyPdf( + base_64="base64", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_image( - vault_id=vault_id, + _response = self._raw_client.deidentify_pdf( file=file, - configuration_id=configuration_id, - output_processed_image=output_processed_image, - output_ocr_text=output_ocr_text, - masking_method=masking_method, + vault_id=vault_id, + density=density, + max_resolution=max_resolution, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_text( + def deidentify_image( self, *, - vault_id: VaultId, - file: DeidentifyTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyImage, + vault_id: str, + output_processed_image: typing.Optional[bool] = OMIT, + output_ocr_text: typing.Optional[bool] = OMIT, + masking_method: typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. + De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyImage - file : DeidentifyTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + output_processed_image : typing.Optional[bool] + If `true`, includes processed image in the output. + + output_ocr_text : typing.Optional[bool] + If `true`, includes text detected by OCR in the response. - entity_types : typing.Optional[EntityTypes] + masking_method : typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] + Method to mask the entities in the image. + + entity_types : typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyTextRequestFile + from skyflow import FileDataDeidentifyImage, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_text( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyTextRequestFile( - base_64="Zm9vYmFy", + client.files.deidentify_image( + file=FileDataDeidentifyImage( + base_64="base64", + data_format="jpg", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_text( - vault_id=vault_id, + _response = self._raw_client.deidentify_image( file=file, - configuration_id=configuration_id, + vault_id=vault_id, + output_processed_image=output_processed_image, + output_ocr_text=output_ocr_text, + masking_method=masking_method, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_structured_text( + def deidentify_presentation( self, *, - vault_id: VaultId, - file: DeidentifyStructuredTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPresentation, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPresentation - file : DeidentifyStructuredTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyStructuredTextRequestFile + from skyflow import FileDataDeidentifyPresentation, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_structured_text( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyStructuredTextRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="json", + client.files.deidentify_presentation( + file=FileDataDeidentifyPresentation( + base_64="base64", + data_format="ppt", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_structured_text( - vault_id=vault_id, + _response = self._raw_client.deidentify_presentation( file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data @@ -508,14 +583,16 @@ def deidentify_structured_text( def deidentify_spreadsheet( self, *, - vault_id: VaultId, - file: DeidentifySpreadsheetRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifySpreadsheet, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ @@ -523,319 +600,299 @@ def deidentify_spreadsheet( Parameters ---------- - vault_id : VaultId - - file : DeidentifySpreadsheetRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifySpreadsheet - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifySpreadsheetRequestFile + from skyflow import FileDataDeidentifySpreadsheet, Skyflow client = Skyflow( token="YOUR_TOKEN", ) client.files.deidentify_spreadsheet( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifySpreadsheetRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", + file=FileDataDeidentifySpreadsheet( + base_64="base64", data_format="csv", ), + vault_id="vault_id", ) """ _response = self._raw_client.deidentify_spreadsheet( - vault_id=vault_id, file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_presentation( + def deidentify_structured_text( self, *, - vault_id: VaultId, - file: DeidentifyPresentationRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyStructuredText, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyStructuredText - file : DeidentifyPresentationRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyPresentationRequestFile + from skyflow import FileDataDeidentifyStructuredText, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_presentation( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyPresentationRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="pptx", + client.files.deidentify_structured_text( + file=FileDataDeidentifyStructuredText( + base_64="base64", + data_format="json", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_presentation( - vault_id=vault_id, + _response = self._raw_client.deidentify_structured_text( file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def deidentify_audio( + def deidentify_text( self, *, - vault_id: VaultId, - file: DeidentifyAudioRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_audio: typing.Optional[bool] = OMIT, - output_transcription: typing.Optional[DeidentifyAudioRequestOutputTranscription] = OMIT, - bleep_gain: typing.Optional[float] = OMIT, - bleep_frequency: typing.Optional[float] = OMIT, - bleep_start_padding: typing.Optional[float] = OMIT, - bleep_stop_padding: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyText, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyText - file : DeidentifyAudioRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] + Entities to detect and de-identify. - output_processed_audio : typing.Optional[bool] - If `true`, includes processed audio file in the response. + token_type : typing.Optional[TokenTypeMapping] - output_transcription : typing.Optional[DeidentifyAudioRequestOutputTranscription] - Type of transcription to output. + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - bleep_gain : typing.Optional[float] - Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - - bleep_frequency : typing.Optional[float] - The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - - bleep_start_padding : typing.Optional[float] - Padding added to the beginning of a bleep, in seconds. - - bleep_stop_padding : typing.Optional[float] - Padding added to the end of a bleep, in seconds. - - entity_types : typing.Optional[EntityTypes] - - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- - from skyflow import Skyflow - from skyflow.files import DeidentifyAudioRequestFile + from skyflow import FileDataDeidentifyText, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.deidentify_audio( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyAudioRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="mp3", + client.files.deidentify_text( + file=FileDataDeidentifyText( + base_64="base64", ), + vault_id="vault_id", ) """ - _response = self._raw_client.deidentify_audio( - vault_id=vault_id, + _response = self._raw_client.deidentify_text( file=file, - configuration_id=configuration_id, - output_processed_audio=output_processed_audio, - output_transcription=output_transcription, - bleep_gain=bleep_gain, - bleep_frequency=bleep_frequency, - bleep_start_padding=bleep_start_padding, - bleep_stop_padding=bleep_stop_padding, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - def get_run( - self, run_id: Uuid, *, vault_id: ResourceId, request_options: typing.Optional[RequestOptions] = None - ) -> DeidentifyStatusResponse: + def reidentify_file( + self, + *, + file: FileDataReidentifyFile, + vault_id: str, + format: typing.Optional[Format] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ReidentifyFileResponse: """ - Returns the status of the detect run. + Re-identifies tokens in a file. Parameters ---------- - run_id : Uuid - ID of the detect run. + file : FileDataReidentifyFile - vault_id : ResourceId - ID of the vault. + vault_id : str + ID of the vault where the entities are stored. + + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - DeidentifyStatusResponse - A successful response. + ReidentifyFileResponse + OK Examples -------- - from skyflow import Skyflow + from skyflow import FileDataReidentifyFile, Skyflow client = Skyflow( token="YOUR_TOKEN", ) - client.files.get_run( - run_id="run_id", + client.files.reidentify_file( + file=FileDataReidentifyFile( + base_64="base64", + data_format="txt", + ), vault_id="vault_id", ) """ - _response = self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options) + _response = self._raw_client.reidentify_file( + file=file, vault_id=vault_id, format=format, request_options=request_options + ) return _response.data - def reidentify_file( + def get_run( self, + run_id: str, *, - vault_id: VaultId, - file: ReidentifyFileRequestFile, - format: typing.Optional[ReidentifyFileRequestFormat] = OMIT, + vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> ReidentifyFileResponse: + ) -> DetectRunsResponse: """ - Re-identifies tokens in a file. + Returns the status of a detect run. Parameters ---------- - vault_id : VaultId + run_id : str - file : ReidentifyFileRequestFile - File to re-identify. Files are specified as Base64-encoded data or an EFS path. - - format : typing.Optional[ReidentifyFileRequestFormat] - Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + vault_id : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ReidentifyFileResponse - A successful response. + DetectRunsResponse + OK Examples -------- from skyflow import Skyflow - from skyflow.files import ReidentifyFileRequestFile client = Skyflow( token="YOUR_TOKEN", ) - client.files.reidentify_file( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=ReidentifyFileRequestFile( - base_64="Zm9vYmFy", - data_format="txt", - ), + client.files.get_run( + run_id="run_id", + vault_id="vault_id", ) """ - _response = self._raw_client.reidentify_file( - vault_id=vault_id, file=file, format=format, request_options=request_options - ) + _response = self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options) return _response.data @@ -857,14 +914,14 @@ def with_raw_response(self) -> AsyncRawFilesClient: async def deidentify_file( self, *, - vault_id: VaultId, - file: DeidentifyFileRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileData, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ @@ -872,37 +929,40 @@ async def deidentify_file( Parameters ---------- - vault_id : VaultId + file : FileData - file : DeidentifyFileRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyFileRequestFile + from skyflow import AsyncSkyflow, FileData client = AsyncSkyflow( token="YOUR_TOKEN", @@ -911,78 +971,105 @@ async def deidentify_file( async def main() -> None: await client.files.deidentify_file( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyFileRequestFile( - base_64="Zm9vYmFy", - data_format="txt", + file=FileData( + base_64="base64", + data_format="mp3", ), + vault_id="vault_id", ) asyncio.run(main()) """ _response = await self._raw_client.deidentify_file( - vault_id=vault_id, file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_document( + async def deidentify_audio( self, *, - vault_id: VaultId, - file: DeidentifyDocumentRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyAudio, + vault_id: str, + output_transcription: typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] = OMIT, + output_processed_audio: typing.Optional[bool] = OMIT, + bleep_start_padding: typing.Optional[float] = OMIT, + bleep_stop_padding: typing.Optional[float] = OMIT, + bleep_frequency: typing.Optional[int] = OMIT, + bleep_gain: typing.Optional[int] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. + De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyAudio - file : DeidentifyDocumentRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + output_transcription : typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] + Type of transcription to output. - entity_types : typing.Optional[EntityTypes] + output_processed_audio : typing.Optional[bool] + Whether to include the processed audio file in the response. - token_type : typing.Optional[TokenTypeWithoutVault] + bleep_start_padding : typing.Optional[float] + Padding added to the beginning of a bleep, in seconds. - allow_regex : typing.Optional[AllowRegex] + bleep_stop_padding : typing.Optional[float] + Padding added to the end of a bleep, in seconds. - restrict_regex : typing.Optional[RestrictRegex] + bleep_frequency : typing.Optional[int] + The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. + + bleep_gain : typing.Optional[int] + Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. + + entity_types : typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] + Entities to detect and de-identify. + + token_type : typing.Optional[TokenTypeMapping] + + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. + + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyDocumentRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyAudio client = AsyncSkyflow( token="YOUR_TOKEN", @@ -990,87 +1077,88 @@ async def deidentify_document( async def main() -> None: - await client.files.deidentify_document( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyDocumentRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="docx", + await client.files.deidentify_audio( + file=FileDataDeidentifyAudio( + base_64="base64", + data_format="mp3", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_document( - vault_id=vault_id, + _response = await self._raw_client.deidentify_audio( file=file, - configuration_id=configuration_id, + vault_id=vault_id, + output_transcription=output_transcription, + output_processed_audio=output_processed_audio, + bleep_start_padding=bleep_start_padding, + bleep_stop_padding=bleep_stop_padding, + bleep_frequency=bleep_frequency, + bleep_gain=bleep_gain, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_pdf( + async def deidentify_document( self, *, - vault_id: VaultId, - file: DeidentifyPdfRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - density: typing.Optional[float] = OMIT, - max_resolution: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyDocument, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. + De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyDocument - file : DeidentifyPdfRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] + Entities to detect and de-identify. - density : typing.Optional[float] - Pixel density at which to process the PDF file. + token_type : typing.Optional[TokenTypeMapping] - max_resolution : typing.Optional[float] - Max resolution at which to process the PDF file. + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - entity_types : typing.Optional[EntityTypes] - - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyPdfRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyDocument client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1078,92 +1166,92 @@ async def deidentify_pdf( async def main() -> None: - await client.files.deidentify_pdf( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyPdfRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", + await client.files.deidentify_document( + file=FileDataDeidentifyDocument( + base_64="base64", + data_format="pdf", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_pdf( - vault_id=vault_id, + _response = await self._raw_client.deidentify_document( file=file, - configuration_id=configuration_id, - density=density, - max_resolution=max_resolution, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_image( + async def deidentify_pdf( self, *, - vault_id: VaultId, - file: DeidentifyImageRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_image: typing.Optional[bool] = OMIT, - output_ocr_text: typing.Optional[bool] = OMIT, - masking_method: typing.Optional[DeidentifyImageRequestMaskingMethod] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPdf, + vault_id: str, + density: typing.Optional[int] = OMIT, + max_resolution: typing.Optional[int] = OMIT, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyImageRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyPdf - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - output_processed_image : typing.Optional[bool] - If `true`, includes processed image in the output. - - output_ocr_text : typing.Optional[bool] - If `true`, includes OCR text output in the response. + density : typing.Optional[int] + Pixel density at which to process the PDF file. - masking_method : typing.Optional[DeidentifyImageRequestMaskingMethod] - Method to mask the entities in the image. + max_resolution : typing.Optional[int] + Max resolution at which to process the PDF file. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyImageRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyPdf client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1171,82 +1259,95 @@ async def deidentify_image( async def main() -> None: - await client.files.deidentify_image( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyImageRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="jpg", + await client.files.deidentify_pdf( + file=FileDataDeidentifyPdf( + base_64="base64", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_image( - vault_id=vault_id, + _response = await self._raw_client.deidentify_pdf( file=file, - configuration_id=configuration_id, - output_processed_image=output_processed_image, - output_ocr_text=output_ocr_text, - masking_method=masking_method, + vault_id=vault_id, + density=density, + max_resolution=max_resolution, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_text( + async def deidentify_image( self, *, - vault_id: VaultId, - file: DeidentifyTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyImage, + vault_id: str, + output_processed_image: typing.Optional[bool] = OMIT, + output_ocr_text: typing.Optional[bool] = OMIT, + masking_method: typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. + De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyImage - file : DeidentifyTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + output_processed_image : typing.Optional[bool] + If `true`, includes processed image in the output. + + output_ocr_text : typing.Optional[bool] + If `true`, includes text detected by OCR in the response. - entity_types : typing.Optional[EntityTypes] + masking_method : typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] + Method to mask the entities in the image. + + entity_types : typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyTextRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyImage client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1254,78 +1355,87 @@ async def deidentify_text( async def main() -> None: - await client.files.deidentify_text( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyTextRequestFile( - base_64="Zm9vYmFy", + await client.files.deidentify_image( + file=FileDataDeidentifyImage( + base_64="base64", + data_format="jpg", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_text( - vault_id=vault_id, + _response = await self._raw_client.deidentify_image( file=file, - configuration_id=configuration_id, + vault_id=vault_id, + output_processed_image=output_processed_image, + output_ocr_text=output_ocr_text, + masking_method=masking_method, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_structured_text( + async def deidentify_presentation( self, *, - vault_id: VaultId, - file: DeidentifyStructuredTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPresentation, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPresentation - file : DeidentifyStructuredTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyStructuredTextRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyPresentation client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1333,26 +1443,26 @@ async def deidentify_structured_text( async def main() -> None: - await client.files.deidentify_structured_text( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyStructuredTextRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="json", + await client.files.deidentify_presentation( + file=FileDataDeidentifyPresentation( + base_64="base64", + data_format="ppt", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_structured_text( - vault_id=vault_id, + _response = await self._raw_client.deidentify_presentation( file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data @@ -1360,14 +1470,16 @@ async def main() -> None: async def deidentify_spreadsheet( self, *, - vault_id: VaultId, - file: DeidentifySpreadsheetRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifySpreadsheet, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ @@ -1375,37 +1487,40 @@ async def deidentify_spreadsheet( Parameters ---------- - vault_id : VaultId - - file : DeidentifySpreadsheetRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifySpreadsheet - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifySpreadsheetRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifySpreadsheet client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1414,78 +1529,83 @@ async def deidentify_spreadsheet( async def main() -> None: await client.files.deidentify_spreadsheet( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifySpreadsheetRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", + file=FileDataDeidentifySpreadsheet( + base_64="base64", data_format="csv", ), + vault_id="vault_id", ) asyncio.run(main()) """ _response = await self._raw_client.deidentify_spreadsheet( - vault_id=vault_id, file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_presentation( + async def deidentify_structured_text( self, *, - vault_id: VaultId, - file: DeidentifyPresentationRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyStructuredText, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyStructuredText - file : DeidentifyPresentationRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyPresentationRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyStructuredText client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1493,103 +1613,82 @@ async def deidentify_presentation( async def main() -> None: - await client.files.deidentify_presentation( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyPresentationRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="pptx", + await client.files.deidentify_structured_text( + file=FileDataDeidentifyStructuredText( + base_64="base64", + data_format="json", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_presentation( - vault_id=vault_id, + _response = await self._raw_client.deidentify_structured_text( file=file, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def deidentify_audio( + async def deidentify_text( self, *, - vault_id: VaultId, - file: DeidentifyAudioRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_audio: typing.Optional[bool] = OMIT, - output_transcription: typing.Optional[DeidentifyAudioRequestOutputTranscription] = OMIT, - bleep_gain: typing.Optional[float] = OMIT, - bleep_frequency: typing.Optional[float] = OMIT, - bleep_start_padding: typing.Optional[float] = OMIT, - bleep_stop_padding: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyText, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyFileResponse: """ - De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyText - file : DeidentifyAudioRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] + Entities to detect and de-identify. - output_processed_audio : typing.Optional[bool] - If `true`, includes processed audio file in the response. + token_type : typing.Optional[TokenTypeMapping] - output_transcription : typing.Optional[DeidentifyAudioRequestOutputTranscription] - Type of transcription to output. + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - bleep_gain : typing.Optional[float] - Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - - bleep_frequency : typing.Optional[float] - The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - - bleep_start_padding : typing.Optional[float] - Padding added to the beginning of a bleep, in seconds. - - bleep_stop_padding : typing.Optional[float] - Padding added to the end of a bleep, in seconds. - - entity_types : typing.Optional[EntityTypes] - - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyFileResponse - A successful response. + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow - from skyflow.files import DeidentifyAudioRequestFile + from skyflow import AsyncSkyflow, FileDataDeidentifyText client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1597,63 +1696,62 @@ async def deidentify_audio( async def main() -> None: - await client.files.deidentify_audio( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=DeidentifyAudioRequestFile( - base_64="SGkgaSBhbSBEZXZhbnNodSwgbGl2...aW5nIGluIGNhbGlmb3JuaWEuIA==", - data_format="mp3", + await client.files.deidentify_text( + file=FileDataDeidentifyText( + base_64="base64", ), + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.deidentify_audio( - vault_id=vault_id, + _response = await self._raw_client.deidentify_text( file=file, - configuration_id=configuration_id, - output_processed_audio=output_processed_audio, - output_transcription=output_transcription, - bleep_gain=bleep_gain, - bleep_frequency=bleep_frequency, - bleep_start_padding=bleep_start_padding, - bleep_stop_padding=bleep_stop_padding, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data - async def get_run( - self, run_id: Uuid, *, vault_id: ResourceId, request_options: typing.Optional[RequestOptions] = None - ) -> DeidentifyStatusResponse: + async def reidentify_file( + self, + *, + file: FileDataReidentifyFile, + vault_id: str, + format: typing.Optional[Format] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ReidentifyFileResponse: """ - Returns the status of the detect run. + Re-identifies tokens in a file. Parameters ---------- - run_id : Uuid - ID of the detect run. + file : FileDataReidentifyFile - vault_id : ResourceId - ID of the vault. + vault_id : str + ID of the vault where the entities are stored. + + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - DeidentifyStatusResponse - A successful response. + ReidentifyFileResponse + OK Examples -------- import asyncio - from skyflow import AsyncSkyflow + from skyflow import AsyncSkyflow, FileDataReidentifyFile client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1661,52 +1759,51 @@ async def get_run( async def main() -> None: - await client.files.get_run( - run_id="run_id", + await client.files.reidentify_file( + file=FileDataReidentifyFile( + base_64="base64", + data_format="txt", + ), vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options) + _response = await self._raw_client.reidentify_file( + file=file, vault_id=vault_id, format=format, request_options=request_options + ) return _response.data - async def reidentify_file( + async def get_run( self, + run_id: str, *, - vault_id: VaultId, - file: ReidentifyFileRequestFile, - format: typing.Optional[ReidentifyFileRequestFormat] = OMIT, + vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> ReidentifyFileResponse: + ) -> DetectRunsResponse: """ - Re-identifies tokens in a file. + Returns the status of a detect run. Parameters ---------- - vault_id : VaultId + run_id : str - file : ReidentifyFileRequestFile - File to re-identify. Files are specified as Base64-encoded data or an EFS path. - - format : typing.Optional[ReidentifyFileRequestFormat] - Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + vault_id : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ReidentifyFileResponse - A successful response. + DetectRunsResponse + OK Examples -------- import asyncio from skyflow import AsyncSkyflow - from skyflow.files import ReidentifyFileRequestFile client = AsyncSkyflow( token="YOUR_TOKEN", @@ -1714,18 +1811,13 @@ async def reidentify_file( async def main() -> None: - await client.files.reidentify_file( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - file=ReidentifyFileRequestFile( - base_64="Zm9vYmFy", - data_format="txt", - ), + await client.files.get_run( + run_id="run_id", + vault_id="vault_id", ) asyncio.run(main()) """ - _response = await self._raw_client.reidentify_file( - vault_id=vault_id, file=file, format=format, request_options=request_options - ) + _response = await self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options) return _response.data diff --git a/skyflow/generated/rest/files/raw_client.py b/skyflow/generated/rest/files/raw_client.py index c0e535ea..863ae5e3 100644 --- a/skyflow/generated/rest/files/raw_client.py +++ b/skyflow/generated/rest/files/raw_client.py @@ -12,34 +12,55 @@ from ..core.serialization import convert_and_respect_annotation_metadata from ..errors.bad_request_error import BadRequestError from ..errors.internal_server_error import InternalServerError -from ..errors.not_found_error import NotFoundError from ..errors.unauthorized_error import UnauthorizedError -from ..types.allow_regex import AllowRegex -from ..types.configuration_id import ConfigurationId from ..types.deidentify_file_response import DeidentifyFileResponse -from ..types.deidentify_status_response import DeidentifyStatusResponse -from ..types.entity_types import EntityTypes +from ..types.detect_runs_response import DetectRunsResponse from ..types.error_response import ErrorResponse +from ..types.file_data import FileData +from ..types.file_data_deidentify_audio import FileDataDeidentifyAudio +from ..types.file_data_deidentify_document import FileDataDeidentifyDocument +from ..types.file_data_deidentify_image import FileDataDeidentifyImage +from ..types.file_data_deidentify_pdf import FileDataDeidentifyPdf +from ..types.file_data_deidentify_presentation import FileDataDeidentifyPresentation +from ..types.file_data_deidentify_spreadsheet import FileDataDeidentifySpreadsheet +from ..types.file_data_deidentify_structured_text import FileDataDeidentifyStructuredText +from ..types.file_data_deidentify_text import FileDataDeidentifyText +from ..types.file_data_reidentify_file import FileDataReidentifyFile +from ..types.format import Format from ..types.reidentify_file_response import ReidentifyFileResponse -from ..types.resource_id import ResourceId -from ..types.restrict_regex import RestrictRegex -from ..types.token_type_without_vault import TokenTypeWithoutVault +from ..types.token_type_mapping import TokenTypeMapping from ..types.transformations import Transformations -from ..types.uuid_ import Uuid -from ..types.vault_id import VaultId -from .types.deidentify_audio_request_file import DeidentifyAudioRequestFile -from .types.deidentify_audio_request_output_transcription import DeidentifyAudioRequestOutputTranscription -from .types.deidentify_document_request_file import DeidentifyDocumentRequestFile -from .types.deidentify_file_request_file import DeidentifyFileRequestFile -from .types.deidentify_image_request_file import DeidentifyImageRequestFile -from .types.deidentify_image_request_masking_method import DeidentifyImageRequestMaskingMethod -from .types.deidentify_pdf_request_file import DeidentifyPdfRequestFile -from .types.deidentify_presentation_request_file import DeidentifyPresentationRequestFile -from .types.deidentify_spreadsheet_request_file import DeidentifySpreadsheetRequestFile -from .types.deidentify_structured_text_request_file import DeidentifyStructuredTextRequestFile -from .types.deidentify_text_request_file import DeidentifyTextRequestFile -from .types.reidentify_file_request_file import ReidentifyFileRequestFile -from .types.reidentify_file_request_format import ReidentifyFileRequestFormat +from .types.deidentify_file_audio_request_deidentify_audio_entity_types_item import ( + DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, +) +from .types.deidentify_file_audio_request_deidentify_audio_output_transcription import ( + DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, +) +from .types.deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item import ( + DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, +) +from .types.deidentify_file_image_request_deidentify_image_entity_types_item import ( + DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, +) +from .types.deidentify_file_image_request_deidentify_image_masking_method import ( + DeidentifyFileImageRequestDeidentifyImageMaskingMethod, +) +from .types.deidentify_file_request_deidentify_document_entity_types_item import ( + DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_presentation_entity_types_item import ( + DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_spreadsheet_entity_types_item import ( + DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_structured_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, +) +from .types.deidentify_file_request_deidentify_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyTextEntityTypesItem, +) +from .types.deidentify_file_request_entity_types_item import DeidentifyFileRequestEntityTypesItem # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -52,14 +73,14 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def deidentify_file( self, *, - vault_id: VaultId, - file: DeidentifyFileRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileData, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ @@ -67,49 +88,51 @@ def deidentify_file( Parameters ---------- - vault_id : VaultId + file : FileData - file : DeidentifyFileRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( "v1/detect/deidentify/file", method="POST", json={ + "file": convert_and_respect_annotation_metadata(object_=file, annotation=FileData, direction="write"), "vault_id": vault_id, - "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyFileRequestFile, direction="write" - ), - "configuration_id": configuration_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -165,67 +188,101 @@ def deidentify_file( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_document( + def deidentify_audio( self, *, - vault_id: VaultId, - file: DeidentifyDocumentRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyAudio, + vault_id: str, + output_transcription: typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] = OMIT, + output_processed_audio: typing.Optional[bool] = OMIT, + bleep_start_padding: typing.Optional[float] = OMIT, + bleep_stop_padding: typing.Optional[float] = OMIT, + bleep_frequency: typing.Optional[int] = OMIT, + bleep_gain: typing.Optional[int] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. + De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyAudio + + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - file : DeidentifyDocumentRequestFile - File to de-identify. Files are specified as Base64-encoded data. + output_transcription : typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] + Type of transcription to output. + + output_processed_audio : typing.Optional[bool] + Whether to include the processed audio file in the response. + + bleep_start_padding : typing.Optional[float] + Padding added to the beginning of a bleep, in seconds. + + bleep_stop_padding : typing.Optional[float] + Padding added to the end of a bleep, in seconds. - configuration_id : typing.Optional[ConfigurationId] + bleep_frequency : typing.Optional[int] + The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - entity_types : typing.Optional[EntityTypes] + bleep_gain : typing.Optional[int] + Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - token_type : typing.Optional[TokenTypeWithoutVault] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] + Entities to detect and de-identify. - allow_regex : typing.Optional[AllowRegex] + token_type : typing.Optional[TokenTypeMapping] - restrict_regex : typing.Optional[RestrictRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. + + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/document", + "v1/detect/deidentify/file/audio", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyDocumentRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyAudio, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, + "output_transcription": output_transcription, + "output_processed_audio": output_processed_audio, + "bleep_start_padding": bleep_start_padding, + "bleep_stop_padding": bleep_stop_padding, + "bleep_frequency": bleep_frequency, + "bleep_gain": bleep_gain, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -281,77 +338,71 @@ def deidentify_document( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_pdf( + def deidentify_document( self, *, - vault_id: VaultId, - file: DeidentifyPdfRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - density: typing.Optional[float] = OMIT, - max_resolution: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyDocument, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. + De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyPdfRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyDocument - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - density : typing.Optional[float] - Pixel density at which to process the PDF file. + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] + Entities to detect and de-identify. - max_resolution : typing.Optional[float] - Max resolution at which to process the PDF file. + token_type : typing.Optional[TokenTypeMapping] - entity_types : typing.Optional[EntityTypes] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/document/pdf", + "v1/detect/deidentify/file/document", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyPdfRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyDocument, direction="write" ), - "configuration_id": configuration_id, - "density": density, - "max_resolution": max_resolution, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -407,82 +458,83 @@ def deidentify_pdf( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_image( + def deidentify_pdf( self, *, - vault_id: VaultId, - file: DeidentifyImageRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_image: typing.Optional[bool] = OMIT, - output_ocr_text: typing.Optional[bool] = OMIT, - masking_method: typing.Optional[DeidentifyImageRequestMaskingMethod] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPdf, + vault_id: str, + density: typing.Optional[int] = OMIT, + max_resolution: typing.Optional[int] = OMIT, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPdf - file : DeidentifyImageRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] - - output_processed_image : typing.Optional[bool] - If `true`, includes processed image in the output. - - output_ocr_text : typing.Optional[bool] - If `true`, includes OCR text output in the response. + density : typing.Optional[int] + Pixel density at which to process the PDF file. - masking_method : typing.Optional[DeidentifyImageRequestMaskingMethod] - Method to mask the entities in the image. + max_resolution : typing.Optional[int] + Max resolution at which to process the PDF file. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/image", + "v1/detect/deidentify/file/document/pdf", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyImageRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyPdf, direction="write" ), - "configuration_id": configuration_id, - "output_processed_image": output_processed_image, - "output_ocr_text": output_ocr_text, - "masking_method": masking_method, + "vault_id": vault_id, + "density": density, + "max_resolution": max_resolution, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -538,67 +590,86 @@ def deidentify_image( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_text( + def deidentify_image( self, *, - vault_id: VaultId, - file: DeidentifyTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyImage, + vault_id: str, + output_processed_image: typing.Optional[bool] = OMIT, + output_ocr_text: typing.Optional[bool] = OMIT, + masking_method: typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. + De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyImage + + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. + + output_processed_image : typing.Optional[bool] + If `true`, includes processed image in the output. - file : DeidentifyTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + output_ocr_text : typing.Optional[bool] + If `true`, includes text detected by OCR in the response. - configuration_id : typing.Optional[ConfigurationId] + masking_method : typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] + Method to mask the entities in the image. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/text", + "v1/detect/deidentify/file/image", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyTextRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyImage, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, + "output_processed_image": output_processed_image, + "output_ocr_text": output_ocr_text, + "masking_method": masking_method, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -654,67 +725,73 @@ def deidentify_text( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_structured_text( + def deidentify_presentation( self, *, - vault_id: VaultId, - file: DeidentifyStructuredTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPresentation, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPresentation - file : DeidentifyStructuredTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/structured_text", + "v1/detect/deidentify/file/presentation", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyStructuredTextRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyPresentation, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -773,14 +850,16 @@ def deidentify_structured_text( def deidentify_spreadsheet( self, *, - vault_id: VaultId, - file: DeidentifySpreadsheetRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifySpreadsheet, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ @@ -788,49 +867,53 @@ def deidentify_spreadsheet( Parameters ---------- - vault_id : VaultId - - file : DeidentifySpreadsheetRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifySpreadsheet - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( "v1/detect/deidentify/file/spreadsheet", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifySpreadsheetRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifySpreadsheet, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -886,67 +969,73 @@ def deidentify_spreadsheet( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_presentation( + def deidentify_structured_text( self, *, - vault_id: VaultId, - file: DeidentifyPresentationRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyStructuredText, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyPresentationRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyStructuredText - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/presentation", + "v1/detect/deidentify/file/structured_text", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyPresentationRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyStructuredText, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1002,97 +1091,71 @@ def deidentify_presentation( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def deidentify_audio( + def deidentify_text( self, *, - vault_id: VaultId, - file: DeidentifyAudioRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_audio: typing.Optional[bool] = OMIT, - output_transcription: typing.Optional[DeidentifyAudioRequestOutputTranscription] = OMIT, - bleep_gain: typing.Optional[float] = OMIT, - bleep_frequency: typing.Optional[float] = OMIT, - bleep_start_padding: typing.Optional[float] = OMIT, - bleep_stop_padding: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyText, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyAudioRequestFile - File to de-identify. Files are specified as Base64-encoded data. - - configuration_id : typing.Optional[ConfigurationId] - - output_processed_audio : typing.Optional[bool] - If `true`, includes processed audio file in the response. - - output_transcription : typing.Optional[DeidentifyAudioRequestOutputTranscription] - Type of transcription to output. - - bleep_gain : typing.Optional[float] - Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - - bleep_frequency : typing.Optional[float] - The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - - bleep_start_padding : typing.Optional[float] - Padding added to the beginning of a bleep, in seconds. + file : FileDataDeidentifyText - bleep_stop_padding : typing.Optional[float] - Padding added to the end of a bleep, in seconds. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/audio", + "v1/detect/deidentify/file/text", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyAudioRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyText, direction="write" ), - "configuration_id": configuration_id, - "output_processed_audio": output_processed_audio, - "output_transcription": output_transcription, - "bleep_gain": bleep_gain, - "bleep_frequency": bleep_frequency, - "bleep_start_padding": bleep_start_padding, - "bleep_stop_padding": bleep_stop_padding, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1148,42 +1211,56 @@ def deidentify_audio( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def get_run( - self, run_id: Uuid, *, vault_id: ResourceId, request_options: typing.Optional[RequestOptions] = None - ) -> HttpResponse[DeidentifyStatusResponse]: + def reidentify_file( + self, + *, + file: FileDataReidentifyFile, + vault_id: str, + format: typing.Optional[Format] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ReidentifyFileResponse]: """ - Returns the status of the detect run. + Re-identifies tokens in a file. Parameters ---------- - run_id : Uuid - ID of the detect run. + file : FileDataReidentifyFile - vault_id : ResourceId - ID of the vault. + vault_id : str + ID of the vault where the entities are stored. + + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[DeidentifyStatusResponse] - A successful response. + HttpResponse[ReidentifyFileResponse] + OK """ _response = self._client_wrapper.httpx_client.request( - f"v1/detect/runs/{jsonable_encoder(run_id)}", - method="GET", - params={ + "v1/detect/reidentify/file", + method="POST", + json={ + "file": convert_and_respect_annotation_metadata( + object_=file, annotation=FileDataReidentifyFile, direction="write" + ), "vault_id": vault_id, + "format": convert_and_respect_annotation_metadata(object_=format, annotation=Format, direction="write"), + }, + headers={ + "content-type": "application/json", }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - DeidentifyStatusResponse, + ReidentifyFileResponse, parse_obj_as( - type_=DeidentifyStatusResponse, # type: ignore + type_=ReidentifyFileResponse, # type: ignore object_=_response.json(), ), ) @@ -1210,17 +1287,6 @@ def get_run( ), ), ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ), - ) if _response.status_code == 500: raise InternalServerError( headers=dict(_response.headers), @@ -1237,59 +1303,44 @@ def get_run( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - def reidentify_file( + def get_run( self, + run_id: str, *, - vault_id: VaultId, - file: ReidentifyFileRequestFile, - format: typing.Optional[ReidentifyFileRequestFormat] = OMIT, + vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[ReidentifyFileResponse]: + ) -> HttpResponse[DetectRunsResponse]: """ - Re-identifies tokens in a file. + Returns the status of a detect run. Parameters ---------- - vault_id : VaultId - - file : ReidentifyFileRequestFile - File to re-identify. Files are specified as Base64-encoded data or an EFS path. + run_id : str - format : typing.Optional[ReidentifyFileRequestFormat] - Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + vault_id : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[ReidentifyFileResponse] - A successful response. + HttpResponse[DetectRunsResponse] + OK """ _response = self._client_wrapper.httpx_client.request( - "v1/detect/reidentify/file", - method="POST", - json={ + f"v1/detect/runs/{jsonable_encoder(run_id)}", + method="GET", + params={ "vault_id": vault_id, - "file": convert_and_respect_annotation_metadata( - object_=file, annotation=ReidentifyFileRequestFile, direction="write" - ), - "format": convert_and_respect_annotation_metadata( - object_=format, annotation=ReidentifyFileRequestFormat, direction="write" - ), - }, - headers={ - "content-type": "application/json", }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ReidentifyFileResponse, + DetectRunsResponse, parse_obj_as( - type_=ReidentifyFileResponse, # type: ignore + type_=DetectRunsResponse, # type: ignore object_=_response.json(), ), ) @@ -1340,14 +1391,14 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def deidentify_file( self, *, - vault_id: VaultId, - file: DeidentifyFileRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileData, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ @@ -1355,49 +1406,51 @@ async def deidentify_file( Parameters ---------- - vault_id : VaultId + file : FileData - file : DeidentifyFileRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( "v1/detect/deidentify/file", method="POST", json={ + "file": convert_and_respect_annotation_metadata(object_=file, annotation=FileData, direction="write"), "vault_id": vault_id, - "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyFileRequestFile, direction="write" - ), - "configuration_id": configuration_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1453,67 +1506,101 @@ async def deidentify_file( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_document( + async def deidentify_audio( self, *, - vault_id: VaultId, - file: DeidentifyDocumentRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyAudio, + vault_id: str, + output_transcription: typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] = OMIT, + output_processed_audio: typing.Optional[bool] = OMIT, + bleep_start_padding: typing.Optional[float] = OMIT, + bleep_stop_padding: typing.Optional[float] = OMIT, + bleep_frequency: typing.Optional[int] = OMIT, + bleep_gain: typing.Optional[int] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. + De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyAudio + + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - file : DeidentifyDocumentRequestFile - File to de-identify. Files are specified as Base64-encoded data. + output_transcription : typing.Optional[DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription] + Type of transcription to output. + + output_processed_audio : typing.Optional[bool] + Whether to include the processed audio file in the response. + + bleep_start_padding : typing.Optional[float] + Padding added to the beginning of a bleep, in seconds. + + bleep_stop_padding : typing.Optional[float] + Padding added to the end of a bleep, in seconds. - configuration_id : typing.Optional[ConfigurationId] + bleep_frequency : typing.Optional[int] + The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - entity_types : typing.Optional[EntityTypes] + bleep_gain : typing.Optional[int] + Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - token_type : typing.Optional[TokenTypeWithoutVault] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem]] + Entities to detect and de-identify. - allow_regex : typing.Optional[AllowRegex] + token_type : typing.Optional[TokenTypeMapping] - restrict_regex : typing.Optional[RestrictRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. + + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/document", + "v1/detect/deidentify/file/audio", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyDocumentRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyAudio, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, + "output_transcription": output_transcription, + "output_processed_audio": output_processed_audio, + "bleep_start_padding": bleep_start_padding, + "bleep_stop_padding": bleep_stop_padding, + "bleep_frequency": bleep_frequency, + "bleep_gain": bleep_gain, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1569,77 +1656,71 @@ async def deidentify_document( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_pdf( + async def deidentify_document( self, *, - vault_id: VaultId, - file: DeidentifyPdfRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - density: typing.Optional[float] = OMIT, - max_resolution: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyDocument, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. + De-identifies sensitive data from a document file. This operation includes options applicable to all supported document file types.

For more specific options, see the file type-specific opertions (like De-identify PDF) where they're available. For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyPdfRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyDocument - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - density : typing.Optional[float] - Pixel density at which to process the PDF file. + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyDocumentEntityTypesItem]] + Entities to detect and de-identify. - max_resolution : typing.Optional[float] - Max resolution at which to process the PDF file. + token_type : typing.Optional[TokenTypeMapping] - entity_types : typing.Optional[EntityTypes] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - token_type : typing.Optional[TokenTypeWithoutVault] - - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/document/pdf", + "v1/detect/deidentify/file/document", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyPdfRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyDocument, direction="write" ), - "configuration_id": configuration_id, - "density": density, - "max_resolution": max_resolution, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1695,82 +1776,83 @@ async def deidentify_pdf( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_image( + async def deidentify_pdf( self, *, - vault_id: VaultId, - file: DeidentifyImageRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_image: typing.Optional[bool] = OMIT, - output_ocr_text: typing.Optional[bool] = OMIT, - masking_method: typing.Optional[DeidentifyImageRequestMaskingMethod] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPdf, + vault_id: str, + density: typing.Optional[int] = OMIT, + max_resolution: typing.Optional[int] = OMIT, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a PDF file. This operation includes options specific to PDF files.

For broader file type support, see De-identify Document and De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPdf - file : DeidentifyImageRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] - - output_processed_image : typing.Optional[bool] - If `true`, includes processed image in the output. - - output_ocr_text : typing.Optional[bool] - If `true`, includes OCR text output in the response. + density : typing.Optional[int] + Pixel density at which to process the PDF file. - masking_method : typing.Optional[DeidentifyImageRequestMaskingMethod] - Method to mask the entities in the image. + max_resolution : typing.Optional[int] + Max resolution at which to process the PDF file. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/image", + "v1/detect/deidentify/file/document/pdf", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyImageRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyPdf, direction="write" ), - "configuration_id": configuration_id, - "output_processed_image": output_processed_image, - "output_ocr_text": output_ocr_text, - "masking_method": masking_method, + "vault_id": vault_id, + "density": density, + "max_resolution": max_resolution, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1826,67 +1908,86 @@ async def deidentify_image( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_text( + async def deidentify_image( self, *, - vault_id: VaultId, - file: DeidentifyTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyImage, + vault_id: str, + output_processed_image: typing.Optional[bool] = OMIT, + output_ocr_text: typing.Optional[bool] = OMIT, + masking_method: typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] = OMIT, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. + De-identifies sensitive data from an image file. This operation includes options applicable to all supported image file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyImage + + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. + + output_processed_image : typing.Optional[bool] + If `true`, includes processed image in the output. - file : DeidentifyTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + output_ocr_text : typing.Optional[bool] + If `true`, includes text detected by OCR in the response. - configuration_id : typing.Optional[ConfigurationId] + masking_method : typing.Optional[DeidentifyFileImageRequestDeidentifyImageMaskingMethod] + Method to mask the entities in the image. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileImageRequestDeidentifyImageEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/text", + "v1/detect/deidentify/file/image", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyTextRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyImage, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, + "output_processed_image": output_processed_image, + "output_ocr_text": output_ocr_text, + "masking_method": masking_method, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -1942,67 +2043,73 @@ async def deidentify_text( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_structured_text( + async def deidentify_presentation( self, *, - vault_id: VaultId, - file: DeidentifyStructuredTextRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyPresentation, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId + file : FileDataDeidentifyPresentation - file : DeidentifyStructuredTextRequestFile - File to de-identify. Files are specified as Base64-encoded data. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - configuration_id : typing.Optional[ConfigurationId] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyPresentationEntityTypesItem]] + Entities to detect and de-identify. - entity_types : typing.Optional[EntityTypes] + token_type : typing.Optional[TokenTypeMapping] - token_type : typing.Optional[TokenTypeWithoutVault] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - allow_regex : typing.Optional[AllowRegex] - - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/structured_text", + "v1/detect/deidentify/file/presentation", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyStructuredTextRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyPresentation, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -2061,14 +2168,16 @@ async def deidentify_structured_text( async def deidentify_spreadsheet( self, *, - vault_id: VaultId, - file: DeidentifySpreadsheetRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifySpreadsheet, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ @@ -2076,49 +2185,53 @@ async def deidentify_spreadsheet( Parameters ---------- - vault_id : VaultId - - file : DeidentifySpreadsheetRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifySpreadsheet - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( "v1/detect/deidentify/file/spreadsheet", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifySpreadsheetRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifySpreadsheet, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -2174,67 +2287,73 @@ async def deidentify_spreadsheet( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_presentation( + async def deidentify_structured_text( self, *, - vault_id: VaultId, - file: DeidentifyPresentationRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyStructuredText, + vault_id: str, + entity_types: typing.Optional[ + typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem] + ] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from a presentation file. This operation includes options applicable to all supported presentation file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a structured text file. This operation includes options applicable to all supported structured text file types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyPresentationRequestFile - File to de-identify. Files are specified as Base64-encoded data. + file : FileDataDeidentifyStructuredText - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/presentation", + "v1/detect/deidentify/file/structured_text", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyPresentationRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyStructuredText, direction="write" ), - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -2290,97 +2409,71 @@ async def deidentify_presentation( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def deidentify_audio( + async def deidentify_text( self, *, - vault_id: VaultId, - file: DeidentifyAudioRequestFile, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - output_processed_audio: typing.Optional[bool] = OMIT, - output_transcription: typing.Optional[DeidentifyAudioRequestOutputTranscription] = OMIT, - bleep_gain: typing.Optional[float] = OMIT, - bleep_frequency: typing.Optional[float] = OMIT, - bleep_start_padding: typing.Optional[float] = OMIT, - bleep_stop_padding: typing.Optional[float] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenTypeWithoutVault] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + file: FileDataDeidentifyText, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyFileResponse]: """ - De-identifies sensitive data from an audio file. This operation includes options applicable to all supported audio file types.

For broader file type support, see De-identify File. + De-identifies sensitive data from a text file. This operation includes options applicable to all supported image text types.

For broader file type support, see De-identify File. Parameters ---------- - vault_id : VaultId - - file : DeidentifyAudioRequestFile - File to de-identify. Files are specified as Base64-encoded data. - - configuration_id : typing.Optional[ConfigurationId] - - output_processed_audio : typing.Optional[bool] - If `true`, includes processed audio file in the response. - - output_transcription : typing.Optional[DeidentifyAudioRequestOutputTranscription] - Type of transcription to output. - - bleep_gain : typing.Optional[float] - Relative loudness of the bleep in dB. Positive values increase its loudness, and negative values decrease it. - - bleep_frequency : typing.Optional[float] - The pitch of the bleep sound, in Hz. The higher the number, the higher the pitch. - - bleep_start_padding : typing.Optional[float] - Padding added to the beginning of a bleep, in seconds. + file : FileDataDeidentifyText - bleep_stop_padding : typing.Optional[float] - Padding added to the end of a bleep, in seconds. + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyFileRequestDeidentifyTextEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenTypeWithoutVault] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyFileResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/deidentify/file/audio", + "v1/detect/deidentify/file/text", method="POST", json={ - "vault_id": vault_id, "file": convert_and_respect_annotation_metadata( - object_=file, annotation=DeidentifyAudioRequestFile, direction="write" + object_=file, annotation=FileDataDeidentifyText, direction="write" ), - "configuration_id": configuration_id, - "output_processed_audio": output_processed_audio, - "output_transcription": output_transcription, - "bleep_gain": bleep_gain, - "bleep_frequency": bleep_frequency, - "bleep_start_padding": bleep_start_padding, - "bleep_stop_padding": bleep_stop_padding, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenTypeWithoutVault, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -2436,42 +2529,56 @@ async def deidentify_audio( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def get_run( - self, run_id: Uuid, *, vault_id: ResourceId, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[DeidentifyStatusResponse]: + async def reidentify_file( + self, + *, + file: FileDataReidentifyFile, + vault_id: str, + format: typing.Optional[Format] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ReidentifyFileResponse]: """ - Returns the status of the detect run. + Re-identifies tokens in a file. Parameters ---------- - run_id : Uuid - ID of the detect run. + file : FileDataReidentifyFile - vault_id : ResourceId - ID of the vault. + vault_id : str + ID of the vault where the entities are stored. + + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[DeidentifyStatusResponse] - A successful response. + AsyncHttpResponse[ReidentifyFileResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( - f"v1/detect/runs/{jsonable_encoder(run_id)}", - method="GET", - params={ + "v1/detect/reidentify/file", + method="POST", + json={ + "file": convert_and_respect_annotation_metadata( + object_=file, annotation=FileDataReidentifyFile, direction="write" + ), "vault_id": vault_id, + "format": convert_and_respect_annotation_metadata(object_=format, annotation=Format, direction="write"), + }, + headers={ + "content-type": "application/json", }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - DeidentifyStatusResponse, + ReidentifyFileResponse, parse_obj_as( - type_=DeidentifyStatusResponse, # type: ignore + type_=ReidentifyFileResponse, # type: ignore object_=_response.json(), ), ) @@ -2498,17 +2605,6 @@ async def get_run( ), ), ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ), - ) if _response.status_code == 500: raise InternalServerError( headers=dict(_response.headers), @@ -2525,59 +2621,44 @@ async def get_run( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) - async def reidentify_file( + async def get_run( self, + run_id: str, *, - vault_id: VaultId, - file: ReidentifyFileRequestFile, - format: typing.Optional[ReidentifyFileRequestFormat] = OMIT, + vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ReidentifyFileResponse]: + ) -> AsyncHttpResponse[DetectRunsResponse]: """ - Re-identifies tokens in a file. + Returns the status of a detect run. Parameters ---------- - vault_id : VaultId - - file : ReidentifyFileRequestFile - File to re-identify. Files are specified as Base64-encoded data or an EFS path. + run_id : str - format : typing.Optional[ReidentifyFileRequestFormat] - Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + vault_id : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[ReidentifyFileResponse] - A successful response. + AsyncHttpResponse[DetectRunsResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( - "v1/detect/reidentify/file", - method="POST", - json={ + f"v1/detect/runs/{jsonable_encoder(run_id)}", + method="GET", + params={ "vault_id": vault_id, - "file": convert_and_respect_annotation_metadata( - object_=file, annotation=ReidentifyFileRequestFile, direction="write" - ), - "format": convert_and_respect_annotation_metadata( - object_=format, annotation=ReidentifyFileRequestFormat, direction="write" - ), - }, - headers={ - "content-type": "application/json", }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ReidentifyFileResponse, + DetectRunsResponse, parse_obj_as( - type_=ReidentifyFileResponse, # type: ignore + type_=DetectRunsResponse, # type: ignore object_=_response.json(), ), ) diff --git a/skyflow/generated/rest/files/types/__init__.py b/skyflow/generated/rest/files/types/__init__.py index 78943a33..5ff54d96 100644 --- a/skyflow/generated/rest/files/types/__init__.py +++ b/skyflow/generated/rest/files/types/__init__.py @@ -2,48 +2,48 @@ # isort: skip_file -from .deidentify_audio_request_file import DeidentifyAudioRequestFile -from .deidentify_audio_request_file_data_format import DeidentifyAudioRequestFileDataFormat -from .deidentify_audio_request_output_transcription import DeidentifyAudioRequestOutputTranscription -from .deidentify_document_request_file import DeidentifyDocumentRequestFile -from .deidentify_document_request_file_data_format import DeidentifyDocumentRequestFileDataFormat -from .deidentify_file_request_file import DeidentifyFileRequestFile -from .deidentify_file_request_file_data_format import DeidentifyFileRequestFileDataFormat -from .deidentify_image_request_file import DeidentifyImageRequestFile -from .deidentify_image_request_file_data_format import DeidentifyImageRequestFileDataFormat -from .deidentify_image_request_masking_method import DeidentifyImageRequestMaskingMethod -from .deidentify_pdf_request_file import DeidentifyPdfRequestFile -from .deidentify_presentation_request_file import DeidentifyPresentationRequestFile -from .deidentify_presentation_request_file_data_format import DeidentifyPresentationRequestFileDataFormat -from .deidentify_spreadsheet_request_file import DeidentifySpreadsheetRequestFile -from .deidentify_spreadsheet_request_file_data_format import DeidentifySpreadsheetRequestFileDataFormat -from .deidentify_structured_text_request_file import DeidentifyStructuredTextRequestFile -from .deidentify_structured_text_request_file_data_format import DeidentifyStructuredTextRequestFileDataFormat -from .deidentify_text_request_file import DeidentifyTextRequestFile -from .reidentify_file_request_file import ReidentifyFileRequestFile -from .reidentify_file_request_file_data_format import ReidentifyFileRequestFileDataFormat -from .reidentify_file_request_format import ReidentifyFileRequestFormat +from .deidentify_file_audio_request_deidentify_audio_entity_types_item import ( + DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, +) +from .deidentify_file_audio_request_deidentify_audio_output_transcription import ( + DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, +) +from .deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item import ( + DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, +) +from .deidentify_file_image_request_deidentify_image_entity_types_item import ( + DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, +) +from .deidentify_file_image_request_deidentify_image_masking_method import ( + DeidentifyFileImageRequestDeidentifyImageMaskingMethod, +) +from .deidentify_file_request_deidentify_document_entity_types_item import ( + DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, +) +from .deidentify_file_request_deidentify_presentation_entity_types_item import ( + DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, +) +from .deidentify_file_request_deidentify_spreadsheet_entity_types_item import ( + DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, +) +from .deidentify_file_request_deidentify_structured_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, +) +from .deidentify_file_request_deidentify_text_entity_types_item import ( + DeidentifyFileRequestDeidentifyTextEntityTypesItem, +) +from .deidentify_file_request_entity_types_item import DeidentifyFileRequestEntityTypesItem __all__ = [ - "DeidentifyAudioRequestFile", - "DeidentifyAudioRequestFileDataFormat", - "DeidentifyAudioRequestOutputTranscription", - "DeidentifyDocumentRequestFile", - "DeidentifyDocumentRequestFileDataFormat", - "DeidentifyFileRequestFile", - "DeidentifyFileRequestFileDataFormat", - "DeidentifyImageRequestFile", - "DeidentifyImageRequestFileDataFormat", - "DeidentifyImageRequestMaskingMethod", - "DeidentifyPdfRequestFile", - "DeidentifyPresentationRequestFile", - "DeidentifyPresentationRequestFileDataFormat", - "DeidentifySpreadsheetRequestFile", - "DeidentifySpreadsheetRequestFileDataFormat", - "DeidentifyStructuredTextRequestFile", - "DeidentifyStructuredTextRequestFileDataFormat", - "DeidentifyTextRequestFile", - "ReidentifyFileRequestFile", - "ReidentifyFileRequestFileDataFormat", - "ReidentifyFileRequestFormat", + "DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem", + "DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription", + "DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageEntityTypesItem", + "DeidentifyFileImageRequestDeidentifyImageMaskingMethod", + "DeidentifyFileRequestDeidentifyDocumentEntityTypesItem", + "DeidentifyFileRequestDeidentifyPresentationEntityTypesItem", + "DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem", + "DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem", + "DeidentifyFileRequestDeidentifyTextEntityTypesItem", + "DeidentifyFileRequestEntityTypesItem", ] diff --git a/skyflow/generated/rest/files/types/deidentify_audio_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_audio_request_file_data_format.py deleted file mode 100644 index 85f60bbb..00000000 --- a/skyflow/generated/rest/files/types/deidentify_audio_request_file_data_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyAudioRequestFileDataFormat = typing.Union[typing.Literal["mp3", "wav"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_audio_request_output_transcription.py b/skyflow/generated/rest/files/types/deidentify_audio_request_output_transcription.py deleted file mode 100644 index 4588b1d1..00000000 --- a/skyflow/generated/rest/files/types/deidentify_audio_request_output_transcription.py +++ /dev/null @@ -1,14 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyAudioRequestOutputTranscription = typing.Union[ - typing.Literal[ - "diarized_transcription", - "medical_diarized_transcription", - "medical_transcription", - "plaintext_transcription", - "transcription", - ], - typing.Any, -] diff --git a/skyflow/generated/rest/files/types/deidentify_document_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_document_request_file_data_format.py deleted file mode 100644 index a20f4fd8..00000000 --- a/skyflow/generated/rest/files/types/deidentify_document_request_file_data_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyDocumentRequestFileDataFormat = typing.Union[typing.Literal["doc", "docx", "pdf"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_entity_types_item.py new file mode 100644 index 00000000..b22a177a --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_output_transcription.py b/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_output_transcription.py new file mode 100644 index 00000000..957cee86 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_output_transcription.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription = typing.Union[ + typing.Literal[ + "transcription", "medical_transcription", "diarized_transcription", "medical_diarized_transcription" + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py new file mode 100644 index 00000000..d8469e74 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_entity_types_item.py new file mode 100644 index 00000000..4597dc0f --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileImageRequestDeidentifyImageEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_masking_method.py b/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_masking_method.py new file mode 100644 index 00000000..c357821e --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_masking_method.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileImageRequestDeidentifyImageMaskingMethod = typing.Union[typing.Literal["blur", "blackbox"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_document_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_document_entity_types_item.py new file mode 100644 index 00000000..afcbe2ee --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_document_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestDeidentifyDocumentEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_presentation_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_presentation_entity_types_item.py new file mode 100644 index 00000000..69d40627 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_presentation_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestDeidentifyPresentationEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_spreadsheet_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_spreadsheet_entity_types_item.py new file mode 100644 index 00000000..0bb37078 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_spreadsheet_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_structured_text_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_structured_text_entity_types_item.py new file mode 100644 index 00000000..a487d969 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_structured_text_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_text_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_text_entity_types_item.py new file mode 100644 index 00000000..2e6118cd --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_deidentify_text_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestDeidentifyTextEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_entity_types_item.py b/skyflow/generated/rest/files/types/deidentify_file_request_entity_types_item.py new file mode 100644 index 00000000..6d7e8d38 --- /dev/null +++ b/skyflow/generated/rest/files/types/deidentify_file_request_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyFileRequestEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/files/types/deidentify_image_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_image_request_file_data_format.py deleted file mode 100644 index a2ca8f2a..00000000 --- a/skyflow/generated/rest/files/types/deidentify_image_request_file_data_format.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyImageRequestFileDataFormat = typing.Union[ - typing.Literal["bmp", "jpeg", "jpg", "png", "tif", "tiff"], typing.Any -] diff --git a/skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py b/skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py deleted file mode 100644 index bc0c338c..00000000 --- a/skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyImageRequestMaskingMethod = typing.Union[typing.Literal["blackbox", "blur"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_presentation_request_file.py b/skyflow/generated/rest/files/types/deidentify_presentation_request_file.py deleted file mode 100644 index c618ccc1..00000000 --- a/skyflow/generated/rest/files/types/deidentify_presentation_request_file.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_presentation_request_file_data_format import DeidentifyPresentationRequestFileDataFormat - - -class DeidentifyPresentationRequestFile(UniversalBaseModel): - """ - File to de-identify. Files are specified as Base64-encoded data. - """ - - base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() - """ - Base64-encoded data of the file to de-identify. - """ - - data_format: DeidentifyPresentationRequestFileDataFormat = pydantic.Field() - """ - Data format of the file. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/files/types/deidentify_presentation_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_presentation_request_file_data_format.py deleted file mode 100644 index d09f42f8..00000000 --- a/skyflow/generated/rest/files/types/deidentify_presentation_request_file_data_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyPresentationRequestFileDataFormat = typing.Union[typing.Literal["ppt", "pptx"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file_data_format.py deleted file mode 100644 index 20db2856..00000000 --- a/skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file_data_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifySpreadsheetRequestFileDataFormat = typing.Union[typing.Literal["csv", "xls", "xlsx"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_structured_text_request_file.py b/skyflow/generated/rest/files/types/deidentify_structured_text_request_file.py deleted file mode 100644 index aa2d0834..00000000 --- a/skyflow/generated/rest/files/types/deidentify_structured_text_request_file.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_structured_text_request_file_data_format import DeidentifyStructuredTextRequestFileDataFormat - - -class DeidentifyStructuredTextRequestFile(UniversalBaseModel): - """ - File to de-identify. Files are specified as Base64-encoded data. - """ - - base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() - """ - Base64-encoded data of the file to de-identify. - """ - - data_format: DeidentifyStructuredTextRequestFileDataFormat = pydantic.Field() - """ - Data format of the file. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/files/types/deidentify_structured_text_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_structured_text_request_file_data_format.py deleted file mode 100644 index f956fe48..00000000 --- a/skyflow/generated/rest/files/types/deidentify_structured_text_request_file_data_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyStructuredTextRequestFileDataFormat = typing.Union[typing.Literal["json", "xml"], typing.Any] diff --git a/skyflow/generated/rest/files/types/reidentify_file_request_file.py b/skyflow/generated/rest/files/types/reidentify_file_request_file.py deleted file mode 100644 index 429f22ee..00000000 --- a/skyflow/generated/rest/files/types/reidentify_file_request_file.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .reidentify_file_request_file_data_format import ReidentifyFileRequestFileDataFormat - - -class ReidentifyFileRequestFile(UniversalBaseModel): - """ - File to re-identify. Files are specified as Base64-encoded data or an EFS path. - """ - - base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() - """ - Base64-encoded data of the file to re-identify. - """ - - data_format: ReidentifyFileRequestFileDataFormat = pydantic.Field() - """ - Data format of the file. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/files/types/reidentify_file_request_file_data_format.py b/skyflow/generated/rest/files/types/reidentify_file_request_file_data_format.py deleted file mode 100644 index 5aca9bb6..00000000 --- a/skyflow/generated/rest/files/types/reidentify_file_request_file_data_format.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ReidentifyFileRequestFileDataFormat = typing.Union[ - typing.Literal["csv", "doc", "docx", "json", "txt", "xls", "xlsx", "xml"], typing.Any -] diff --git a/skyflow/generated/rest/guardrails/client.py b/skyflow/generated/rest/guardrails/client.py index e7fe1e05..88cab59d 100644 --- a/skyflow/generated/rest/guardrails/client.py +++ b/skyflow/generated/rest/guardrails/client.py @@ -4,8 +4,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions -from ..types.check_guardrails_response import CheckGuardrailsResponse -from ..types.vault_id import VaultId +from ..types.detect_guardrails_response import DetectGuardrailsResponse from .raw_client import AsyncRawGuardrailsClient, RawGuardrailsClient # this is used as the default value for optional parameters @@ -30,24 +29,25 @@ def with_raw_response(self) -> RawGuardrailsClient: def check_guardrails( self, *, - vault_id: VaultId, text: str, + vault_id: str, check_toxicity: typing.Optional[bool] = OMIT, deny_topics: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> CheckGuardrailsResponse: + ) -> DetectGuardrailsResponse: """ Preserve safety and compliance with usage policies. Parameters ---------- - vault_id : VaultId - text : str Text to check against guardrails. + vault_id : str + ID of the vault. + check_toxicity : typing.Optional[bool] - Check for toxicity in the text. + If `true`, checks for toxicity in the text. deny_topics : typing.Optional[typing.Sequence[str]] List of topics to deny. @@ -57,8 +57,8 @@ def check_guardrails( Returns ------- - CheckGuardrailsResponse - A successful response. + DetectGuardrailsResponse + OK Examples -------- @@ -68,13 +68,15 @@ def check_guardrails( token="YOUR_TOKEN", ) client.guardrails.check_guardrails( - vault_id="vault_id", - text="text", + text="I love to play cricket.", + check_toxicity=True, + deny_topics=["sports"], + vault_id="$VAULT_ID", ) """ _response = self._raw_client.check_guardrails( - vault_id=vault_id, text=text, + vault_id=vault_id, check_toxicity=check_toxicity, deny_topics=deny_topics, request_options=request_options, @@ -100,24 +102,25 @@ def with_raw_response(self) -> AsyncRawGuardrailsClient: async def check_guardrails( self, *, - vault_id: VaultId, text: str, + vault_id: str, check_toxicity: typing.Optional[bool] = OMIT, deny_topics: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> CheckGuardrailsResponse: + ) -> DetectGuardrailsResponse: """ Preserve safety and compliance with usage policies. Parameters ---------- - vault_id : VaultId - text : str Text to check against guardrails. + vault_id : str + ID of the vault. + check_toxicity : typing.Optional[bool] - Check for toxicity in the text. + If `true`, checks for toxicity in the text. deny_topics : typing.Optional[typing.Sequence[str]] List of topics to deny. @@ -127,8 +130,8 @@ async def check_guardrails( Returns ------- - CheckGuardrailsResponse - A successful response. + DetectGuardrailsResponse + OK Examples -------- @@ -143,16 +146,18 @@ async def check_guardrails( async def main() -> None: await client.guardrails.check_guardrails( - vault_id="vault_id", - text="text", + text="I love to play cricket.", + check_toxicity=True, + deny_topics=["sports"], + vault_id="$VAULT_ID", ) asyncio.run(main()) """ _response = await self._raw_client.check_guardrails( - vault_id=vault_id, text=text, + vault_id=vault_id, check_toxicity=check_toxicity, deny_topics=deny_topics, request_options=request_options, diff --git a/skyflow/generated/rest/guardrails/raw_client.py b/skyflow/generated/rest/guardrails/raw_client.py index 11030fd3..1328b1b8 100644 --- a/skyflow/generated/rest/guardrails/raw_client.py +++ b/skyflow/generated/rest/guardrails/raw_client.py @@ -11,9 +11,8 @@ from ..errors.bad_request_error import BadRequestError from ..errors.internal_server_error import InternalServerError from ..errors.unauthorized_error import UnauthorizedError -from ..types.check_guardrails_response import CheckGuardrailsResponse +from ..types.detect_guardrails_response import DetectGuardrailsResponse from ..types.error_response import ErrorResponse -from ..types.vault_id import VaultId # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -26,24 +25,25 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def check_guardrails( self, *, - vault_id: VaultId, text: str, + vault_id: str, check_toxicity: typing.Optional[bool] = OMIT, deny_topics: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[CheckGuardrailsResponse]: + ) -> HttpResponse[DetectGuardrailsResponse]: """ Preserve safety and compliance with usage policies. Parameters ---------- - vault_id : VaultId - text : str Text to check against guardrails. + vault_id : str + ID of the vault. + check_toxicity : typing.Optional[bool] - Check for toxicity in the text. + If `true`, checks for toxicity in the text. deny_topics : typing.Optional[typing.Sequence[str]] List of topics to deny. @@ -53,17 +53,17 @@ def check_guardrails( Returns ------- - HttpResponse[CheckGuardrailsResponse] - A successful response. + HttpResponse[DetectGuardrailsResponse] + OK """ _response = self._client_wrapper.httpx_client.request( "v1/detect/guardrails", method="POST", json={ - "vault_id": vault_id, "text": text, "check_toxicity": check_toxicity, "deny_topics": deny_topics, + "vault_id": vault_id, }, headers={ "content-type": "application/json", @@ -74,9 +74,9 @@ def check_guardrails( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CheckGuardrailsResponse, + DetectGuardrailsResponse, parse_obj_as( - type_=CheckGuardrailsResponse, # type: ignore + type_=DetectGuardrailsResponse, # type: ignore object_=_response.json(), ), ) @@ -127,24 +127,25 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def check_guardrails( self, *, - vault_id: VaultId, text: str, + vault_id: str, check_toxicity: typing.Optional[bool] = OMIT, deny_topics: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CheckGuardrailsResponse]: + ) -> AsyncHttpResponse[DetectGuardrailsResponse]: """ Preserve safety and compliance with usage policies. Parameters ---------- - vault_id : VaultId - text : str Text to check against guardrails. + vault_id : str + ID of the vault. + check_toxicity : typing.Optional[bool] - Check for toxicity in the text. + If `true`, checks for toxicity in the text. deny_topics : typing.Optional[typing.Sequence[str]] List of topics to deny. @@ -154,17 +155,17 @@ async def check_guardrails( Returns ------- - AsyncHttpResponse[CheckGuardrailsResponse] - A successful response. + AsyncHttpResponse[DetectGuardrailsResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( "v1/detect/guardrails", method="POST", json={ - "vault_id": vault_id, "text": text, "check_toxicity": check_toxicity, "deny_topics": deny_topics, + "vault_id": vault_id, }, headers={ "content-type": "application/json", @@ -175,9 +176,9 @@ async def check_guardrails( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CheckGuardrailsResponse, + DetectGuardrailsResponse, parse_obj_as( - type_=CheckGuardrailsResponse, # type: ignore + type_=DetectGuardrailsResponse, # type: ignore object_=_response.json(), ), ) diff --git a/skyflow/generated/rest/records/client.py b/skyflow/generated/rest/records/client.py index cfe15a1c..1b5ddeb7 100644 --- a/skyflow/generated/rest/records/client.py +++ b/skyflow/generated/rest/records/client.py @@ -192,6 +192,13 @@ def record_service_bulk_get_record( client.records.record_service_bulk_get_record( vault_id="vaultID", object_name="objectName", + redaction="DEFAULT", + tokenization=True, + offset="offset", + limit="limit", + download_url=True, + column_name="column_name", + order_by="ASCENDING", ) """ _response = self._raw_client.record_service_bulk_get_record( @@ -409,6 +416,9 @@ def record_service_get_record( vault_id="vaultID", object_name="objectName", id="ID", + redaction="DEFAULT", + tokenization=True, + download_url=True, ) """ _response = self._raw_client.record_service_get_record( @@ -947,6 +957,13 @@ async def main() -> None: await client.records.record_service_bulk_get_record( vault_id="vaultID", object_name="objectName", + redaction="DEFAULT", + tokenization=True, + offset="offset", + limit="limit", + download_url=True, + column_name="column_name", + order_by="ASCENDING", ) @@ -1188,6 +1205,9 @@ async def main() -> None: vault_id="vaultID", object_name="objectName", id="ID", + redaction="DEFAULT", + tokenization=True, + download_url=True, ) diff --git a/skyflow/generated/rest/strings/__init__.py b/skyflow/generated/rest/strings/__init__.py index 4cabb7fb..50bdd77e 100644 --- a/skyflow/generated/rest/strings/__init__.py +++ b/skyflow/generated/rest/strings/__init__.py @@ -2,6 +2,6 @@ # isort: skip_file -from .types import ReidentifyStringRequestFormat +from .types import DeidentifyStringRequestEntityTypesItem -__all__ = ["ReidentifyStringRequestFormat"] +__all__ = ["DeidentifyStringRequestEntityTypesItem"] diff --git a/skyflow/generated/rest/strings/client.py b/skyflow/generated/rest/strings/client.py index 14b2266d..88d8c2c2 100644 --- a/skyflow/generated/rest/strings/client.py +++ b/skyflow/generated/rest/strings/client.py @@ -4,17 +4,13 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions -from ..types.allow_regex import AllowRegex -from ..types.configuration_id import ConfigurationId from ..types.deidentify_string_response import DeidentifyStringResponse -from ..types.entity_types import EntityTypes -from ..types.reidentify_string_response import ReidentifyStringResponse -from ..types.restrict_regex import RestrictRegex -from ..types.token_type import TokenType +from ..types.format import Format +from ..types.identify_response import IdentifyResponse +from ..types.token_type_mapping import TokenTypeMapping from ..types.transformations import Transformations -from ..types.vault_id import VaultId from .raw_client import AsyncRawStringsClient, RawStringsClient -from .types.reidentify_string_request_format import ReidentifyStringRequestFormat +from .types.deidentify_string_request_entity_types_item import DeidentifyStringRequestEntityTypesItem # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -38,14 +34,14 @@ def with_raw_response(self) -> RawStringsClient: def deidentify_string( self, *, - vault_id: VaultId, text: str, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenType] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyStringResponse: """ @@ -53,30 +49,35 @@ def deidentify_string( Parameters ---------- - vault_id : VaultId - text : str - String to de-identify. + Text to de-identify. - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenType] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyStringResponse - A successful response. + OK Examples -------- @@ -86,19 +87,19 @@ def deidentify_string( token="YOUR_TOKEN", ) client.strings.deidentify_string( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - text="My name is John Doe, and my email is johndoe@acme.com.", + text="text", + vault_id="f4b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b", ) """ _response = self._raw_client.deidentify_string( - vault_id=vault_id, text=text, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data @@ -106,32 +107,31 @@ def deidentify_string( def reidentify_string( self, *, - text: str, - vault_id: str, - format: typing.Optional[ReidentifyStringRequestFormat] = OMIT, + text: typing.Optional[str] = OMIT, + vault_id: typing.Optional[str] = OMIT, + format: typing.Optional[Format] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> ReidentifyStringResponse: + ) -> IdentifyResponse: """ Re-identifies tokens in a string. Parameters ---------- - text : str - String to re-identify. + text : typing.Optional[str] + Text to reidentify. - vault_id : str + vault_id : typing.Optional[str] ID of the vault where the entities are stored. - format : typing.Optional[ReidentifyStringRequestFormat] - Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ReidentifyStringResponse - A successful response. + IdentifyResponse + OK Examples -------- @@ -140,10 +140,7 @@ def reidentify_string( client = Skyflow( token="YOUR_TOKEN", ) - client.strings.reidentify_string( - text="My name is [NAME_1], and my email is [EMAIL_1].", - vault_id="1ad6db07-8405-46cf-9a1e-db148ff9f4c5", - ) + client.strings.reidentify_string() """ _response = self._raw_client.reidentify_string( text=text, vault_id=vault_id, format=format, request_options=request_options @@ -169,14 +166,14 @@ def with_raw_response(self) -> AsyncRawStringsClient: async def deidentify_string( self, *, - vault_id: VaultId, text: str, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenType] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeidentifyStringResponse: """ @@ -184,30 +181,35 @@ async def deidentify_string( Parameters ---------- - vault_id : VaultId - text : str - String to de-identify. + Text to de-identify. - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenType] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeidentifyStringResponse - A successful response. + OK Examples -------- @@ -222,22 +224,22 @@ async def deidentify_string( async def main() -> None: await client.strings.deidentify_string( - vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b", - text="My name is John Doe, and my email is johndoe@acme.com.", + text="text", + vault_id="f4b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b", ) asyncio.run(main()) """ _response = await self._raw_client.deidentify_string( - vault_id=vault_id, text=text, - configuration_id=configuration_id, + vault_id=vault_id, entity_types=entity_types, token_type=token_type, allow_regex=allow_regex, restrict_regex=restrict_regex, transformations=transformations, + configuration_id=configuration_id, request_options=request_options, ) return _response.data @@ -245,32 +247,31 @@ async def main() -> None: async def reidentify_string( self, *, - text: str, - vault_id: str, - format: typing.Optional[ReidentifyStringRequestFormat] = OMIT, + text: typing.Optional[str] = OMIT, + vault_id: typing.Optional[str] = OMIT, + format: typing.Optional[Format] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> ReidentifyStringResponse: + ) -> IdentifyResponse: """ Re-identifies tokens in a string. Parameters ---------- - text : str - String to re-identify. + text : typing.Optional[str] + Text to reidentify. - vault_id : str + vault_id : typing.Optional[str] ID of the vault where the entities are stored. - format : typing.Optional[ReidentifyStringRequestFormat] - Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ReidentifyStringResponse - A successful response. + IdentifyResponse + OK Examples -------- @@ -284,10 +285,7 @@ async def reidentify_string( async def main() -> None: - await client.strings.reidentify_string( - text="My name is [NAME_1], and my email is [EMAIL_1].", - vault_id="1ad6db07-8405-46cf-9a1e-db148ff9f4c5", - ) + await client.strings.reidentify_string() asyncio.run(main()) diff --git a/skyflow/generated/rest/strings/raw_client.py b/skyflow/generated/rest/strings/raw_client.py index 3ae9bf41..313c10ce 100644 --- a/skyflow/generated/rest/strings/raw_client.py +++ b/skyflow/generated/rest/strings/raw_client.py @@ -12,17 +12,13 @@ from ..errors.bad_request_error import BadRequestError from ..errors.internal_server_error import InternalServerError from ..errors.unauthorized_error import UnauthorizedError -from ..types.allow_regex import AllowRegex -from ..types.configuration_id import ConfigurationId from ..types.deidentify_string_response import DeidentifyStringResponse -from ..types.entity_types import EntityTypes from ..types.error_response import ErrorResponse -from ..types.reidentify_string_response import ReidentifyStringResponse -from ..types.restrict_regex import RestrictRegex -from ..types.token_type import TokenType +from ..types.format import Format +from ..types.identify_response import IdentifyResponse +from ..types.token_type_mapping import TokenTypeMapping from ..types.transformations import Transformations -from ..types.vault_id import VaultId -from .types.reidentify_string_request_format import ReidentifyStringRequestFormat +from .types.deidentify_string_request_entity_types_item import DeidentifyStringRequestEntityTypesItem # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -35,14 +31,14 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def deidentify_string( self, *, - vault_id: VaultId, text: str, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenType] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeidentifyStringResponse]: """ @@ -50,47 +46,52 @@ def deidentify_string( Parameters ---------- - vault_id : VaultId - text : str - String to de-identify. + Text to de-identify. - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenType] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeidentifyStringResponse] - A successful response. + OK """ _response = self._client_wrapper.httpx_client.request( "v1/detect/deidentify/string", method="POST", json={ - "vault_id": vault_id, "text": text, - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenType, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -149,32 +150,31 @@ def deidentify_string( def reidentify_string( self, *, - text: str, - vault_id: str, - format: typing.Optional[ReidentifyStringRequestFormat] = OMIT, + text: typing.Optional[str] = OMIT, + vault_id: typing.Optional[str] = OMIT, + format: typing.Optional[Format] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[ReidentifyStringResponse]: + ) -> HttpResponse[IdentifyResponse]: """ Re-identifies tokens in a string. Parameters ---------- - text : str - String to re-identify. + text : typing.Optional[str] + Text to reidentify. - vault_id : str + vault_id : typing.Optional[str] ID of the vault where the entities are stored. - format : typing.Optional[ReidentifyStringRequestFormat] - Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[ReidentifyStringResponse] - A successful response. + HttpResponse[IdentifyResponse] + OK """ _response = self._client_wrapper.httpx_client.request( "v1/detect/reidentify/string", @@ -182,9 +182,7 @@ def reidentify_string( json={ "text": text, "vault_id": vault_id, - "format": convert_and_respect_annotation_metadata( - object_=format, annotation=ReidentifyStringRequestFormat, direction="write" - ), + "format": convert_and_respect_annotation_metadata(object_=format, annotation=Format, direction="write"), }, headers={ "content-type": "application/json", @@ -195,9 +193,9 @@ def reidentify_string( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ReidentifyStringResponse, + IdentifyResponse, parse_obj_as( - type_=ReidentifyStringResponse, # type: ignore + type_=IdentifyResponse, # type: ignore object_=_response.json(), ), ) @@ -248,14 +246,14 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def deidentify_string( self, *, - vault_id: VaultId, text: str, - configuration_id: typing.Optional[ConfigurationId] = OMIT, - entity_types: typing.Optional[EntityTypes] = OMIT, - token_type: typing.Optional[TokenType] = OMIT, - allow_regex: typing.Optional[AllowRegex] = OMIT, - restrict_regex: typing.Optional[RestrictRegex] = OMIT, + vault_id: str, + entity_types: typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] = OMIT, + token_type: typing.Optional[TokenTypeMapping] = OMIT, + allow_regex: typing.Optional[typing.Sequence[str]] = OMIT, + restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT, transformations: typing.Optional[Transformations] = OMIT, + configuration_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeidentifyStringResponse]: """ @@ -263,47 +261,52 @@ async def deidentify_string( Parameters ---------- - vault_id : VaultId - text : str - String to de-identify. + Text to de-identify. - configuration_id : typing.Optional[ConfigurationId] + vault_id : str + ID of a vault that you have Detect Invoker or Vault Owner permissions for. - entity_types : typing.Optional[EntityTypes] + entity_types : typing.Optional[typing.Sequence[DeidentifyStringRequestEntityTypesItem]] + Entities to detect and de-identify. - token_type : typing.Optional[TokenType] + token_type : typing.Optional[TokenTypeMapping] - allow_regex : typing.Optional[AllowRegex] + allow_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to display in plaintext. Entities appear in plaintext if an expression matches either the entirety of a detected entity or a substring of it. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. - restrict_regex : typing.Optional[RestrictRegex] + restrict_regex : typing.Optional[typing.Sequence[str]] + Regular expressions to replace with '[RESTRICTED]'. Expressions must match the entirety of a detected entity, not just a substring, for the entity to be restricted. Expressions don't match across entity boundaries. If a string or entity matches both `allow_regex` and `restrict_regex`, the entity is displayed in plaintext. If a string is detected as an entity and a `restrict_regex` pattern matches the entire detected entity, the entity is replaced with '[RESTRICTED]'. If a string is detected as an entity but a `restrict_regex` pattern only matches a substring of it, the `restrict_regex` pattern is ignored, and the entity is processed according to the specified tokenization and transformation settings. transformations : typing.Optional[Transformations] + configuration_id : typing.Optional[str] + ID of the Detect configuration to use for de-identification. Can't be specified with fields other than `vault_id`, `text`, and `file`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeidentifyStringResponse] - A successful response. + OK """ _response = await self._client_wrapper.httpx_client.request( "v1/detect/deidentify/string", method="POST", json={ - "vault_id": vault_id, "text": text, - "configuration_id": configuration_id, + "vault_id": vault_id, "entity_types": entity_types, "token_type": convert_and_respect_annotation_metadata( - object_=token_type, annotation=TokenType, direction="write" + object_=token_type, annotation=TokenTypeMapping, direction="write" ), "allow_regex": allow_regex, "restrict_regex": restrict_regex, "transformations": convert_and_respect_annotation_metadata( object_=transformations, annotation=Transformations, direction="write" ), + "configuration_id": configuration_id, }, headers={ "content-type": "application/json", @@ -362,32 +365,31 @@ async def deidentify_string( async def reidentify_string( self, *, - text: str, - vault_id: str, - format: typing.Optional[ReidentifyStringRequestFormat] = OMIT, + text: typing.Optional[str] = OMIT, + vault_id: typing.Optional[str] = OMIT, + format: typing.Optional[Format] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ReidentifyStringResponse]: + ) -> AsyncHttpResponse[IdentifyResponse]: """ Re-identifies tokens in a string. Parameters ---------- - text : str - String to re-identify. + text : typing.Optional[str] + Text to reidentify. - vault_id : str + vault_id : typing.Optional[str] ID of the vault where the entities are stored. - format : typing.Optional[ReidentifyStringRequestFormat] - Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. + format : typing.Optional[Format] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[ReidentifyStringResponse] - A successful response. + AsyncHttpResponse[IdentifyResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( "v1/detect/reidentify/string", @@ -395,9 +397,7 @@ async def reidentify_string( json={ "text": text, "vault_id": vault_id, - "format": convert_and_respect_annotation_metadata( - object_=format, annotation=ReidentifyStringRequestFormat, direction="write" - ), + "format": convert_and_respect_annotation_metadata(object_=format, annotation=Format, direction="write"), }, headers={ "content-type": "application/json", @@ -408,9 +408,9 @@ async def reidentify_string( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ReidentifyStringResponse, + IdentifyResponse, parse_obj_as( - type_=ReidentifyStringResponse, # type: ignore + type_=IdentifyResponse, # type: ignore object_=_response.json(), ), ) diff --git a/skyflow/generated/rest/strings/types/__init__.py b/skyflow/generated/rest/strings/types/__init__.py index 97d06583..592fae37 100644 --- a/skyflow/generated/rest/strings/types/__init__.py +++ b/skyflow/generated/rest/strings/types/__init__.py @@ -2,6 +2,6 @@ # isort: skip_file -from .reidentify_string_request_format import ReidentifyStringRequestFormat +from .deidentify_string_request_entity_types_item import DeidentifyStringRequestEntityTypesItem -__all__ = ["ReidentifyStringRequestFormat"] +__all__ = ["DeidentifyStringRequestEntityTypesItem"] diff --git a/skyflow/generated/rest/strings/types/deidentify_string_request_entity_types_item.py b/skyflow/generated/rest/strings/types/deidentify_string_request_entity_types_item.py new file mode 100644 index 00000000..bde5d084 --- /dev/null +++ b/skyflow/generated/rest/strings/types/deidentify_string_request_entity_types_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifyStringRequestEntityTypesItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/strings/types/reidentify_string_request_format.py b/skyflow/generated/rest/strings/types/reidentify_string_request_format.py deleted file mode 100644 index bfda392c..00000000 --- a/skyflow/generated/rest/strings/types/reidentify_string_request_format.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.entity_type import EntityType - - -class ReidentifyStringRequestFormat(UniversalBaseModel): - """ - Mapping of perferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. - """ - - redacted: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to fully redact. - """ - - masked: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to mask. - """ - - plaintext: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to return in plaintext. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/__init__.py b/skyflow/generated/rest/types/__init__.py index aa9b4a35..75979081 100644 --- a/skyflow/generated/rest/types/__init__.py +++ b/skyflow/generated/rest/types/__init__.py @@ -2,49 +2,69 @@ # isort: skip_file -from .allow_regex import AllowRegex from .audit_event_audit_resource_type import AuditEventAuditResourceType from .audit_event_context import AuditEventContext from .audit_event_data import AuditEventData from .audit_event_http_info import AuditEventHttpInfo from .batch_record_method import BatchRecordMethod -from .check_guardrails_response import CheckGuardrailsResponse -from .check_guardrails_response_validation import CheckGuardrailsResponseValidation -from .configuration_id import ConfigurationId from .context_access_type import ContextAccessType from .context_auth_mode import ContextAuthMode -from .deidentify_file_output import DeidentifyFileOutput -from .deidentify_file_output_processed_file_type import DeidentifyFileOutputProcessedFileType +from .deidentified_file_output import DeidentifiedFileOutput +from .deidentified_file_output_processed_file_extension import DeidentifiedFileOutputProcessedFileExtension +from .deidentified_file_output_processed_file_type import DeidentifiedFileOutputProcessedFileType from .deidentify_file_response import DeidentifyFileResponse -from .deidentify_status_response import DeidentifyStatusResponse -from .deidentify_status_response_output_type import DeidentifyStatusResponseOutputType -from .deidentify_status_response_status import DeidentifyStatusResponseStatus from .deidentify_string_response import DeidentifyStringResponse -from .detected_entity import DetectedEntity +from .detect_guardrails_response import DetectGuardrailsResponse +from .detect_guardrails_response_validation import DetectGuardrailsResponseValidation +from .detect_runs_response import DetectRunsResponse +from .detect_runs_response_output_type import DetectRunsResponseOutputType +from .detect_runs_response_status import DetectRunsResponseStatus from .detokenize_record_response_value_type import DetokenizeRecordResponseValueType -from .entity_location import EntityLocation -from .entity_type import EntityType -from .entity_types import EntityTypes from .error_response import ErrorResponse from .error_response_error import ErrorResponseError -from .error_string import ErrorString +from .file_data import FileData +from .file_data_data_format import FileDataDataFormat +from .file_data_deidentify_audio import FileDataDeidentifyAudio +from .file_data_deidentify_audio_data_format import FileDataDeidentifyAudioDataFormat +from .file_data_deidentify_document import FileDataDeidentifyDocument +from .file_data_deidentify_document_data_format import FileDataDeidentifyDocumentDataFormat +from .file_data_deidentify_image import FileDataDeidentifyImage +from .file_data_deidentify_image_data_format import FileDataDeidentifyImageDataFormat +from .file_data_deidentify_pdf import FileDataDeidentifyPdf +from .file_data_deidentify_presentation import FileDataDeidentifyPresentation +from .file_data_deidentify_presentation_data_format import FileDataDeidentifyPresentationDataFormat +from .file_data_deidentify_spreadsheet import FileDataDeidentifySpreadsheet +from .file_data_deidentify_spreadsheet_data_format import FileDataDeidentifySpreadsheetDataFormat +from .file_data_deidentify_structured_text import FileDataDeidentifyStructuredText +from .file_data_deidentify_structured_text_data_format import FileDataDeidentifyStructuredTextDataFormat +from .file_data_deidentify_text import FileDataDeidentifyText +from .file_data_reidentify_file import FileDataReidentifyFile +from .file_data_reidentify_file_data_format import FileDataReidentifyFileDataFormat +from .format import Format +from .format_masked_item import FormatMaskedItem +from .format_plaintext_item import FormatPlaintextItem +from .format_redacted_item import FormatRedactedItem from .googlerpc_status import GooglerpcStatus +from .http_code import HttpCode +from .identify_response import IdentifyResponse from .protobuf_any import ProtobufAny from .redaction_enum_redaction import RedactionEnumRedaction +from .reidentified_file_output import ReidentifiedFileOutput +from .reidentified_file_output_processed_file_extension import ReidentifiedFileOutputProcessedFileExtension from .reidentify_file_response import ReidentifyFileResponse -from .reidentify_file_response_output import ReidentifyFileResponseOutput +from .reidentify_file_response_output_type import ReidentifyFileResponseOutputType from .reidentify_file_response_status import ReidentifyFileResponseStatus -from .reidentify_string_response import ReidentifyStringResponse from .request_action_type import RequestActionType from .resource_id import ResourceId -from .restrict_regex import RestrictRegex -from .token_type import TokenType -from .token_type_default import TokenTypeDefault -from .token_type_without_vault import TokenTypeWithoutVault -from .token_type_without_vault_default import TokenTypeWithoutVaultDefault +from .shift_dates import ShiftDates +from .shift_dates_entity_types_item import ShiftDatesEntityTypesItem +from .string_response_entities import StringResponseEntities +from .token_type_mapping import TokenTypeMapping +from .token_type_mapping_default import TokenTypeMappingDefault +from .token_type_mapping_entity_only_item import TokenTypeMappingEntityOnlyItem +from .token_type_mapping_entity_unq_counter_item import TokenTypeMappingEntityUnqCounterItem +from .token_type_mapping_vault_token_item import TokenTypeMappingVaultTokenItem from .transformations import Transformations -from .transformations_shift_dates import TransformationsShiftDates -from .transformations_shift_dates_entity_types_item import TransformationsShiftDatesEntityTypesItem from .upload_file_v_2_response import UploadFileV2Response from .uuid_ import Uuid from .v_1_audit_after_options import V1AuditAfterOptions @@ -78,52 +98,72 @@ from .v_1_update_record_response import V1UpdateRecordResponse from .v_1_vault_field_mapping import V1VaultFieldMapping from .v_1_vault_schema_config import V1VaultSchemaConfig -from .vault_id import VaultId +from .word_character_count import WordCharacterCount __all__ = [ - "AllowRegex", "AuditEventAuditResourceType", "AuditEventContext", "AuditEventData", "AuditEventHttpInfo", "BatchRecordMethod", - "CheckGuardrailsResponse", - "CheckGuardrailsResponseValidation", - "ConfigurationId", "ContextAccessType", "ContextAuthMode", - "DeidentifyFileOutput", - "DeidentifyFileOutputProcessedFileType", + "DeidentifiedFileOutput", + "DeidentifiedFileOutputProcessedFileExtension", + "DeidentifiedFileOutputProcessedFileType", "DeidentifyFileResponse", - "DeidentifyStatusResponse", - "DeidentifyStatusResponseOutputType", - "DeidentifyStatusResponseStatus", "DeidentifyStringResponse", - "DetectedEntity", + "DetectGuardrailsResponse", + "DetectGuardrailsResponseValidation", + "DetectRunsResponse", + "DetectRunsResponseOutputType", + "DetectRunsResponseStatus", "DetokenizeRecordResponseValueType", - "EntityLocation", - "EntityType", - "EntityTypes", "ErrorResponse", "ErrorResponseError", - "ErrorString", + "FileData", + "FileDataDataFormat", + "FileDataDeidentifyAudio", + "FileDataDeidentifyAudioDataFormat", + "FileDataDeidentifyDocument", + "FileDataDeidentifyDocumentDataFormat", + "FileDataDeidentifyImage", + "FileDataDeidentifyImageDataFormat", + "FileDataDeidentifyPdf", + "FileDataDeidentifyPresentation", + "FileDataDeidentifyPresentationDataFormat", + "FileDataDeidentifySpreadsheet", + "FileDataDeidentifySpreadsheetDataFormat", + "FileDataDeidentifyStructuredText", + "FileDataDeidentifyStructuredTextDataFormat", + "FileDataDeidentifyText", + "FileDataReidentifyFile", + "FileDataReidentifyFileDataFormat", + "Format", + "FormatMaskedItem", + "FormatPlaintextItem", + "FormatRedactedItem", "GooglerpcStatus", + "HttpCode", + "IdentifyResponse", "ProtobufAny", "RedactionEnumRedaction", + "ReidentifiedFileOutput", + "ReidentifiedFileOutputProcessedFileExtension", "ReidentifyFileResponse", - "ReidentifyFileResponseOutput", + "ReidentifyFileResponseOutputType", "ReidentifyFileResponseStatus", - "ReidentifyStringResponse", "RequestActionType", "ResourceId", - "RestrictRegex", - "TokenType", - "TokenTypeDefault", - "TokenTypeWithoutVault", - "TokenTypeWithoutVaultDefault", + "ShiftDates", + "ShiftDatesEntityTypesItem", + "StringResponseEntities", + "TokenTypeMapping", + "TokenTypeMappingDefault", + "TokenTypeMappingEntityOnlyItem", + "TokenTypeMappingEntityUnqCounterItem", + "TokenTypeMappingVaultTokenItem", "Transformations", - "TransformationsShiftDates", - "TransformationsShiftDatesEntityTypesItem", "UploadFileV2Response", "Uuid", "V1AuditAfterOptions", @@ -157,5 +197,5 @@ "V1UpdateRecordResponse", "V1VaultFieldMapping", "V1VaultSchemaConfig", - "VaultId", + "WordCharacterCount", ] diff --git a/skyflow/generated/rest/types/allow_regex.py b/skyflow/generated/rest/types/allow_regex.py deleted file mode 100644 index f4164375..00000000 --- a/skyflow/generated/rest/types/allow_regex.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AllowRegex = typing.List[str] diff --git a/skyflow/generated/rest/types/check_guardrails_response_validation.py b/skyflow/generated/rest/types/check_guardrails_response_validation.py deleted file mode 100644 index dcb0b789..00000000 --- a/skyflow/generated/rest/types/check_guardrails_response_validation.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -CheckGuardrailsResponseValidation = typing.Union[typing.Literal["failed", "passed"], typing.Any] diff --git a/skyflow/generated/rest/types/configuration_id.py b/skyflow/generated/rest/types/configuration_id.py deleted file mode 100644 index 763ae161..00000000 --- a/skyflow/generated/rest/types/configuration_id.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -ConfigurationId = str diff --git a/skyflow/generated/rest/types/deidentified_file_output.py b/skyflow/generated/rest/types/deidentified_file_output.py new file mode 100644 index 00000000..387f57f2 --- /dev/null +++ b/skyflow/generated/rest/types/deidentified_file_output.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .deidentified_file_output_processed_file_extension import DeidentifiedFileOutputProcessedFileExtension +from .deidentified_file_output_processed_file_type import DeidentifiedFileOutputProcessedFileType + + +class DeidentifiedFileOutput(UniversalBaseModel): + """ + Details of output files. Files are specified as Base64-encoded data. + """ + + processed_file: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="processedFile")] = ( + pydantic.Field(default=None) + ) + """ + File content in Base64 format. + """ + + processed_file_type: typing_extensions.Annotated[ + typing.Optional[DeidentifiedFileOutputProcessedFileType], FieldMetadata(alias="processedFileType") + ] = pydantic.Field(default=None) + """ + Type of the processed file. + """ + + processed_file_extension: typing_extensions.Annotated[ + typing.Optional[DeidentifiedFileOutputProcessedFileExtension], FieldMetadata(alias="processedFileExtension") + ] = pydantic.Field(default=None) + """ + Extension of the processed file. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/deidentified_file_output_processed_file_extension.py b/skyflow/generated/rest/types/deidentified_file_output_processed_file_extension.py new file mode 100644 index 00000000..dc3a8519 --- /dev/null +++ b/skyflow/generated/rest/types/deidentified_file_output_processed_file_extension.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeidentifiedFileOutputProcessedFileExtension = typing.Union[ + typing.Literal[ + "mp3", + "wav", + "pdf", + "txt", + "csv", + "json", + "jpg", + "jpeg", + "tif", + "tiff", + "png", + "bmp", + "xls", + "xlsx", + "doc", + "docx", + "ppt", + "pptx", + "xml", + "dcm", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/deidentify_file_output_processed_file_type.py b/skyflow/generated/rest/types/deidentified_file_output_processed_file_type.py similarity index 55% rename from skyflow/generated/rest/types/deidentify_file_output_processed_file_type.py rename to skyflow/generated/rest/types/deidentified_file_output_processed_file_type.py index 332ce445..ca5aadfc 100644 --- a/skyflow/generated/rest/types/deidentify_file_output_processed_file_type.py +++ b/skyflow/generated/rest/types/deidentified_file_output_processed_file_type.py @@ -2,18 +2,15 @@ import typing -DeidentifyFileOutputProcessedFileType = typing.Union[ +DeidentifiedFileOutputProcessedFileType = typing.Union[ typing.Literal[ - "entities", - "plaintext_transcription", "redacted_audio", - "redacted_diarized_transcription", - "redacted_file", "redacted_image", - "redacted_medical_diarized_transcription", - "redacted_medical_transcription", - "redacted_text", "redacted_transcription", + "redacted_file", + "redacted_text", + "entities", + "redacted_transcription_diarize_json", ], typing.Any, ] diff --git a/skyflow/generated/rest/types/deidentify_file_response.py b/skyflow/generated/rest/types/deidentify_file_response.py index e4e6bf35..4c4503f4 100644 --- a/skyflow/generated/rest/types/deidentify_file_response.py +++ b/skyflow/generated/rest/types/deidentify_file_response.py @@ -8,12 +8,12 @@ class DeidentifyFileResponse(UniversalBaseModel): """ - Response to de-identify a file. + Response to deidentify a file. """ - run_id: str = pydantic.Field() + run_id: typing.Optional[str] = pydantic.Field(default=None) """ - Status URL for the detect run. + Status URL for the Detect run. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/deidentify_status_response.py b/skyflow/generated/rest/types/deidentify_status_response.py deleted file mode 100644 index 68a6cd3f..00000000 --- a/skyflow/generated/rest/types/deidentify_status_response.py +++ /dev/null @@ -1,74 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .deidentify_file_output import DeidentifyFileOutput -from .deidentify_status_response_output_type import DeidentifyStatusResponseOutputType -from .deidentify_status_response_status import DeidentifyStatusResponseStatus - - -class DeidentifyStatusResponse(UniversalBaseModel): - """ - Response to get the status of a detect run. - """ - - status: DeidentifyStatusResponseStatus = pydantic.Field() - """ - Status of the detect run. - """ - - output: typing.List[DeidentifyFileOutput] = pydantic.Field() - """ - How the input file was specified. - """ - - output_type: typing.Optional[DeidentifyStatusResponseOutputType] = pydantic.Field(default=None) - """ - How the output file is specified. - """ - - message: str = pydantic.Field() - """ - Status details about the detect run. - """ - - word_count: typing.Optional[int] = pydantic.Field(default=None) - """ - Number of words in the processed text. - """ - - character_count: typing.Optional[int] = pydantic.Field(default=None) - """ - Number of characters in the processed text. - """ - - size: typing.Optional[float] = pydantic.Field(default=None) - """ - Size of the processed text in kilobytes (KB). - """ - - duration: typing.Optional[float] = pydantic.Field(default=None) - """ - Duration of the processed audio in seconds. - """ - - pages: typing.Optional[int] = pydantic.Field(default=None) - """ - Number of pages in the processed PDF. - """ - - slides: typing.Optional[int] = pydantic.Field(default=None) - """ - Number of slides in the processed presentation. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/deidentify_status_response_output_type.py b/skyflow/generated/rest/types/deidentify_status_response_output_type.py deleted file mode 100644 index 051cc31a..00000000 --- a/skyflow/generated/rest/types/deidentify_status_response_output_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyStatusResponseOutputType = typing.Union[typing.Literal["BASE64", "UNKNOWN"], typing.Any] diff --git a/skyflow/generated/rest/types/deidentify_status_response_status.py b/skyflow/generated/rest/types/deidentify_status_response_status.py deleted file mode 100644 index 9ec2931b..00000000 --- a/skyflow/generated/rest/types/deidentify_status_response_status.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DeidentifyStatusResponseStatus = typing.Union[typing.Literal["FAILED", "IN_PROGRESS", "SUCCESS", "UNKNOWN"], typing.Any] diff --git a/skyflow/generated/rest/types/deidentify_string_response.py b/skyflow/generated/rest/types/deidentify_string_response.py index c141f841..4655f80b 100644 --- a/skyflow/generated/rest/types/deidentify_string_response.py +++ b/skyflow/generated/rest/types/deidentify_string_response.py @@ -4,7 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .detected_entity import DetectedEntity +from .string_response_entities import StringResponseEntities class DeidentifyStringResponse(UniversalBaseModel): @@ -12,22 +12,22 @@ class DeidentifyStringResponse(UniversalBaseModel): Response to deidentify a string. """ - processed_text: str = pydantic.Field() + processed_text: typing.Optional[str] = pydantic.Field(default=None) """ De-identified text. """ - entities: typing.List[DetectedEntity] = pydantic.Field() + entities: typing.Optional[typing.List[StringResponseEntities]] = pydantic.Field(default=None) """ Detected entities. """ - word_count: int = pydantic.Field() + word_count: typing.Optional[int] = pydantic.Field(default=None) """ Number of words from the input text. """ - character_count: int = pydantic.Field() + character_count: typing.Optional[int] = pydantic.Field(default=None) """ Number of characters from the input text. """ diff --git a/skyflow/generated/rest/types/check_guardrails_response.py b/skyflow/generated/rest/types/detect_guardrails_response.py similarity index 52% rename from skyflow/generated/rest/types/check_guardrails_response.py rename to skyflow/generated/rest/types/detect_guardrails_response.py index ad8e2dbf..2290ac52 100644 --- a/skyflow/generated/rest/types/check_guardrails_response.py +++ b/skyflow/generated/rest/types/detect_guardrails_response.py @@ -4,32 +4,28 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .check_guardrails_response_validation import CheckGuardrailsResponseValidation +from .detect_guardrails_response_validation import DetectGuardrailsResponseValidation -class CheckGuardrailsResponse(UniversalBaseModel): - """ - Response to check guardrails. - """ - - text: typing.Optional[str] = pydantic.Field(default=None) +class DetectGuardrailsResponse(UniversalBaseModel): + text: str = pydantic.Field() """ Text that was checked against guardrails. """ - toxicity: typing.Optional[bool] = pydantic.Field(default=None) + toxic: typing.Optional[bool] = pydantic.Field(default=None) """ Whether the text is toxic. """ - denied_topics: typing.Optional[bool] = pydantic.Field(default=None) + denied_topic: typing.Optional[bool] = pydantic.Field(default=None) """ - Whether any denied topics were found. + Whether the text included a denied topic. """ - validation: typing.Optional[CheckGuardrailsResponseValidation] = pydantic.Field(default=None) + validation: DetectGuardrailsResponseValidation = pydantic.Field() """ - Validation result. + Whether the text passed validation. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/detect_guardrails_response_validation.py b/skyflow/generated/rest/types/detect_guardrails_response_validation.py new file mode 100644 index 00000000..5a59ddb0 --- /dev/null +++ b/skyflow/generated/rest/types/detect_guardrails_response_validation.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DetectGuardrailsResponseValidation = typing.Union[typing.Literal["failed", "passed"], typing.Any] diff --git a/skyflow/generated/rest/types/detect_runs_response.py b/skyflow/generated/rest/types/detect_runs_response.py new file mode 100644 index 00000000..e49cca0a --- /dev/null +++ b/skyflow/generated/rest/types/detect_runs_response.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .deidentified_file_output import DeidentifiedFileOutput +from .detect_runs_response_output_type import DetectRunsResponseOutputType +from .detect_runs_response_status import DetectRunsResponseStatus +from .word_character_count import WordCharacterCount + + +class DetectRunsResponse(UniversalBaseModel): + """ + Response to get the status of a file deidentification request. + """ + + status: typing.Optional[DetectRunsResponseStatus] = pydantic.Field(default=None) + """ + Status of the operation. + """ + + output_type: typing_extensions.Annotated[ + typing.Optional[DetectRunsResponseOutputType], FieldMetadata(alias="outputType") + ] = pydantic.Field(default=None) + """ + Format of the output file. + """ + + output: typing.Optional[typing.List[DeidentifiedFileOutput]] = pydantic.Field(default=None) + """ + Details of output files. Files are specified as Base64-encoded data. + """ + + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Status details about the Detect run. + """ + + size: typing.Optional[float] = pydantic.Field(default=None) + """ + Size of the processed file in kilobytes (KB). + """ + + word_character_count: typing_extensions.Annotated[ + typing.Optional[WordCharacterCount], FieldMetadata(alias="wordCharacterCount") + ] = None + duration: typing.Optional[float] = pydantic.Field(default=None) + """ + Duration of the processed audio in seconds. + """ + + pages: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of pages in the processed PDF. + """ + + slides: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of slides in the processed presentation. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/detect_runs_response_output_type.py b/skyflow/generated/rest/types/detect_runs_response_output_type.py new file mode 100644 index 00000000..a24870c1 --- /dev/null +++ b/skyflow/generated/rest/types/detect_runs_response_output_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DetectRunsResponseOutputType = typing.Union[typing.Literal["UNKNOWN", "BASE64"], typing.Any] diff --git a/skyflow/generated/rest/types/detect_runs_response_status.py b/skyflow/generated/rest/types/detect_runs_response_status.py new file mode 100644 index 00000000..979454c6 --- /dev/null +++ b/skyflow/generated/rest/types/detect_runs_response_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DetectRunsResponseStatus = typing.Union[typing.Literal["UNKNOWN", "FAILED", "SUCCESS", "IN_PROGRESS"], typing.Any] diff --git a/skyflow/generated/rest/types/entity_location.py b/skyflow/generated/rest/types/entity_location.py deleted file mode 100644 index 487f9c72..00000000 --- a/skyflow/generated/rest/types/entity_location.py +++ /dev/null @@ -1,41 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class EntityLocation(UniversalBaseModel): - """ - Locations of an entity in the text. - """ - - start_index: typing.Optional[int] = pydantic.Field(default=None) - """ - Index of the first character of the string in the original text. - """ - - end_index: typing.Optional[int] = pydantic.Field(default=None) - """ - Index of the last character of the string in the original text. - """ - - start_index_processed: typing.Optional[int] = pydantic.Field(default=None) - """ - Index of the first character of the string in the processed text. - """ - - end_index_processed: typing.Optional[int] = pydantic.Field(default=None) - """ - Index of the last character of the string in the processed text. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/entity_types.py b/skyflow/generated/rest/types/entity_types.py deleted file mode 100644 index 3adb0438..00000000 --- a/skyflow/generated/rest/types/entity_types.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .entity_type import EntityType - -EntityTypes = typing.List[EntityType] diff --git a/skyflow/generated/rest/types/error_response_error.py b/skyflow/generated/rest/types/error_response_error.py index 722b69cc..efe080d3 100644 --- a/skyflow/generated/rest/types/error_response_error.py +++ b/skyflow/generated/rest/types/error_response_error.py @@ -4,6 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .http_code import HttpCode class ErrorResponseError(UniversalBaseModel): @@ -12,16 +13,8 @@ class ErrorResponseError(UniversalBaseModel): gRPC status codes. See https://grpc.io/docs/guides/status-codes. """ - http_code: int = pydantic.Field() - """ - HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status. - """ - - http_status: str = pydantic.Field() - """ - HTTP status message. - """ - + http_code: HttpCode + http_status: str message: str details: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = None diff --git a/skyflow/generated/rest/types/error_string.py b/skyflow/generated/rest/types/error_string.py deleted file mode 100644 index 4ebbdff4..00000000 --- a/skyflow/generated/rest/types/error_string.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -ErrorString = str \ No newline at end of file diff --git a/skyflow/generated/rest/types/reidentify_file_response_output.py b/skyflow/generated/rest/types/file_data.py similarity index 53% rename from skyflow/generated/rest/types/reidentify_file_response_output.py rename to skyflow/generated/rest/types/file_data.py index bda44777..846837e0 100644 --- a/skyflow/generated/rest/types/reidentify_file_response_output.py +++ b/skyflow/generated/rest/types/file_data.py @@ -3,23 +3,25 @@ import typing import pydantic +import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_data_format import FileDataDataFormat -class ReidentifyFileResponseOutput(UniversalBaseModel): - processed_file: str = pydantic.Field() +class FileData(UniversalBaseModel): """ - Re-identified file content in base64 format. + File to process. Files are specified as Base64-encoded data. """ - processed_file_type: typing.Literal["reidentified_file"] = pydantic.Field(default="reidentified_file") + base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Type of the processed file. + Base64-encoded data of the file. """ - processed_file_extension: str = pydantic.Field() + data_format: FileDataDataFormat = pydantic.Field() """ - Extension of the processed file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py b/skyflow/generated/rest/types/file_data_data_format.py similarity index 89% rename from skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py rename to skyflow/generated/rest/types/file_data_data_format.py index f3294014..48205005 100644 --- a/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py +++ b/skyflow/generated/rest/types/file_data_data_format.py @@ -2,28 +2,29 @@ import typing -DeidentifyFileRequestFileDataFormat = typing.Union[ +FileDataDataFormat = typing.Union[ typing.Literal[ - "bmp", - "csv", - "dcm", - "doc", - "docx", - "jpeg", - "jpg", - "json", "mp3", + "wav", "pdf", - "png", - "ppt", - "pptx", + "txt", + "csv", + "json", + "jpg", + "jpeg", "tif", "tiff", - "txt", - "wav", + "png", + "bmp", "xls", "xlsx", + "doc", + "docx", + "ppt", + "pptx", "xml", + "dcm", + "jsonl", ], typing.Any, ] diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_audio.py similarity index 53% rename from skyflow/generated/rest/files/types/deidentify_file_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_audio.py index 3e062bb2..8973b22a 100644 --- a/skyflow/generated/rest/files/types/deidentify_file_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_audio.py @@ -4,24 +4,24 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_file_request_file_data_format import DeidentifyFileRequestFileDataFormat +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_audio_data_format import FileDataDeidentifyAudioDataFormat -class DeidentifyFileRequestFile(UniversalBaseModel): +class FileDataDeidentifyAudio(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ - data_format: DeidentifyFileRequestFileDataFormat = pydantic.Field() + data_format: FileDataDeidentifyAudioDataFormat = pydantic.Field() """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_audio_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_audio_data_format.py new file mode 100644 index 00000000..85f163c2 --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_audio_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifyAudioDataFormat = typing.Union[typing.Literal["mp3", "wav"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_audio_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_document.py similarity index 54% rename from skyflow/generated/rest/files/types/deidentify_audio_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_document.py index 3ea4c16f..ef9b61f2 100644 --- a/skyflow/generated/rest/files/types/deidentify_audio_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_document.py @@ -4,24 +4,24 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_audio_request_file_data_format import DeidentifyAudioRequestFileDataFormat +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_document_data_format import FileDataDeidentifyDocumentDataFormat -class DeidentifyAudioRequestFile(UniversalBaseModel): +class FileDataDeidentifyDocument(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ - data_format: DeidentifyAudioRequestFileDataFormat = pydantic.Field() + data_format: FileDataDeidentifyDocumentDataFormat = pydantic.Field() """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_document_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_document_data_format.py new file mode 100644 index 00000000..beaf1ffc --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_document_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifyDocumentDataFormat = typing.Union[typing.Literal["pdf", "doc", "docx"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_image_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_image.py similarity index 53% rename from skyflow/generated/rest/files/types/deidentify_image_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_image.py index 36677964..c1f76298 100644 --- a/skyflow/generated/rest/files/types/deidentify_image_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_image.py @@ -4,24 +4,24 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_image_request_file_data_format import DeidentifyImageRequestFileDataFormat +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_image_data_format import FileDataDeidentifyImageDataFormat -class DeidentifyImageRequestFile(UniversalBaseModel): +class FileDataDeidentifyImage(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ - data_format: DeidentifyImageRequestFileDataFormat = pydantic.Field() + data_format: FileDataDeidentifyImageDataFormat = pydantic.Field() """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_image_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_image_data_format.py new file mode 100644 index 00000000..97dab89e --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_image_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifyImageDataFormat = typing.Union[typing.Literal["jpg", "jpeg", "tif", "tiff", "png", "bmp"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_pdf_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_pdf.py similarity index 66% rename from skyflow/generated/rest/files/types/deidentify_pdf_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_pdf.py index da461fd1..0dc2c1a5 100644 --- a/skyflow/generated/rest/files/types/deidentify_pdf_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_pdf.py @@ -4,23 +4,23 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata -class DeidentifyPdfRequestFile(UniversalBaseModel): +class FileDataDeidentifyPdf(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ data_format: typing.Literal["pdf"] = pydantic.Field(default="pdf") """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_presentation.py b/skyflow/generated/rest/types/file_data_deidentify_presentation.py new file mode 100644 index 00000000..17fa004e --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_presentation.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_presentation_data_format import FileDataDeidentifyPresentationDataFormat + + +class FileDataDeidentifyPresentation(UniversalBaseModel): + """ + File to process. Files are specified as Base64-encoded data. + """ + + base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() + """ + Base64-encoded data of the file. + """ + + data_format: FileDataDeidentifyPresentationDataFormat = pydantic.Field() + """ + Format of the file. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/file_data_deidentify_presentation_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_presentation_data_format.py new file mode 100644 index 00000000..d811746d --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_presentation_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifyPresentationDataFormat = typing.Union[typing.Literal["ppt", "pptx"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_document_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_spreadsheet.py similarity index 53% rename from skyflow/generated/rest/files/types/deidentify_document_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_spreadsheet.py index cbf36c59..17ead2f1 100644 --- a/skyflow/generated/rest/files/types/deidentify_document_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_spreadsheet.py @@ -4,24 +4,24 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_document_request_file_data_format import DeidentifyDocumentRequestFileDataFormat +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_spreadsheet_data_format import FileDataDeidentifySpreadsheetDataFormat -class DeidentifyDocumentRequestFile(UniversalBaseModel): +class FileDataDeidentifySpreadsheet(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ - data_format: DeidentifyDocumentRequestFileDataFormat = pydantic.Field() + data_format: FileDataDeidentifySpreadsheetDataFormat = pydantic.Field() """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_spreadsheet_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_spreadsheet_data_format.py new file mode 100644 index 00000000..f48a11aa --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_spreadsheet_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifySpreadsheetDataFormat = typing.Union[typing.Literal["csv", "xls", "xlsx"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_structured_text.py similarity index 53% rename from skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_structured_text.py index f97e1c03..a78a11ab 100644 --- a/skyflow/generated/rest/files/types/deidentify_spreadsheet_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_structured_text.py @@ -4,24 +4,24 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata -from .deidentify_spreadsheet_request_file_data_format import DeidentifySpreadsheetRequestFileDataFormat +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_deidentify_structured_text_data_format import FileDataDeidentifyStructuredTextDataFormat -class DeidentifySpreadsheetRequestFile(UniversalBaseModel): +class FileDataDeidentifyStructuredText(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ - data_format: DeidentifySpreadsheetRequestFileDataFormat = pydantic.Field() + data_format: FileDataDeidentifyStructuredTextDataFormat = pydantic.Field() """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_deidentify_structured_text_data_format.py b/skyflow/generated/rest/types/file_data_deidentify_structured_text_data_format.py new file mode 100644 index 00000000..267b17a6 --- /dev/null +++ b/skyflow/generated/rest/types/file_data_deidentify_structured_text_data_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataDeidentifyStructuredTextDataFormat = typing.Union[typing.Literal["json", "xml"], typing.Any] diff --git a/skyflow/generated/rest/files/types/deidentify_text_request_file.py b/skyflow/generated/rest/types/file_data_deidentify_text.py similarity index 66% rename from skyflow/generated/rest/files/types/deidentify_text_request_file.py rename to skyflow/generated/rest/types/file_data_deidentify_text.py index 193aa7bd..c8637361 100644 --- a/skyflow/generated/rest/files/types/deidentify_text_request_file.py +++ b/skyflow/generated/rest/types/file_data_deidentify_text.py @@ -4,23 +4,23 @@ import pydantic import typing_extensions -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...core.serialization import FieldMetadata +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata -class DeidentifyTextRequestFile(UniversalBaseModel): +class FileDataDeidentifyText(UniversalBaseModel): """ - File to de-identify. Files are specified as Base64-encoded data. + File to process. Files are specified as Base64-encoded data. """ base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() """ - Base64-encoded data of the file to de-identify. + Base64-encoded data of the file. """ data_format: typing.Literal["txt"] = pydantic.Field(default="txt") """ - Data format of the file. + Format of the file. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/file_data_reidentify_file.py b/skyflow/generated/rest/types/file_data_reidentify_file.py new file mode 100644 index 00000000..d691bcc0 --- /dev/null +++ b/skyflow/generated/rest/types/file_data_reidentify_file.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .file_data_reidentify_file_data_format import FileDataReidentifyFileDataFormat + + +class FileDataReidentifyFile(UniversalBaseModel): + """ + File to process. Files are specified as Base64-encoded data. + """ + + base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() + """ + Base64-encoded data of the file. + """ + + data_format: FileDataReidentifyFileDataFormat = pydantic.Field() + """ + Format of the file. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/file_data_reidentify_file_data_format.py b/skyflow/generated/rest/types/file_data_reidentify_file_data_format.py new file mode 100644 index 00000000..d0cc44ba --- /dev/null +++ b/skyflow/generated/rest/types/file_data_reidentify_file_data_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileDataReidentifyFileDataFormat = typing.Union[ + typing.Literal["txt", "csv", "json", "xls", "xlsx", "doc", "docx", "xml"], typing.Any +] diff --git a/skyflow/generated/rest/files/types/reidentify_file_request_format.py b/skyflow/generated/rest/types/format.py similarity index 58% rename from skyflow/generated/rest/files/types/reidentify_file_request_format.py rename to skyflow/generated/rest/types/format.py index ec7ca5f1..a12992cd 100644 --- a/skyflow/generated/rest/files/types/reidentify_file_request_format.py +++ b/skyflow/generated/rest/types/format.py @@ -3,26 +3,28 @@ import typing import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.entity_type import EntityType +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .format_masked_item import FormatMaskedItem +from .format_plaintext_item import FormatPlaintextItem +from .format_redacted_item import FormatRedactedItem -class ReidentifyFileRequestFormat(UniversalBaseModel): +class Format(UniversalBaseModel): """ Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. """ - redacted: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) + redacted: typing.Optional[typing.List[FormatRedactedItem]] = pydantic.Field(default=None) """ Entity types to fully redact. """ - masked: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) + masked: typing.Optional[typing.List[FormatMaskedItem]] = pydantic.Field(default=None) """ Entity types to mask. """ - plaintext: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) + plaintext: typing.Optional[typing.List[FormatPlaintextItem]] = pydantic.Field(default=None) """ Entity types to return in plaintext. """ diff --git a/skyflow/generated/rest/types/entity_type.py b/skyflow/generated/rest/types/format_masked_item.py similarity index 98% rename from skyflow/generated/rest/types/entity_type.py rename to skyflow/generated/rest/types/format_masked_item.py index 1a343410..eeae9770 100644 --- a/skyflow/generated/rest/types/entity_type.py +++ b/skyflow/generated/rest/types/format_masked_item.py @@ -2,78 +2,78 @@ import typing -EntityType = typing.Union[ +FormatMaskedItem = typing.Union[ typing.Literal[ - "account_number", "age", - "all", "bank_account", - "blood_type", - "condition", - "corporate_action", "credit_card", "credit_card_expiration", "cvv", "date", "date_interval", - "day", "dob", - "dose", "driver_license", - "drug", - "duration", - "effect", "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", "event", "filename", - "financial_metric", "gender", - "healthcare_number", - "injury", - "ip_address", "language", - "location", "location_address", - "location_address_street", "location_city", "location_coordinate", "location_country", "location_state", "location_zip", "marital_status", - "medical_code", - "medical_process", "money", - "month", - "name", - "name_family", - "name_given", "name_medical_professional", - "numerical_pii", "occupation", "organization", - "organization_id", "organization_medical_facility", "origin", "passport_number", "password", - "phone_number", "physical_attribute", "political_affiliation", - "product", - "project", "religion", - "routing_number", - "sexuality", - "ssn", - "statistics", "time", - "trend", - "url", "username", - "vehicle_id", - "year", "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", ], typing.Any, ] diff --git a/skyflow/generated/rest/types/format_plaintext_item.py b/skyflow/generated/rest/types/format_plaintext_item.py new file mode 100644 index 00000000..62dfc4bc --- /dev/null +++ b/skyflow/generated/rest/types/format_plaintext_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FormatPlaintextItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/format_redacted_item.py b/skyflow/generated/rest/types/format_redacted_item.py new file mode 100644 index 00000000..d2aee020 --- /dev/null +++ b/skyflow/generated/rest/types/format_redacted_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FormatRedactedItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/vault_id.py b/skyflow/generated/rest/types/http_code.py similarity index 81% rename from skyflow/generated/rest/types/vault_id.py rename to skyflow/generated/rest/types/http_code.py index 02ae7d21..5fc9a3fb 100644 --- a/skyflow/generated/rest/types/vault_id.py +++ b/skyflow/generated/rest/types/http_code.py @@ -1,3 +1,3 @@ # This file was auto-generated by Fern from our API Definition. -VaultId = str +HttpCode = int diff --git a/skyflow/generated/rest/types/reidentify_string_response.py b/skyflow/generated/rest/types/identify_response.py similarity index 78% rename from skyflow/generated/rest/types/reidentify_string_response.py rename to skyflow/generated/rest/types/identify_response.py index cbb1b836..67786621 100644 --- a/skyflow/generated/rest/types/reidentify_string_response.py +++ b/skyflow/generated/rest/types/identify_response.py @@ -6,12 +6,12 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -class ReidentifyStringResponse(UniversalBaseModel): +class IdentifyResponse(UniversalBaseModel): """ - Re-identify string response. + Response after identifying text. """ - text: typing.Optional[str] = pydantic.Field(default=None) + text: str = pydantic.Field() """ Re-identified text. """ diff --git a/skyflow/generated/rest/types/deidentify_file_output.py b/skyflow/generated/rest/types/reidentified_file_output.py similarity index 56% rename from skyflow/generated/rest/types/deidentify_file_output.py rename to skyflow/generated/rest/types/reidentified_file_output.py index 7e17e168..c7f8544e 100644 --- a/skyflow/generated/rest/types/deidentify_file_output.py +++ b/skyflow/generated/rest/types/reidentified_file_output.py @@ -4,25 +4,27 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .deidentify_file_output_processed_file_type import DeidentifyFileOutputProcessedFileType +from .reidentified_file_output_processed_file_extension import ReidentifiedFileOutputProcessedFileExtension -class DeidentifyFileOutput(UniversalBaseModel): +class ReidentifiedFileOutput(UniversalBaseModel): """ - Details and contents of the processed file. + Details of output files. Files are specified as Base64-encoded data. """ processed_file: typing.Optional[str] = pydantic.Field(default=None) """ - URL or base64-encoded data of the output. + File content in Base64 format. """ - processed_file_type: typing.Optional[DeidentifyFileOutputProcessedFileType] = pydantic.Field(default=None) + processed_file_type: typing.Optional[typing.Literal["reidentified_file"]] = pydantic.Field(default=None) """ Type of the processed file. """ - processed_file_extension: typing.Optional[str] = pydantic.Field(default=None) + processed_file_extension: typing.Optional[ReidentifiedFileOutputProcessedFileExtension] = pydantic.Field( + default=None + ) """ Extension of the processed file. """ diff --git a/skyflow/generated/rest/types/reidentified_file_output_processed_file_extension.py b/skyflow/generated/rest/types/reidentified_file_output_processed_file_extension.py new file mode 100644 index 00000000..c6cbfd02 --- /dev/null +++ b/skyflow/generated/rest/types/reidentified_file_output_processed_file_extension.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReidentifiedFileOutputProcessedFileExtension = typing.Union[ + typing.Literal[ + "mp3", + "wav", + "pdf", + "txt", + "csv", + "json", + "jpg", + "jpeg", + "tif", + "tiff", + "png", + "bmp", + "xls", + "xlsx", + "doc", + "docx", + "ppt", + "pptx", + "xml", + "dcm", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/reidentify_file_response.py b/skyflow/generated/rest/types/reidentify_file_response.py index c67b41ac..ef076c72 100644 --- a/skyflow/generated/rest/types/reidentify_file_response.py +++ b/skyflow/generated/rest/types/reidentify_file_response.py @@ -4,26 +4,27 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .reidentify_file_response_output import ReidentifyFileResponseOutput +from .reidentified_file_output import ReidentifiedFileOutput +from .reidentify_file_response_output_type import ReidentifyFileResponseOutputType from .reidentify_file_response_status import ReidentifyFileResponseStatus class ReidentifyFileResponse(UniversalBaseModel): """ - Response to re-identify a file. + Response to get the status & response of a file re-identification request. """ - status: ReidentifyFileResponseStatus = pydantic.Field() + status: typing.Optional[ReidentifyFileResponseStatus] = pydantic.Field(default=None) """ - Status of the re-identify operation. + Status of the operation. """ - output_type: typing.Literal["BASE64"] = pydantic.Field(default="BASE64") + output_type: typing.Optional[ReidentifyFileResponseOutputType] = pydantic.Field(default=None) """ Format of the output file. """ - output: ReidentifyFileResponseOutput + output: typing.Optional[ReidentifiedFileOutput] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyflow/generated/rest/types/reidentify_file_response_output_type.py b/skyflow/generated/rest/types/reidentify_file_response_output_type.py index 03048c85..b7b9e8c4 100644 --- a/skyflow/generated/rest/types/reidentify_file_response_output_type.py +++ b/skyflow/generated/rest/types/reidentify_file_response_output_type.py @@ -2,4 +2,4 @@ import typing -ReidentifyFileResponseOutputType = typing.Union[typing.Literal["BASE64", "UNKNOWN"], typing.Any] +ReidentifyFileResponseOutputType = typing.Union[typing.Literal["UNKNOWN", "BASE64"], typing.Any] diff --git a/skyflow/generated/rest/types/reidentify_file_response_status.py b/skyflow/generated/rest/types/reidentify_file_response_status.py index 8bdfa1e0..ffa5dfc3 100644 --- a/skyflow/generated/rest/types/reidentify_file_response_status.py +++ b/skyflow/generated/rest/types/reidentify_file_response_status.py @@ -2,4 +2,4 @@ import typing -ReidentifyFileResponseStatus = typing.Union[typing.Literal["FAILED", "IN_PROGRESS", "SUCCESS", "UNKNOWN"], typing.Any] +ReidentifyFileResponseStatus = typing.Union[typing.Literal["UNKNOWN", "FAILED", "SUCCESS", "IN_PROGRESS"], typing.Any] diff --git a/skyflow/generated/rest/types/restrict_regex.py b/skyflow/generated/rest/types/restrict_regex.py deleted file mode 100644 index 06dd46b7..00000000 --- a/skyflow/generated/rest/types/restrict_regex.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -RestrictRegex = typing.List[str] diff --git a/skyflow/generated/rest/types/transformations_shift_dates.py b/skyflow/generated/rest/types/shift_dates.py similarity index 75% rename from skyflow/generated/rest/types/transformations_shift_dates.py rename to skyflow/generated/rest/types/shift_dates.py index 21b21af8..7a1af257 100644 --- a/skyflow/generated/rest/types/transformations_shift_dates.py +++ b/skyflow/generated/rest/types/shift_dates.py @@ -4,25 +4,25 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .transformations_shift_dates_entity_types_item import TransformationsShiftDatesEntityTypesItem +from .shift_dates_entity_types_item import ShiftDatesEntityTypesItem -class TransformationsShiftDates(UniversalBaseModel): +class ShiftDates(UniversalBaseModel): """ Shift dates by a specified number of days. """ - max_days: typing.Optional[int] = pydantic.Field(default=None) + min_days: typing.Optional[int] = pydantic.Field(default=None) """ - Maximum number of days to shift the date by. + Minimum number of days to shift the date by. """ - min_days: typing.Optional[int] = pydantic.Field(default=None) + max_days: typing.Optional[int] = pydantic.Field(default=None) """ - Minimum number of days to shift the date by. + Maximum number of days to shift the date by. """ - entity_types: typing.Optional[typing.List[TransformationsShiftDatesEntityTypesItem]] = pydantic.Field(default=None) + entity_types: typing.Optional[typing.List[ShiftDatesEntityTypesItem]] = pydantic.Field(default=None) """ Entity types to shift dates for. """ diff --git a/skyflow/generated/rest/types/shift_dates_entity_types_item.py b/skyflow/generated/rest/types/shift_dates_entity_types_item.py new file mode 100644 index 00000000..b0f10d19 --- /dev/null +++ b/skyflow/generated/rest/types/shift_dates_entity_types_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ShiftDatesEntityTypesItem = typing.Union[typing.Literal["date", "date_interval", "dob"], typing.Any] diff --git a/skyflow/generated/rest/types/detected_entity.py b/skyflow/generated/rest/types/string_response_entities.py similarity index 82% rename from skyflow/generated/rest/types/detected_entity.py rename to skyflow/generated/rest/types/string_response_entities.py index c34ba2ca..0d72524a 100644 --- a/skyflow/generated/rest/types/detected_entity.py +++ b/skyflow/generated/rest/types/string_response_entities.py @@ -4,12 +4,11 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .entity_location import EntityLocation -class DetectedEntity(UniversalBaseModel): +class StringResponseEntities(UniversalBaseModel): """ - Detected entities. + Detected entities for String """ token: typing.Optional[str] = pydantic.Field(default=None) @@ -22,7 +21,6 @@ class DetectedEntity(UniversalBaseModel): Original text of the entity. """ - location: typing.Optional[EntityLocation] = None entity_type: typing.Optional[str] = pydantic.Field(default=None) """ Highest-rated label. @@ -30,7 +28,7 @@ class DetectedEntity(UniversalBaseModel): entity_scores: typing.Optional[typing.Dict[str, float]] = pydantic.Field(default=None) """ - entity_scores and their scores. + Labels and their scores. """ if IS_PYDANTIC_V2: diff --git a/skyflow/generated/rest/types/token_type.py b/skyflow/generated/rest/types/token_type.py deleted file mode 100644 index 200b9630..00000000 --- a/skyflow/generated/rest/types/token_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .entity_type import EntityType -from .token_type_default import TokenTypeDefault - - -class TokenType(UniversalBaseModel): - """ - Mapping of tokens to generation for detected entities. Can't be specified together with `token_type`. - """ - - default: typing.Optional[TokenTypeDefault] = None - vault_token: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to replace with vault tokens. - """ - - entity_unq_counter: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to replace with entity tokens with unique counters. - """ - - entity_only: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to replace with entity tokens. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/token_type_default.py b/skyflow/generated/rest/types/token_type_default.py deleted file mode 100644 index cfda9f4b..00000000 --- a/skyflow/generated/rest/types/token_type_default.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -TokenTypeDefault = typing.Union[typing.Literal["entity_only", "entity_unq_counter", "vault_token"], typing.Any] diff --git a/skyflow/generated/rest/types/token_type_mapping.py b/skyflow/generated/rest/types/token_type_mapping.py new file mode 100644 index 00000000..5644fd01 --- /dev/null +++ b/skyflow/generated/rest/types/token_type_mapping.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .token_type_mapping_default import TokenTypeMappingDefault +from .token_type_mapping_entity_only_item import TokenTypeMappingEntityOnlyItem +from .token_type_mapping_entity_unq_counter_item import TokenTypeMappingEntityUnqCounterItem +from .token_type_mapping_vault_token_item import TokenTypeMappingVaultTokenItem + + +class TokenTypeMapping(UniversalBaseModel): + """ + Mapping of token types to detected entities. + """ + + vault_token: typing.Optional[typing.List[TokenTypeMappingVaultTokenItem]] = pydantic.Field(default=None) + """ + Entity types to replace with vault tokens. + """ + + entity_only: typing.Optional[typing.List[TokenTypeMappingEntityOnlyItem]] = pydantic.Field(default=None) + """ + Entity types to replace with entity tokens. + """ + + entity_unq_counter: typing.Optional[typing.List[TokenTypeMappingEntityUnqCounterItem]] = pydantic.Field( + default=None + ) + """ + Entity types to replace with entity tokens with unique counters. + """ + + default: typing.Optional[TokenTypeMappingDefault] = pydantic.Field(default=None) + """ + Default token type to generate for detected entities. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/token_type_mapping_default.py b/skyflow/generated/rest/types/token_type_mapping_default.py new file mode 100644 index 00000000..36a9e4ba --- /dev/null +++ b/skyflow/generated/rest/types/token_type_mapping_default.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TokenTypeMappingDefault = typing.Union[typing.Literal["entity_unq_counter", "entity_only", "vault_token"], typing.Any] diff --git a/skyflow/generated/rest/types/token_type_mapping_entity_only_item.py b/skyflow/generated/rest/types/token_type_mapping_entity_only_item.py new file mode 100644 index 00000000..d3309ab9 --- /dev/null +++ b/skyflow/generated/rest/types/token_type_mapping_entity_only_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TokenTypeMappingEntityOnlyItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/token_type_mapping_entity_unq_counter_item.py b/skyflow/generated/rest/types/token_type_mapping_entity_unq_counter_item.py new file mode 100644 index 00000000..219f79ac --- /dev/null +++ b/skyflow/generated/rest/types/token_type_mapping_entity_unq_counter_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TokenTypeMappingEntityUnqCounterItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/token_type_mapping_vault_token_item.py b/skyflow/generated/rest/types/token_type_mapping_vault_token_item.py new file mode 100644 index 00000000..17178ea6 --- /dev/null +++ b/skyflow/generated/rest/types/token_type_mapping_vault_token_item.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TokenTypeMappingVaultTokenItem = typing.Union[ + typing.Literal[ + "age", + "bank_account", + "credit_card", + "credit_card_expiration", + "cvv", + "date", + "date_interval", + "dob", + "driver_license", + "email_address", + "healthcare_number", + "ip_address", + "location", + "name", + "numerical_pii", + "phone_number", + "ssn", + "url", + "vehicle_id", + "medical_code", + "name_family", + "name_given", + "account_number", + "event", + "filename", + "gender", + "language", + "location_address", + "location_city", + "location_coordinate", + "location_country", + "location_state", + "location_zip", + "marital_status", + "money", + "name_medical_professional", + "occupation", + "organization", + "organization_medical_facility", + "origin", + "passport_number", + "password", + "physical_attribute", + "political_affiliation", + "religion", + "time", + "username", + "zodiac_sign", + "blood_type", + "condition", + "dose", + "drug", + "injury", + "medical_process", + "statistics", + "routing_number", + "corporate_action", + "financial_metric", + "product", + "trend", + "duration", + "location_address_street", + "all", + "sexuality", + "effect", + "project", + "organization_id", + "day", + "month", + "year", + ], + typing.Any, +] diff --git a/skyflow/generated/rest/types/token_type_without_vault.py b/skyflow/generated/rest/types/token_type_without_vault.py deleted file mode 100644 index d79a3477..00000000 --- a/skyflow/generated/rest/types/token_type_without_vault.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .entity_type import EntityType -from .token_type_without_vault_default import TokenTypeWithoutVaultDefault - - -class TokenTypeWithoutVault(UniversalBaseModel): - """ - Mapping of tokens to generation for detected entities. Can't be specified together with `token_type`. - """ - - default: typing.Optional[TokenTypeWithoutVaultDefault] = None - entity_unq_counter: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to replace with entity tokens with unique counters. - """ - - entity_only: typing.Optional[typing.List[EntityType]] = pydantic.Field(default=None) - """ - Entity types to replace with entity tokens. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/types/token_type_without_vault_default.py b/skyflow/generated/rest/types/token_type_without_vault_default.py deleted file mode 100644 index 53d71dc6..00000000 --- a/skyflow/generated/rest/types/token_type_without_vault_default.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -TokenTypeWithoutVaultDefault = typing.Union[typing.Literal["entity_only", "entity_unq_counter"], typing.Any] diff --git a/skyflow/generated/rest/types/transformations.py b/skyflow/generated/rest/types/transformations.py index 352df144..9895e2f6 100644 --- a/skyflow/generated/rest/types/transformations.py +++ b/skyflow/generated/rest/types/transformations.py @@ -4,18 +4,15 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .transformations_shift_dates import TransformationsShiftDates +from .shift_dates import ShiftDates class Transformations(UniversalBaseModel): """ - Transformations to apply to the detected entities. + Transformations to apply to detected entities. """ - shift_dates: typing.Optional[TransformationsShiftDates] = pydantic.Field(default=None) - """ - Shift dates by a specified number of days. - """ + shift_dates: typing.Optional[ShiftDates] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyflow/generated/rest/types/transformations_shift_dates_entity_types_item.py b/skyflow/generated/rest/types/transformations_shift_dates_entity_types_item.py deleted file mode 100644 index f8d98df6..00000000 --- a/skyflow/generated/rest/types/transformations_shift_dates_entity_types_item.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -TransformationsShiftDatesEntityTypesItem = typing.Union[typing.Literal["date", "date_interval", "dob"], typing.Any] diff --git a/skyflow/generated/rest/types/word_character_count.py b/skyflow/generated/rest/types/word_character_count.py new file mode 100644 index 00000000..d2506866 --- /dev/null +++ b/skyflow/generated/rest/types/word_character_count.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class WordCharacterCount(UniversalBaseModel): + """ + Word and character count of the processed text. + """ + + word_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="wordCount")] = pydantic.Field( + default=None + ) + """ + Number of words in the processed text. + """ + + character_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="characterCount")] = ( + pydantic.Field(default=None) + ) + """ + Number of characters in the processed text. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/skyflow/generated/rest/version.py b/skyflow/generated/rest/version.py index e5d18b20..a93039be 100644 --- a/skyflow/generated/rest/version.py +++ b/skyflow/generated/rest/version.py @@ -1 +1,3 @@ -__version__ = "2.0.9" +from importlib import metadata + +__version__ = metadata.version("skyflow") diff --git a/skyflow/utils/__init__.py b/skyflow/utils/__init__.py index 67905512..f2788b11 100644 --- a/skyflow/utils/__init__.py +++ b/skyflow/utils/__init__.py @@ -1,4 +1,4 @@ -from ..utils.enums import LogLevel, Env +from ..utils.enums import LogLevel, Env, TokenType from ._skyflow_messages import SkyflowMessages from ._version import SDK_VERSION from ._helpers import get_base_url, format_scope diff --git a/skyflow/utils/_utils.py b/skyflow/utils/_utils.py index 114079b5..899dd1b4 100644 --- a/skyflow/utils/_utils.py +++ b/skyflow/utils/_utils.py @@ -14,7 +14,7 @@ from skyflow.error import SkyflowError from skyflow.generated.rest import V1UpdateRecordResponse, V1BulkDeleteRecordResponse, \ V1DetokenizeResponse, V1TokenizeResponse, V1GetQueryResponse, V1BulkGetRecordResponse, \ - DeidentifyStringResponse, ReidentifyStringResponse, ErrorResponse + DeidentifyStringResponse, ErrorResponse, IdentifyResponse from skyflow.generated.rest.core.http_response import HttpResponse from skyflow.utils.logger import log_error_log from skyflow.vault.detect import DeidentifyTextResponse, ReidentifyTextResponse @@ -90,12 +90,12 @@ def convert_detected_entity_to_entity_info(detected_entity): token=detected_entity.token, value=detected_entity.value, text_index=TextIndex( - start=detected_entity.location.start_index, - end=detected_entity.location.end_index + start=detected_entity.location['start_index'], + end=detected_entity.location['end_index'] ), processed_index=TextIndex( - start=detected_entity.location.start_index_processed, - end=detected_entity.location.end_index_processed + start=detected_entity.location['start_index_processed'], + end=detected_entity.location['end_index_processed'] ), entity=detected_entity.entity_type, scores=detected_entity.entity_scores @@ -388,7 +388,7 @@ def parse_deidentify_text_response(api_response: DeidentifyStringResponse): char_count=api_response.character_count ) -def parse_reidentify_text_response(api_response: ReidentifyStringResponse): +def parse_reidentify_text_response(api_response: IdentifyResponse): return ReidentifyTextResponse(api_response.text) def log_and_reject_error(description, status_code, request_id, http_status=None, grpc_code=None, details=None, logger = None): diff --git a/skyflow/utils/validations/_validations.py b/skyflow/utils/validations/_validations.py index 4428d11e..3da8b3a4 100644 --- a/skyflow/utils/validations/_validations.py +++ b/skyflow/utils/validations/_validations.py @@ -1,7 +1,6 @@ import base64 import json import os -from skyflow.generated.rest import TokenType from skyflow.service_account import is_expired from skyflow.utils.enums import LogLevel, Env, RedactionType, TokenMode, DetectEntities, DetectOutputTranscriptions, \ MaskingMethod diff --git a/skyflow/vault/controller/_detect.py b/skyflow/vault/controller/_detect.py index 62d551c1..b22a76b3 100644 --- a/skyflow/vault/controller/_detect.py +++ b/skyflow/vault/controller/_detect.py @@ -3,10 +3,11 @@ import os import base64 import time -from skyflow.generated.rest import DeidentifyTextRequestFile, DeidentifyAudioRequestFile, DeidentifyPdfRequestFile, \ - DeidentifyImageRequestFile, DeidentifyPresentationRequestFile, DeidentifySpreadsheetRequestFile, \ - DeidentifyDocumentRequestFile, DeidentifyFileRequestFile -from skyflow.generated.rest.types.deidentify_status_response import DeidentifyStatusResponse + +from skyflow.generated.rest import FileDataDeidentifyText, FileDataDeidentifyPdf, FileDataDeidentifyPresentation, \ + FileDataDeidentifySpreadsheet, FileDataDeidentifyDocument, FileDataDeidentifyStructuredText, FileData, \ + FileDataDeidentifyImage, Format, FileDataDeidentifyAudio, WordCharacterCount, DetectRunsResponse + from skyflow.utils._skyflow_messages import SkyflowMessages from skyflow.utils._utils import get_attribute, get_metrics, handle_exception, parse_deidentify_text_response, parse_reidentify_text_response from skyflow.utils.constants import SKY_META_DATA_HEADER @@ -14,7 +15,6 @@ from skyflow.utils.validations import validate_deidentify_file_request, validate_get_detect_run_request from skyflow.utils.validations._validations import validate_deidentify_text_request, validate_reidentify_text_request from typing import Dict, Any -from skyflow.generated.rest.strings.types.reidentify_string_request_format import ReidentifyStringRequestFormat from skyflow.vault.detect import DeidentifyTextRequest, DeidentifyTextResponse, ReidentifyTextRequest, \ ReidentifyTextResponse, DeidentifyFileRequest, DeidentifyFileResponse, GetDetectRunRequest @@ -46,7 +46,7 @@ def ___build_deidentify_text_body(self, request: DeidentifyTextRequest) -> Dict[ return deidentify_text_body def ___build_reidentify_text_body(self, request: ReidentifyTextRequest) -> Dict[str, Any]: - parsed_format = ReidentifyStringRequestFormat( + parsed_format = Format( redacted=request.redacted_entities, masked=request.masked_entities, plaintext=request.plain_text_entities @@ -84,7 +84,7 @@ def __poll_for_processed_file(self, run_id, max_wait_time=64): except Exception as e: raise e - def __save_deidentify_file_response_output(self, response: DeidentifyStatusResponse, output_directory: str, original_file_name: str, name_without_ext: str): + def __save_deidentify_file_response_output(self, response: DetectRunsResponse, output_directory: str, original_file_name: str, name_without_ext: str): if not response or not hasattr(response, 'output') or not response.output or not output_directory: return @@ -129,10 +129,10 @@ def __parse_deidentify_file_response(self, data, run_id=None, status=None): word_count = None char_count = None - word_character_count = getattr(data, "wordCharacterCount", None) - if word_character_count and isinstance(word_character_count, dict): - word_count = word_character_count.get("wordCount") - char_count = word_character_count.get("characterCount") + word_character_count = getattr(data, "word_character_count", None) + if word_character_count and isinstance(word_character_count, WordCharacterCount): + word_count = word_character_count.word_count + char_count = word_character_count.character_count size = getattr(data, "size", None) @@ -142,23 +142,20 @@ def __parse_deidentify_file_response(self, data, run_id=None, status=None): pages = getattr(data, "pages", None) slides = getattr(data, "slides", None) - # Convert output to list of dicts, prefer camelCase keys def output_to_dict_list(output): result = [] for o in output: if isinstance(o, dict): result.append({ - "file": o.get("processedFile") or o.get("processed_file"), - "type": o.get("processedFileType") or o.get("processed_file_type"), - "extension": o.get("processedFileExtension") or o.get("processed_file_extension") + "file": o.get("processed_file"), + "type": o.get("processed_file_type"), + "extension": o.get("processed_file_extension") }) else: result.append({ - "file": getattr(o, "processedFile", None) or getattr(o, "processed_file", None), - "type": getattr(o, "processedFileType", None) or getattr(o, "processed_file_type", None), - "extension": getattr(o, "processedFileExtension", None) or getattr(o, - "processed_file_extension", - None) + "file": getattr(o, "processed_file", None), + "type": getattr(o, "processed_file_type", None), + "extension": getattr(o, "processed_file_extension", None) }) return result @@ -200,7 +197,6 @@ def __get_token_format(self, request): 'default': getattr(request.token_format, "default", None), 'entity_unq_counter': getattr(request.token_format, "entity_unique_counter", None), 'entity_only': getattr(request.token_format, "entity_only", None), - 'vault_token': getattr(request.token_format, "vault_token", None) } def __get_transformations(self, request): @@ -293,7 +289,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): try: if file_extension == 'txt': - req_file = DeidentifyTextRequestFile(base_64=base64_string, data_format="txt") + req_file = FileDataDeidentifyText(base_64=base64_string, data_format="txt") api_call = files_api.deidentify_text api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -307,7 +303,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension in ['mp3', 'wav']: - req_file = DeidentifyAudioRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifyAudio(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_audio api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -327,7 +323,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension == 'pdf': - req_file = DeidentifyPdfRequestFile(base_64=base64_string) + req_file = FileDataDeidentifyPdf(base_64=base64_string) api_call = files_api.deidentify_pdf api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -342,7 +338,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension in ['jpeg', 'jpg', 'png', 'bmp', 'tif', 'tiff']: - req_file = DeidentifyImageRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifyImage(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_image api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -358,7 +354,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension in ['ppt', 'pptx']: - req_file = DeidentifyPresentationRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifyPresentation(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_presentation api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -371,7 +367,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension in ['csv', 'xls', 'xlsx']: - req_file = DeidentifySpreadsheetRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifySpreadsheet(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_spreadsheet api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -380,12 +376,11 @@ def deidentify_file(self, request: DeidentifyFileRequest): 'token_type': self.__get_token_format(request), 'allow_regex': request.allow_regex_list, 'restrict_regex': request.restrict_regex_list, - 'transformations': self.__get_transformations(request), 'request_options': self.__get_headers() } elif file_extension in ['doc', 'docx']: - req_file = DeidentifyDocumentRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifyDocument(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_document api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -398,9 +393,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } elif file_extension in ['json', 'xml']: - from skyflow.generated.rest.files.types.deidentify_structured_text_request_file import \ - DeidentifyStructuredTextRequestFile - req_file = DeidentifyStructuredTextRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileDataDeidentifyStructuredText(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_structured_text api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), @@ -414,7 +407,7 @@ def deidentify_file(self, request: DeidentifyFileRequest): } else: - req_file = DeidentifyFileRequestFile(base_64=base64_string, data_format=file_extension) + req_file = FileData(base_64=base64_string, data_format=file_extension) api_call = files_api.deidentify_file api_kwargs = { 'vault_id': self.__vault_client.get_vault_id(), diff --git a/tests/vault/controller/test__detect.py b/tests/vault/controller/test__detect.py index dc3a753f..c2f9a861 100644 --- a/tests/vault/controller/test__detect.py +++ b/tests/vault/controller/test__detect.py @@ -3,6 +3,7 @@ import base64 import os from skyflow.error import SkyflowError +from skyflow.generated.rest import WordCharacterCount from skyflow.utils import SkyflowMessages from skyflow.vault.controller import Detect from skyflow.vault.detect import DeidentifyTextRequest, ReidentifyTextRequest, \ @@ -149,7 +150,7 @@ def test_deidentify_file_txt_success(self, mock_open, mock_basename, mock_base64 processed_response = Mock() processed_response.status = "SUCCESS" processed_response.output = [] - processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=1) + processed_response.word_character_count = WordCharacterCount(word_count=1, character_count=1) with patch.object(self.detect, "_Detect__poll_for_processed_file", return_value=processed_response) as mock_poll, \ patch.object(self.detect, "_Detect__parse_deidentify_file_response", @@ -211,7 +212,7 @@ def test_deidentify_file_audio_success(self, mock_base64, mock_validate): processed_response = Mock() processed_response.status = "SUCCESS" processed_response.output = [] - processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=1) + processed_response.word_character_count = Mock(word_count=1, character_count=1) with patch.object(self.detect, "_Detect__poll_for_processed_file", return_value=processed_response) as mock_poll, \ patch.object(self.detect, "_Detect__parse_deidentify_file_response", @@ -295,16 +296,15 @@ def test_deidentify_file_all_branches(self, mock_poll, mock_open, mock_basename, processed_response = Mock() processed_response.status = "SUCCESS" processed_response.output = [ - {"processedFile": "dGVzdCBjb250ZW50", "processedFileType": "pdf", "processedFileExtension": "pdf"} + {"processed_file": "dGVzdCBjb250ZW50", "processed_file_type": "pdf", "processed_file_extension": "pdf"} ] - processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=1) processed_response.size = 1 processed_response.duration = 1 processed_response.pages = 1 processed_response.slides = 1 processed_response.message = "" processed_response.run_id = "runid123" - processed_response.wordCharacterCount = {"wordCount": 1, "characterCount": 1} + processed_response.word_character_count = WordCharacterCount(word_count=1, character_count=1) mock_poll.return_value = processed_response # Test configuration for different file types @@ -352,6 +352,7 @@ def test_deidentify_file_all_branches(self, mock_poll, mock_open, mock_basename, result = self.detect.deidentify_file(req) # Verify the result + print("Result : ", result) self.assertIsInstance(result, DeidentifyFileResponse) self.assertEqual(result.status, "SUCCESS") self.assertEqual(result.run_id, "runid123") @@ -661,7 +662,7 @@ def test_deidentify_file_using_file_path(self, mock_open, mock_basename, mock_ba processedFileType="txt", processedFileExtension="txt") ] - processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=1) + processed_response.word_character_count = WordCharacterCount(word_count=1, character_count=1) # Test the method with patch.object(self.detect, "_Detect__poll_for_processed_file", From 69fe68631e68d7ecb5ec236f76c77a463a0c19c7 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Thu, 6 Nov 2025 15:37:10 +0530 Subject: [PATCH 2/3] SK-2353: add build and install step in shared-tests.yml file --- .github/workflows/shared-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/shared-tests.yml b/.github/workflows/shared-tests.yml index 0ab797d8..73253e3c 100644 --- a/.github/workflows/shared-tests.yml +++ b/.github/workflows/shared-tests.yml @@ -23,6 +23,12 @@ jobs: with: name: "credentials.json" json: ${{ secrets.VALID_SKYFLOW_CREDS_TEST }} + + - name: Build and install skyflow package + run: | + pip install --upgrade pip setuptools wheel + python setup.py sdist bdist_wheel + pip install dist/skyflow-*.whl - name: 'Run Tests' run: | From bd0cf8bd57e75c99784a103535198e6190d46c19 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Thu, 6 Nov 2025 15:52:43 +0530 Subject: [PATCH 3/3] SK-2353: fix utils unit tests --- .github/workflows/shared-build-and-deploy.yml | 5 +++ tests/utils/test__utils.py | 36 +++++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/shared-build-and-deploy.yml b/.github/workflows/shared-build-and-deploy.yml index 1b0309dd..e826c20b 100644 --- a/.github/workflows/shared-build-and-deploy.yml +++ b/.github/workflows/shared-build-and-deploy.yml @@ -27,6 +27,11 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel twine + - name: Build and install skyflow package + run: | + python setup.py sdist bdist_wheel + pip install dist/skyflow-*.whl + - name: Resolve Branch for the Tagged Commit id: resolve-branch if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }} diff --git a/tests/utils/test__utils.py b/tests/utils/test__utils.py index 6eaacf47..6fc3ae68 100644 --- a/tests/utils/test__utils.py +++ b/tests/utils/test__utils.py @@ -494,12 +494,12 @@ def test_parse_deidentify_text_response(self): mock_entity.value = "sensitive_value" mock_entity.entity_type = "EMAIL" mock_entity.entity_scores = {"EMAIL": 0.95} - mock_entity.location = Mock( - start_index=10, - end_index=20, - start_index_processed=15, - end_index_processed=25 - ) + mock_entity.location = { + "start_index": 10, + "end_index": 20, + "start_index_processed": 15, + "end_index_processed":25 + } mock_api_response = Mock() mock_api_response.processed_text = "Sample processed text" @@ -555,12 +555,12 @@ def test__convert_detected_entity_to_entity_info(self): mock_detected_entity.value = "sensitive_value" mock_detected_entity.entity_type = "EMAIL" mock_detected_entity.entity_scores = {"EMAIL": 0.95} - mock_detected_entity.location = Mock( - start_index=10, - end_index=20, - start_index_processed=15, - end_index_processed=25 - ) + mock_detected_entity.location = { + "start_index": 10, + "end_index": 20, + "start_index_processed": 15, + "end_index_processed":25 + } result = convert_detected_entity_to_entity_info(mock_detected_entity) @@ -580,12 +580,12 @@ def test__convert_detected_entity_to_entity_info_with_minimal_data(self): mock_detected_entity.value = None mock_detected_entity.entity_type = "UNKNOWN" mock_detected_entity.entity_scores = {} - mock_detected_entity.location = Mock( - start_index=0, - end_index=0, - start_index_processed=0, - end_index_processed=0 - ) + mock_detected_entity.location = { + "start_index": 0, + "end_index": 0, + "start_index_processed":0, + "end_index_processed":0 + } result = convert_detected_entity_to_entity_info(mock_detected_entity)