diff --git a/setup.py b/setup.py
index a92f3c8d..a205e472 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
if sys.version_info < (3, 8):
raise RuntimeError("skyflow requires Python 3.8+")
-current_version = '2.0.0b7'
+current_version = '2.1.0b1'
setup(
name='skyflow',
diff --git a/skyflow/generated/rest/__init__.py b/skyflow/generated/rest/__init__.py
index 9ff683cb..bad57c24 100644
--- a/skyflow/generated/rest/__init__.py
+++ b/skyflow/generated/rest/__init__.py
@@ -3,16 +3,15 @@
# isort: skip_file
from .types import (
- AdvancedOptionsColumnMapping,
- AdvancedOptionsEntityColumnMap,
- AdvancedOptionsVaultSchema,
AllowRegex,
- AudioConfigTranscriptionType,
AuditEventAuditResourceType,
AuditEventContext,
AuditEventData,
AuditEventHttpInfo,
BatchRecordMethod,
+ CheckGuardrailsResponse,
+ CheckGuardrailsResponseValidation,
+ ConfigurationId,
ContextAccessType,
ContextAuthMode,
DeidentifyFileOutput,
@@ -21,12 +20,7 @@
DeidentifyStatusResponse,
DeidentifyStatusResponseOutputType,
DeidentifyStatusResponseStatus,
- DeidentifyStatusResponseWordCharacterCount,
DeidentifyStringResponse,
- DetectDataAccuracy,
- DetectDataEntities,
- DetectFileRequestDataType,
- DetectRequestDeidentifyOption,
DetectedEntity,
DetokenizeRecordResponseValueType,
EntityLocation,
@@ -36,9 +30,11 @@
ErrorResponseError,
ErrorString,
GooglerpcStatus,
- ProcessedFileOutputProcessedFileType,
ProtobufAny,
RedactionEnumRedaction,
+ ReidentifyFileResponse,
+ ReidentifyFileResponseOutput,
+ ReidentifyFileResponseStatus,
ReidentifyStringResponse,
RequestActionType,
ResourceId,
@@ -51,9 +47,6 @@
TransformationsShiftDates,
TransformationsShiftDatesEntityTypesItem,
Uuid,
- V1AdvancedOptions,
- V1AudioConfig,
- V1AudioOptions,
V1AuditAfterOptions,
V1AuditEventResponse,
V1AuditResponse,
@@ -68,29 +61,17 @@
V1Card,
V1DeleteFileResponse,
V1DeleteRecordResponse,
- V1DetectFileResponse,
- V1DetectStatusResponse,
- V1DetectStatusResponseStatus,
- V1DetectTextRequest,
- V1DetectTextResponse,
V1DetokenizeRecordRequest,
V1DetokenizeRecordResponse,
V1DetokenizeResponse,
V1FieldRecords,
V1FileAvScanStatus,
- V1FileDataFormat,
V1GetAuthTokenResponse,
V1GetFileScanStatusResponse,
V1GetQueryResponse,
- V1ImageOptions,
V1InsertRecordResponse,
- V1Locations,
V1MemberType,
- V1PdfConfig,
- V1PdfOptions,
- V1ProcessedFileOutput,
V1RecordMetaProperties,
- V1ResponseEntities,
V1TokenizeRecordRequest,
V1TokenizeRecordResponse,
V1TokenizeResponse,
@@ -100,7 +81,7 @@
VaultId,
)
from .errors import BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
-from . import audit, authentication, bin_lookup, deprecated, files, query, records, strings, tokens
+from . import audit, authentication, bin_lookup, files, guardrails, query, records, strings, tokens
from .audit import (
AuditServiceListAuditEventsRequestFilterOpsActionType,
AuditServiceListAuditEventsRequestFilterOpsContextAccessType,
@@ -130,6 +111,9 @@
DeidentifyStructuredTextRequestFile,
DeidentifyStructuredTextRequestFileDataFormat,
DeidentifyTextRequestFile,
+ ReidentifyFileRequestFile,
+ ReidentifyFileRequestFileDataFormat,
+ ReidentifyFileRequestFormat,
)
from .records import (
RecordServiceBulkGetRecordRequestOrderBy,
@@ -140,12 +124,8 @@
from .version import __version__
__all__ = [
- "AdvancedOptionsColumnMapping",
- "AdvancedOptionsEntityColumnMap",
- "AdvancedOptionsVaultSchema",
"AllowRegex",
"AsyncSkyflow",
- "AudioConfigTranscriptionType",
"AuditEventAuditResourceType",
"AuditEventContext",
"AuditEventData",
@@ -158,6 +138,9 @@
"AuditServiceListAuditEventsRequestSortOpsOrderBy",
"BadRequestError",
"BatchRecordMethod",
+ "CheckGuardrailsResponse",
+ "CheckGuardrailsResponseValidation",
+ "ConfigurationId",
"ContextAccessType",
"ContextAuthMode",
"DeidentifyAudioRequestFile",
@@ -181,15 +164,10 @@
"DeidentifyStatusResponse",
"DeidentifyStatusResponseOutputType",
"DeidentifyStatusResponseStatus",
- "DeidentifyStatusResponseWordCharacterCount",
"DeidentifyStringResponse",
"DeidentifyStructuredTextRequestFile",
"DeidentifyStructuredTextRequestFileDataFormat",
"DeidentifyTextRequestFile",
- "DetectDataAccuracy",
- "DetectDataEntities",
- "DetectFileRequestDataType",
- "DetectRequestDeidentifyOption",
"DetectedEntity",
"DetokenizeRecordResponseValueType",
"EntityLocation",
@@ -201,12 +179,17 @@
"GooglerpcStatus",
"InternalServerError",
"NotFoundError",
- "ProcessedFileOutputProcessedFileType",
"ProtobufAny",
"RecordServiceBulkGetRecordRequestOrderBy",
"RecordServiceBulkGetRecordRequestRedaction",
"RecordServiceGetRecordRequestRedaction",
"RedactionEnumRedaction",
+ "ReidentifyFileRequestFile",
+ "ReidentifyFileRequestFileDataFormat",
+ "ReidentifyFileRequestFormat",
+ "ReidentifyFileResponse",
+ "ReidentifyFileResponseOutput",
+ "ReidentifyFileResponseStatus",
"ReidentifyStringRequestFormat",
"ReidentifyStringResponse",
"RequestActionType",
@@ -223,9 +206,6 @@
"TransformationsShiftDatesEntityTypesItem",
"UnauthorizedError",
"Uuid",
- "V1AdvancedOptions",
- "V1AudioConfig",
- "V1AudioOptions",
"V1AuditAfterOptions",
"V1AuditEventResponse",
"V1AuditResponse",
@@ -240,29 +220,17 @@
"V1Card",
"V1DeleteFileResponse",
"V1DeleteRecordResponse",
- "V1DetectFileResponse",
- "V1DetectStatusResponse",
- "V1DetectStatusResponseStatus",
- "V1DetectTextRequest",
- "V1DetectTextResponse",
"V1DetokenizeRecordRequest",
"V1DetokenizeRecordResponse",
"V1DetokenizeResponse",
"V1FieldRecords",
"V1FileAvScanStatus",
- "V1FileDataFormat",
"V1GetAuthTokenResponse",
"V1GetFileScanStatusResponse",
"V1GetQueryResponse",
- "V1ImageOptions",
"V1InsertRecordResponse",
- "V1Locations",
"V1MemberType",
- "V1PdfConfig",
- "V1PdfOptions",
- "V1ProcessedFileOutput",
"V1RecordMetaProperties",
- "V1ResponseEntities",
"V1TokenizeRecordRequest",
"V1TokenizeRecordResponse",
"V1TokenizeResponse",
@@ -274,8 +242,8 @@
"audit",
"authentication",
"bin_lookup",
- "deprecated",
"files",
+ "guardrails",
"query",
"records",
"strings",
diff --git a/skyflow/generated/rest/client.py b/skyflow/generated/rest/client.py
index 315d1f86..e111c0b2 100644
--- a/skyflow/generated/rest/client.py
+++ b/skyflow/generated/rest/client.py
@@ -7,9 +7,9 @@
from .authentication.client import AsyncAuthenticationClient, AuthenticationClient
from .bin_lookup.client import AsyncBinLookupClient, BinLookupClient
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
-from .deprecated.client import AsyncDeprecatedClient, DeprecatedClient
from .environment import SkyflowEnvironment
from .files.client import AsyncFilesClient, FilesClient
+from .guardrails.client import AsyncGuardrailsClient, GuardrailsClient
from .query.client import AsyncQueryClient, QueryClient
from .records.client import AsyncRecordsClient, RecordsClient
from .strings.client import AsyncStringsClient, StringsClient
@@ -35,6 +35,9 @@ class Skyflow:
token : typing.Union[str, typing.Callable[[], str]]
+ headers : typing.Optional[typing.Dict[str, str]]
+ Additional headers to send with every request.
+
timeout : typing.Optional[float]
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
@@ -59,6 +62,7 @@ def __init__(
base_url: typing.Optional[str] = None,
environment: SkyflowEnvironment = SkyflowEnvironment.PRODUCTION,
token: typing.Union[str, typing.Callable[[], str]],
+ headers: typing.Optional[typing.Dict[str, str]] = None,
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.Client] = None,
@@ -69,6 +73,7 @@ def __init__(
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
+ headers=headers,
httpx_client=httpx_client
if httpx_client is not None
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
@@ -82,7 +87,7 @@ 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.deprecated = DeprecatedClient(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)
@@ -106,6 +111,9 @@ class AsyncSkyflow:
token : typing.Union[str, typing.Callable[[], str]]
+ headers : typing.Optional[typing.Dict[str, str]]
+ Additional headers to send with every request.
+
timeout : typing.Optional[float]
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
@@ -130,6 +138,7 @@ def __init__(
base_url: typing.Optional[str] = None,
environment: SkyflowEnvironment = SkyflowEnvironment.PRODUCTION,
token: typing.Union[str, typing.Callable[[], str]],
+ headers: typing.Optional[typing.Dict[str, str]] = None,
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.AsyncClient] = None,
@@ -140,6 +149,7 @@ def __init__(
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
+ headers=headers,
httpx_client=httpx_client
if httpx_client is not None
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
@@ -153,7 +163,7 @@ 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.deprecated = AsyncDeprecatedClient(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)
diff --git a/skyflow/generated/rest/core/client_wrapper.py b/skyflow/generated/rest/core/client_wrapper.py
index aa31aea3..a3210a7e 100644
--- a/skyflow/generated/rest/core/client_wrapper.py
+++ b/skyflow/generated/rest/core/client_wrapper.py
@@ -11,18 +11,21 @@ def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
+ headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
):
self._token = token
+ self._headers = headers
self._base_url = base_url
self._timeout = timeout
def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
- "X-Fern-SDK-Name": "skyflow.generated.rest",
- "X-Fern-SDK-Version": "0.0.209",
+ "X-Fern-SDK-Name": "skyflow_vault",
+ "X-Fern-SDK-Version": "0.0.252",
+ **(self.get_custom_headers() or {}),
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
@@ -33,6 +36,9 @@ def _get_token(self) -> str:
else:
return self._token()
+ def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
+ return self._headers
+
def get_base_url(self) -> str:
return self._base_url
@@ -45,11 +51,12 @@ def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
+ headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.Client,
):
- super().__init__(token=token, base_url=base_url, timeout=timeout)
+ super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
self.httpx_client = HttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
@@ -63,11 +70,12 @@ def __init__(
self,
*,
token: typing.Union[str, typing.Callable[[], str]],
+ headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.AsyncClient,
):
- super().__init__(token=token, base_url=base_url, timeout=timeout)
+ super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
self.httpx_client = AsyncHttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
diff --git a/skyflow/generated/rest/core/pydantic_utilities.py b/skyflow/generated/rest/core/pydantic_utilities.py
index 0360ef49..7db29500 100644
--- a/skyflow/generated/rest/core/pydantic_utilities.py
+++ b/skyflow/generated/rest/core/pydantic_utilities.py
@@ -59,9 +59,9 @@ class UniversalBaseModel(pydantic.BaseModel):
protected_namespaces=(),
)
- @pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore[attr-defined]
- def serialize_model(self, handler: pydantic.SerializerFunctionWrapHandler) -> Any: # type: ignore[name-defined]
- serialized = handler(self)
+ @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined]
+ def serialize_model(self) -> Any: # type: ignore[name-defined]
+ serialized = self.model_dump()
data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()}
return data
diff --git a/skyflow/generated/rest/deprecated/client.py b/skyflow/generated/rest/deprecated/client.py
deleted file mode 100644
index bd1cc88c..00000000
--- a/skyflow/generated/rest/deprecated/client.py
+++ /dev/null
@@ -1,598 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
-from ..core.request_options import RequestOptions
-from ..types.detect_data_accuracy import DetectDataAccuracy
-from ..types.detect_data_entities import DetectDataEntities
-from ..types.detect_file_request_data_type import DetectFileRequestDataType
-from ..types.detect_request_deidentify_option import DetectRequestDeidentifyOption
-from ..types.v_1_advanced_options import V1AdvancedOptions
-from ..types.v_1_audio_config import V1AudioConfig
-from ..types.v_1_detect_file_response import V1DetectFileResponse
-from ..types.v_1_detect_status_response import V1DetectStatusResponse
-from ..types.v_1_detect_text_response import V1DetectTextResponse
-from ..types.v_1_file_data_format import V1FileDataFormat
-from ..types.v_1_image_options import V1ImageOptions
-from ..types.v_1_pdf_config import V1PdfConfig
-from .raw_client import AsyncRawDeprecatedClient, RawDeprecatedClient
-
-# this is used as the default value for optional parameters
-OMIT = typing.cast(typing.Any, ...)
-
-
-class DeprecatedClient:
- def __init__(self, *, client_wrapper: SyncClientWrapper):
- self._raw_client = RawDeprecatedClient(client_wrapper=client_wrapper)
-
- @property
- def with_raw_response(self) -> RawDeprecatedClient:
- """
- Retrieves a raw implementation of this client that returns raw responses.
-
- Returns
- -------
- RawDeprecatedClient
- """
- return self._raw_client
-
- def detect_service_detect_file_input(
- self,
- *,
- file: str,
- data_format: V1FileDataFormat,
- input_type: DetectFileRequestDataType,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- audio: typing.Optional[V1AudioConfig] = OMIT,
- image: typing.Optional[V1ImageOptions] = OMIT,
- pdf: typing.Optional[V1PdfConfig] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> V1DetectFileResponse:
- """
- Note: This operation is deprecated. Use one of the De-identify File operations.
Detects and deidentifies sensitive data from image, audio, and video files.
-
- Parameters
- ----------
- file : str
- Path of the file or base64-encoded data that has to be processed.
-
- data_format : V1FileDataFormat
-
- input_type : DetectFileRequestDataType
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- audio : typing.Optional[V1AudioConfig]
-
- image : typing.Optional[V1ImageOptions]
-
- pdf : typing.Optional[V1PdfConfig]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectFileResponse
- A successful response.
-
- Examples
- --------
- from skyflow import Skyflow, V1AudioConfig
-
- client = Skyflow(
- token="YOUR_TOKEN",
- )
- client.deprecated.detect_service_detect_file_input(
- file="fkdjfhdlnnggtsjj...",
- data_format="mp3",
- input_type="BASE64",
- vault_id="a372f752689c9bfc8ca3d4dba",
- restrict_entity_types=[
- "name",
- "age",
- "location",
- "ssn",
- "bank_account",
- "credit_card",
- "credit_card_expiration",
- "cvv",
- "date",
- "date_interval",
- "dob",
- "driver_license",
- "email_address",
- "healthcare_number",
- "numerical_pii",
- "phone_number",
- "medical_code",
- "account_number",
- "gender_sexuality",
- "name_medical_professional",
- "occupation",
- "organization",
- "organization_medical_facility",
- ],
- return_entities=True,
- accuracy="high_multilingual",
- audio=V1AudioConfig(
- output_transcription="none",
- output_processed_audio=False,
- ),
- )
- """
- _response = self._raw_client.detect_service_detect_file_input(
- file=file,
- data_format=data_format,
- input_type=input_type,
- vault_id=vault_id,
- session_id=session_id,
- restrict_entity_types=restrict_entity_types,
- allow_regex=allow_regex,
- restrict_regex=restrict_regex,
- return_entities=return_entities,
- accuracy=accuracy,
- audio=audio,
- image=image,
- pdf=pdf,
- advanced_options=advanced_options,
- deidentify_token_format=deidentify_token_format,
- request_options=request_options,
- )
- return _response.data
-
- def detect_service_detect_status(
- self, id: str, *, vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
- ) -> V1DetectStatusResponse:
- """
- Note: This operation is deprecated. Use Get Detect Run.
Returns the status of a file deidentification request.
-
- Parameters
- ----------
- id : str
- ID of the deidentification request.
-
- vault_id : typing.Optional[str]
- ID of the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectStatusResponse
- A successful response.
-
- Examples
- --------
- from skyflow import Skyflow
-
- client = Skyflow(
- token="YOUR_TOKEN",
- )
- client.deprecated.detect_service_detect_status(
- id="ID",
- )
- """
- _response = self._raw_client.detect_service_detect_status(
- id, vault_id=vault_id, request_options=request_options
- )
- return _response.data
-
- def detect_service_detect_text(
- self,
- *,
- text: str,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- store_entities: typing.Optional[bool] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> V1DetectTextResponse:
- """
- Note: This operation is deprecated. Use De-identify String.
Detects and deidentifies sensitive data from text.
-
- Parameters
- ----------
- text : str
- Data to deidentify.
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- store_entities : typing.Optional[bool]
- Indicates whether entities should be stored in the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectTextResponse
- A successful response.
-
- Examples
- --------
- from skyflow import Skyflow
-
- client = Skyflow(
- token="YOUR_TOKEN",
- )
- client.deprecated.detect_service_detect_text(
- text="text",
- vault_id="c848741aefb74bf38780da5399a76507",
- )
- """
- _response = self._raw_client.detect_service_detect_text(
- text=text,
- vault_id=vault_id,
- session_id=session_id,
- restrict_entity_types=restrict_entity_types,
- deidentify_token_format=deidentify_token_format,
- allow_regex=allow_regex,
- restrict_regex=restrict_regex,
- return_entities=return_entities,
- accuracy=accuracy,
- advanced_options=advanced_options,
- store_entities=store_entities,
- request_options=request_options,
- )
- return _response.data
-
-
-class AsyncDeprecatedClient:
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
- self._raw_client = AsyncRawDeprecatedClient(client_wrapper=client_wrapper)
-
- @property
- def with_raw_response(self) -> AsyncRawDeprecatedClient:
- """
- Retrieves a raw implementation of this client that returns raw responses.
-
- Returns
- -------
- AsyncRawDeprecatedClient
- """
- return self._raw_client
-
- async def detect_service_detect_file_input(
- self,
- *,
- file: str,
- data_format: V1FileDataFormat,
- input_type: DetectFileRequestDataType,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- audio: typing.Optional[V1AudioConfig] = OMIT,
- image: typing.Optional[V1ImageOptions] = OMIT,
- pdf: typing.Optional[V1PdfConfig] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> V1DetectFileResponse:
- """
- Note: This operation is deprecated. Use one of the De-identify File operations.
Detects and deidentifies sensitive data from image, audio, and video files.
-
- Parameters
- ----------
- file : str
- Path of the file or base64-encoded data that has to be processed.
-
- data_format : V1FileDataFormat
-
- input_type : DetectFileRequestDataType
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- audio : typing.Optional[V1AudioConfig]
-
- image : typing.Optional[V1ImageOptions]
-
- pdf : typing.Optional[V1PdfConfig]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectFileResponse
- A successful response.
-
- Examples
- --------
- import asyncio
-
- from skyflow import AsyncSkyflow, V1AudioConfig
-
- client = AsyncSkyflow(
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.deprecated.detect_service_detect_file_input(
- file="fkdjfhdlnnggtsjj...",
- data_format="mp3",
- input_type="BASE64",
- vault_id="a372f752689c9bfc8ca3d4dba",
- restrict_entity_types=[
- "name",
- "age",
- "location",
- "ssn",
- "bank_account",
- "credit_card",
- "credit_card_expiration",
- "cvv",
- "date",
- "date_interval",
- "dob",
- "driver_license",
- "email_address",
- "healthcare_number",
- "numerical_pii",
- "phone_number",
- "medical_code",
- "account_number",
- "gender_sexuality",
- "name_medical_professional",
- "occupation",
- "organization",
- "organization_medical_facility",
- ],
- return_entities=True,
- accuracy="high_multilingual",
- audio=V1AudioConfig(
- output_transcription="none",
- output_processed_audio=False,
- ),
- )
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.detect_service_detect_file_input(
- file=file,
- data_format=data_format,
- input_type=input_type,
- vault_id=vault_id,
- session_id=session_id,
- restrict_entity_types=restrict_entity_types,
- allow_regex=allow_regex,
- restrict_regex=restrict_regex,
- return_entities=return_entities,
- accuracy=accuracy,
- audio=audio,
- image=image,
- pdf=pdf,
- advanced_options=advanced_options,
- deidentify_token_format=deidentify_token_format,
- request_options=request_options,
- )
- return _response.data
-
- async def detect_service_detect_status(
- self, id: str, *, vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
- ) -> V1DetectStatusResponse:
- """
- Note: This operation is deprecated. Use Get Detect Run.
Returns the status of a file deidentification request.
-
- Parameters
- ----------
- id : str
- ID of the deidentification request.
-
- vault_id : typing.Optional[str]
- ID of the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectStatusResponse
- A successful response.
-
- Examples
- --------
- import asyncio
-
- from skyflow import AsyncSkyflow
-
- client = AsyncSkyflow(
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.deprecated.detect_service_detect_status(
- id="ID",
- )
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.detect_service_detect_status(
- id, vault_id=vault_id, request_options=request_options
- )
- return _response.data
-
- async def detect_service_detect_text(
- self,
- *,
- text: str,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- store_entities: typing.Optional[bool] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> V1DetectTextResponse:
- """
- Note: This operation is deprecated. Use De-identify String.
Detects and deidentifies sensitive data from text.
-
- Parameters
- ----------
- text : str
- Data to deidentify.
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- store_entities : typing.Optional[bool]
- Indicates whether entities should be stored in the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- V1DetectTextResponse
- A successful response.
-
- Examples
- --------
- import asyncio
-
- from skyflow import AsyncSkyflow
-
- client = AsyncSkyflow(
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.deprecated.detect_service_detect_text(
- text="text",
- vault_id="c848741aefb74bf38780da5399a76507",
- )
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.detect_service_detect_text(
- text=text,
- vault_id=vault_id,
- session_id=session_id,
- restrict_entity_types=restrict_entity_types,
- deidentify_token_format=deidentify_token_format,
- allow_regex=allow_regex,
- restrict_regex=restrict_regex,
- return_entities=return_entities,
- accuracy=accuracy,
- advanced_options=advanced_options,
- store_entities=store_entities,
- request_options=request_options,
- )
- return _response.data
diff --git a/skyflow/generated/rest/deprecated/raw_client.py b/skyflow/generated/rest/deprecated/raw_client.py
deleted file mode 100644
index 11dd7ef1..00000000
--- a/skyflow/generated/rest/deprecated/raw_client.py
+++ /dev/null
@@ -1,624 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-from json.decoder import JSONDecodeError
-
-from ..core.api_error import ApiError
-from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
-from ..core.http_response import AsyncHttpResponse, HttpResponse
-from ..core.jsonable_encoder import jsonable_encoder
-from ..core.pydantic_utilities import parse_obj_as
-from ..core.request_options import RequestOptions
-from ..core.serialization import convert_and_respect_annotation_metadata
-from ..errors.not_found_error import NotFoundError
-from ..types.detect_data_accuracy import DetectDataAccuracy
-from ..types.detect_data_entities import DetectDataEntities
-from ..types.detect_file_request_data_type import DetectFileRequestDataType
-from ..types.detect_request_deidentify_option import DetectRequestDeidentifyOption
-from ..types.v_1_advanced_options import V1AdvancedOptions
-from ..types.v_1_audio_config import V1AudioConfig
-from ..types.v_1_detect_file_response import V1DetectFileResponse
-from ..types.v_1_detect_status_response import V1DetectStatusResponse
-from ..types.v_1_detect_text_response import V1DetectTextResponse
-from ..types.v_1_file_data_format import V1FileDataFormat
-from ..types.v_1_image_options import V1ImageOptions
-from ..types.v_1_pdf_config import V1PdfConfig
-
-# this is used as the default value for optional parameters
-OMIT = typing.cast(typing.Any, ...)
-
-
-class RawDeprecatedClient:
- def __init__(self, *, client_wrapper: SyncClientWrapper):
- self._client_wrapper = client_wrapper
-
- def detect_service_detect_file_input(
- self,
- *,
- file: str,
- data_format: V1FileDataFormat,
- input_type: DetectFileRequestDataType,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- audio: typing.Optional[V1AudioConfig] = OMIT,
- image: typing.Optional[V1ImageOptions] = OMIT,
- pdf: typing.Optional[V1PdfConfig] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[V1DetectFileResponse]:
- """
- Note: This operation is deprecated. Use one of the De-identify File operations.
Detects and deidentifies sensitive data from image, audio, and video files.
-
- Parameters
- ----------
- file : str
- Path of the file or base64-encoded data that has to be processed.
-
- data_format : V1FileDataFormat
-
- input_type : DetectFileRequestDataType
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- audio : typing.Optional[V1AudioConfig]
-
- image : typing.Optional[V1ImageOptions]
-
- pdf : typing.Optional[V1PdfConfig]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- HttpResponse[V1DetectFileResponse]
- A successful response.
- """
- _response = self._client_wrapper.httpx_client.request(
- "v1/detect/file",
- method="POST",
- json={
- "file": file,
- "data_format": data_format,
- "input_type": input_type,
- "vault_id": vault_id,
- "session_id": session_id,
- "restrict_entity_types": restrict_entity_types,
- "allow_regex": allow_regex,
- "restrict_regex": restrict_regex,
- "return_entities": return_entities,
- "accuracy": accuracy,
- "audio": convert_and_respect_annotation_metadata(
- object_=audio, annotation=V1AudioConfig, direction="write"
- ),
- "image": convert_and_respect_annotation_metadata(
- object_=image, annotation=V1ImageOptions, direction="write"
- ),
- "pdf": convert_and_respect_annotation_metadata(object_=pdf, annotation=V1PdfConfig, direction="write"),
- "advanced_options": convert_and_respect_annotation_metadata(
- object_=advanced_options, annotation=V1AdvancedOptions, direction="write"
- ),
- "deidentify_token_format": deidentify_token_format,
- },
- headers={
- "content-type": "application/json",
- },
- request_options=request_options,
- omit=OMIT,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectFileResponse,
- parse_obj_as(
- type_=V1DetectFileResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return HttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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 detect_service_detect_status(
- self, id: str, *, vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
- ) -> HttpResponse[V1DetectStatusResponse]:
- """
- Note: This operation is deprecated. Use Get Detect Run.
Returns the status of a file deidentification request.
-
- Parameters
- ----------
- id : str
- ID of the deidentification request.
-
- vault_id : typing.Optional[str]
- ID of the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- HttpResponse[V1DetectStatusResponse]
- A successful response.
- """
- _response = self._client_wrapper.httpx_client.request(
- f"v1/detect/status/{jsonable_encoder(id)}",
- method="GET",
- params={
- "vault_id": vault_id,
- },
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectStatusResponse,
- parse_obj_as(
- type_=V1DetectStatusResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return HttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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 detect_service_detect_text(
- self,
- *,
- text: str,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- store_entities: typing.Optional[bool] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[V1DetectTextResponse]:
- """
- Note: This operation is deprecated. Use De-identify String.
Detects and deidentifies sensitive data from text.
-
- Parameters
- ----------
- text : str
- Data to deidentify.
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- store_entities : typing.Optional[bool]
- Indicates whether entities should be stored in the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- HttpResponse[V1DetectTextResponse]
- A successful response.
- """
- _response = self._client_wrapper.httpx_client.request(
- "v1/detect/text",
- method="POST",
- json={
- "text": text,
- "vault_id": vault_id,
- "session_id": session_id,
- "restrict_entity_types": restrict_entity_types,
- "deidentify_token_format": deidentify_token_format,
- "allow_regex": allow_regex,
- "restrict_regex": restrict_regex,
- "return_entities": return_entities,
- "accuracy": accuracy,
- "advanced_options": convert_and_respect_annotation_metadata(
- object_=advanced_options, annotation=V1AdvancedOptions, direction="write"
- ),
- "store_entities": store_entities,
- },
- headers={
- "content-type": "application/json",
- },
- request_options=request_options,
- omit=OMIT,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectTextResponse,
- parse_obj_as(
- type_=V1DetectTextResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return HttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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)
-
-
-class AsyncRawDeprecatedClient:
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
- self._client_wrapper = client_wrapper
-
- async def detect_service_detect_file_input(
- self,
- *,
- file: str,
- data_format: V1FileDataFormat,
- input_type: DetectFileRequestDataType,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- audio: typing.Optional[V1AudioConfig] = OMIT,
- image: typing.Optional[V1ImageOptions] = OMIT,
- pdf: typing.Optional[V1PdfConfig] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> AsyncHttpResponse[V1DetectFileResponse]:
- """
- Note: This operation is deprecated. Use one of the De-identify File operations.
Detects and deidentifies sensitive data from image, audio, and video files.
-
- Parameters
- ----------
- file : str
- Path of the file or base64-encoded data that has to be processed.
-
- data_format : V1FileDataFormat
-
- input_type : DetectFileRequestDataType
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- audio : typing.Optional[V1AudioConfig]
-
- image : typing.Optional[V1ImageOptions]
-
- pdf : typing.Optional[V1PdfConfig]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- AsyncHttpResponse[V1DetectFileResponse]
- A successful response.
- """
- _response = await self._client_wrapper.httpx_client.request(
- "v1/detect/file",
- method="POST",
- json={
- "file": file,
- "data_format": data_format,
- "input_type": input_type,
- "vault_id": vault_id,
- "session_id": session_id,
- "restrict_entity_types": restrict_entity_types,
- "allow_regex": allow_regex,
- "restrict_regex": restrict_regex,
- "return_entities": return_entities,
- "accuracy": accuracy,
- "audio": convert_and_respect_annotation_metadata(
- object_=audio, annotation=V1AudioConfig, direction="write"
- ),
- "image": convert_and_respect_annotation_metadata(
- object_=image, annotation=V1ImageOptions, direction="write"
- ),
- "pdf": convert_and_respect_annotation_metadata(object_=pdf, annotation=V1PdfConfig, direction="write"),
- "advanced_options": convert_and_respect_annotation_metadata(
- object_=advanced_options, annotation=V1AdvancedOptions, direction="write"
- ),
- "deidentify_token_format": deidentify_token_format,
- },
- headers={
- "content-type": "application/json",
- },
- request_options=request_options,
- omit=OMIT,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectFileResponse,
- parse_obj_as(
- type_=V1DetectFileResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return AsyncHttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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 detect_service_detect_status(
- self, id: str, *, vault_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
- ) -> AsyncHttpResponse[V1DetectStatusResponse]:
- """
- Note: This operation is deprecated. Use Get Detect Run.
Returns the status of a file deidentification request.
-
- Parameters
- ----------
- id : str
- ID of the deidentification request.
-
- vault_id : typing.Optional[str]
- ID of the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- AsyncHttpResponse[V1DetectStatusResponse]
- A successful response.
- """
- _response = await self._client_wrapper.httpx_client.request(
- f"v1/detect/status/{jsonable_encoder(id)}",
- method="GET",
- params={
- "vault_id": vault_id,
- },
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectStatusResponse,
- parse_obj_as(
- type_=V1DetectStatusResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return AsyncHttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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 detect_service_detect_text(
- self,
- *,
- text: str,
- vault_id: str,
- session_id: typing.Optional[str] = OMIT,
- restrict_entity_types: typing.Optional[typing.Sequence[DetectDataEntities]] = OMIT,
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = OMIT,
- allow_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- restrict_regex: typing.Optional[typing.Sequence[str]] = OMIT,
- return_entities: typing.Optional[bool] = OMIT,
- accuracy: typing.Optional[DetectDataAccuracy] = OMIT,
- advanced_options: typing.Optional[V1AdvancedOptions] = OMIT,
- store_entities: typing.Optional[bool] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> AsyncHttpResponse[V1DetectTextResponse]:
- """
- Note: This operation is deprecated. Use De-identify String.
Detects and deidentifies sensitive data from text.
-
- Parameters
- ----------
- text : str
- Data to deidentify.
-
- vault_id : str
- ID of the vault.
-
- session_id : typing.Optional[str]
- Will give a handle to delete the tokens generated during a specific interaction.
-
- restrict_entity_types : typing.Optional[typing.Sequence[DetectDataEntities]]
- Entities to detect and deidentify.
-
- deidentify_token_format : typing.Optional[DetectRequestDeidentifyOption]
-
- allow_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to ignore when detecting entities.
-
- restrict_regex : typing.Optional[typing.Sequence[str]]
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
-
- return_entities : typing.Optional[bool]
- If `true`, returns the details for the detected entities.
-
- accuracy : typing.Optional[DetectDataAccuracy]
-
- advanced_options : typing.Optional[V1AdvancedOptions]
-
- store_entities : typing.Optional[bool]
- Indicates whether entities should be stored in the vault.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- AsyncHttpResponse[V1DetectTextResponse]
- A successful response.
- """
- _response = await self._client_wrapper.httpx_client.request(
- "v1/detect/text",
- method="POST",
- json={
- "text": text,
- "vault_id": vault_id,
- "session_id": session_id,
- "restrict_entity_types": restrict_entity_types,
- "deidentify_token_format": deidentify_token_format,
- "allow_regex": allow_regex,
- "restrict_regex": restrict_regex,
- "return_entities": return_entities,
- "accuracy": accuracy,
- "advanced_options": convert_and_respect_annotation_metadata(
- object_=advanced_options, annotation=V1AdvancedOptions, direction="write"
- ),
- "store_entities": store_entities,
- },
- headers={
- "content-type": "application/json",
- },
- request_options=request_options,
- omit=OMIT,
- )
- try:
- if 200 <= _response.status_code < 300:
- _data = typing.cast(
- V1DetectTextResponse,
- parse_obj_as(
- type_=V1DetectTextResponse, # type: ignore
- object_=_response.json(),
- ),
- )
- return AsyncHttpResponse(response=_response, data=_data)
- 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(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- 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)
diff --git a/skyflow/generated/rest/files/__init__.py b/skyflow/generated/rest/files/__init__.py
index 1b10a15a..b1679867 100644
--- a/skyflow/generated/rest/files/__init__.py
+++ b/skyflow/generated/rest/files/__init__.py
@@ -21,6 +21,9 @@
DeidentifyStructuredTextRequestFile,
DeidentifyStructuredTextRequestFileDataFormat,
DeidentifyTextRequestFile,
+ ReidentifyFileRequestFile,
+ ReidentifyFileRequestFileDataFormat,
+ ReidentifyFileRequestFormat,
)
__all__ = [
@@ -42,4 +45,7 @@
"DeidentifyStructuredTextRequestFile",
"DeidentifyStructuredTextRequestFileDataFormat",
"DeidentifyTextRequestFile",
+ "ReidentifyFileRequestFile",
+ "ReidentifyFileRequestFileDataFormat",
+ "ReidentifyFileRequestFormat",
]
diff --git a/skyflow/generated/rest/files/client.py b/skyflow/generated/rest/files/client.py
index 913ccd59..654789de 100644
--- a/skyflow/generated/rest/files/client.py
+++ b/skyflow/generated/rest/files/client.py
@@ -5,9 +5,11 @@
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.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
@@ -26,6 +28,8 @@
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
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
@@ -51,6 +55,7 @@ def deidentify_file(
*,
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,
@@ -68,6 +73,8 @@ def deidentify_file(
file : DeidentifyFileRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -105,6 +112,7 @@ def deidentify_file(
_response = self._raw_client.deidentify_file(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -119,6 +127,7 @@ def deidentify_document(
*,
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,
@@ -136,6 +145,8 @@ def deidentify_document(
file : DeidentifyDocumentRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -173,6 +184,7 @@ def deidentify_document(
_response = self._raw_client.deidentify_document(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -187,6 +199,7 @@ def deidentify_pdf(
*,
vault_id: VaultId,
file: DeidentifyPdfRequestFile,
+ configuration_id: typing.Optional[ConfigurationId] = OMIT,
density: typing.Optional[int] = OMIT,
max_resolution: typing.Optional[int] = OMIT,
entity_types: typing.Optional[EntityTypes] = OMIT,
@@ -206,6 +219,8 @@ def deidentify_pdf(
file : DeidentifyPdfRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
density : typing.Optional[int]
Pixel density at which to process the PDF file.
@@ -248,6 +263,7 @@ def deidentify_pdf(
_response = self._raw_client.deidentify_pdf(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
density=density,
max_resolution=max_resolution,
entity_types=entity_types,
@@ -264,6 +280,7 @@ def deidentify_image(
*,
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,
@@ -284,6 +301,8 @@ def deidentify_image(
file : DeidentifyImageRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
output_processed_image : typing.Optional[bool]
If `true`, includes processed image in the output.
@@ -330,6 +349,7 @@ def deidentify_image(
_response = self._raw_client.deidentify_image(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
output_processed_image=output_processed_image,
output_ocr_text=output_ocr_text,
masking_method=masking_method,
@@ -347,6 +367,7 @@ def deidentify_text(
*,
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,
@@ -364,6 +385,8 @@ def deidentify_text(
file : DeidentifyTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -400,6 +423,7 @@ def deidentify_text(
_response = self._raw_client.deidentify_text(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -414,6 +438,7 @@ def deidentify_structured_text(
*,
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,
@@ -431,6 +456,8 @@ def deidentify_structured_text(
file : DeidentifyStructuredTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -468,6 +495,7 @@ def deidentify_structured_text(
_response = self._raw_client.deidentify_structured_text(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -482,6 +510,7 @@ def deidentify_spreadsheet(
*,
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,
@@ -499,6 +528,8 @@ def deidentify_spreadsheet(
file : DeidentifySpreadsheetRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -536,6 +567,7 @@ def deidentify_spreadsheet(
_response = self._raw_client.deidentify_spreadsheet(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -550,6 +582,7 @@ def deidentify_presentation(
*,
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,
@@ -567,6 +600,8 @@ def deidentify_presentation(
file : DeidentifyPresentationRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -604,6 +639,7 @@ def deidentify_presentation(
_response = self._raw_client.deidentify_presentation(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -618,6 +654,7 @@ def deidentify_audio(
*,
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,
@@ -641,6 +678,8 @@ def deidentify_audio(
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.
@@ -696,6 +735,7 @@ def deidentify_audio(
_response = self._raw_client.deidentify_audio(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
output_processed_audio=output_processed_audio,
output_transcription=output_transcription,
bleep_gain=bleep_gain,
@@ -748,6 +788,56 @@ def get_run(
_response = self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options)
return _response.data
+ def reidentify_file(
+ self,
+ *,
+ vault_id: VaultId,
+ file: ReidentifyFileRequestFile,
+ format: typing.Optional[ReidentifyFileRequestFormat] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ReidentifyFileResponse:
+ """
+ Re-identifies tokens in a file.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ReidentifyFileResponse
+ A successful response.
+
+ 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",
+ ),
+ )
+ """
+ _response = self._raw_client.reidentify_file(
+ vault_id=vault_id, file=file, format=format, request_options=request_options
+ )
+ return _response.data
+
class AsyncFilesClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -769,6 +859,7 @@ async def deidentify_file(
*,
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,
@@ -786,6 +877,8 @@ async def deidentify_file(
file : DeidentifyFileRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -831,6 +924,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_file(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -845,6 +939,7 @@ async def deidentify_document(
*,
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,
@@ -862,6 +957,8 @@ async def deidentify_document(
file : DeidentifyDocumentRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -907,6 +1004,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_document(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -921,6 +1019,7 @@ async def deidentify_pdf(
*,
vault_id: VaultId,
file: DeidentifyPdfRequestFile,
+ configuration_id: typing.Optional[ConfigurationId] = OMIT,
density: typing.Optional[int] = OMIT,
max_resolution: typing.Optional[int] = OMIT,
entity_types: typing.Optional[EntityTypes] = OMIT,
@@ -940,6 +1039,8 @@ async def deidentify_pdf(
file : DeidentifyPdfRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
density : typing.Optional[int]
Pixel density at which to process the PDF file.
@@ -990,6 +1091,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_pdf(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
density=density,
max_resolution=max_resolution,
entity_types=entity_types,
@@ -1006,6 +1108,7 @@ async def deidentify_image(
*,
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,
@@ -1026,6 +1129,8 @@ async def deidentify_image(
file : DeidentifyImageRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
output_processed_image : typing.Optional[bool]
If `true`, includes processed image in the output.
@@ -1080,6 +1185,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_image(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
output_processed_image=output_processed_image,
output_ocr_text=output_ocr_text,
masking_method=masking_method,
@@ -1097,6 +1203,7 @@ async def deidentify_text(
*,
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,
@@ -1114,6 +1221,8 @@ async def deidentify_text(
file : DeidentifyTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1158,6 +1267,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_text(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -1172,6 +1282,7 @@ async def deidentify_structured_text(
*,
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,
@@ -1189,6 +1300,8 @@ async def deidentify_structured_text(
file : DeidentifyStructuredTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1234,6 +1347,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_structured_text(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -1248,6 +1362,7 @@ async def deidentify_spreadsheet(
*,
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,
@@ -1265,6 +1380,8 @@ async def deidentify_spreadsheet(
file : DeidentifySpreadsheetRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1310,6 +1427,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_spreadsheet(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -1324,6 +1442,7 @@ async def deidentify_presentation(
*,
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,
@@ -1341,6 +1460,8 @@ async def deidentify_presentation(
file : DeidentifyPresentationRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1386,6 +1507,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_presentation(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -1400,6 +1522,7 @@ async def deidentify_audio(
*,
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,
@@ -1423,6 +1546,8 @@ async def deidentify_audio(
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.
@@ -1486,6 +1611,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_audio(
vault_id=vault_id,
file=file,
+ configuration_id=configuration_id,
output_processed_audio=output_processed_audio,
output_transcription=output_transcription,
bleep_gain=bleep_gain,
@@ -1545,3 +1671,61 @@ async def main() -> None:
"""
_response = await self._raw_client.get_run(run_id, vault_id=vault_id, request_options=request_options)
return _response.data
+
+ async def reidentify_file(
+ self,
+ *,
+ vault_id: VaultId,
+ file: ReidentifyFileRequestFile,
+ format: typing.Optional[ReidentifyFileRequestFormat] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ReidentifyFileResponse:
+ """
+ Re-identifies tokens in a file.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ReidentifyFileResponse
+ A successful response.
+
+ Examples
+ --------
+ import asyncio
+
+ from skyflow import AsyncSkyflow
+ from skyflow.files import ReidentifyFileRequestFile
+
+ client = AsyncSkyflow(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.files.reidentify_file(
+ vault_id="f4b3b3b33b3b3b3b3b3b3b3b3b3b3b3b",
+ file=ReidentifyFileRequestFile(
+ base_64="Zm9vYmFy",
+ data_format="txt",
+ ),
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.reidentify_file(
+ vault_id=vault_id, file=file, format=format, 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 b3193544..5a67292f 100644
--- a/skyflow/generated/rest/files/raw_client.py
+++ b/skyflow/generated/rest/files/raw_client.py
@@ -15,10 +15,12 @@
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.error_response import ErrorResponse
+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
@@ -36,6 +38,8 @@
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
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
@@ -50,6 +54,7 @@ def deidentify_file(
*,
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,
@@ -67,6 +72,8 @@ def deidentify_file(
file : DeidentifyFileRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -93,6 +100,7 @@ def deidentify_file(
"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"
@@ -162,6 +170,7 @@ def deidentify_document(
*,
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,
@@ -179,6 +188,8 @@ def deidentify_document(
file : DeidentifyDocumentRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -205,6 +216,7 @@ def deidentify_document(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyDocumentRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -274,6 +286,7 @@ def deidentify_pdf(
*,
vault_id: VaultId,
file: DeidentifyPdfRequestFile,
+ configuration_id: typing.Optional[ConfigurationId] = OMIT,
density: typing.Optional[int] = OMIT,
max_resolution: typing.Optional[int] = OMIT,
entity_types: typing.Optional[EntityTypes] = OMIT,
@@ -293,6 +306,8 @@ def deidentify_pdf(
file : DeidentifyPdfRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
density : typing.Optional[int]
Pixel density at which to process the PDF file.
@@ -325,6 +340,7 @@ def deidentify_pdf(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyPdfRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"density": density,
"max_resolution": max_resolution,
"entity_types": entity_types,
@@ -396,6 +412,7 @@ def deidentify_image(
*,
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,
@@ -416,6 +433,8 @@ def deidentify_image(
file : DeidentifyImageRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
output_processed_image : typing.Optional[bool]
If `true`, includes processed image in the output.
@@ -451,6 +470,7 @@ def deidentify_image(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyImageRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"output_processed_image": output_processed_image,
"output_ocr_text": output_ocr_text,
"masking_method": masking_method,
@@ -523,6 +543,7 @@ def deidentify_text(
*,
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,
@@ -540,6 +561,8 @@ def deidentify_text(
file : DeidentifyTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -566,6 +589,7 @@ def deidentify_text(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyTextRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -635,6 +659,7 @@ def deidentify_structured_text(
*,
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,
@@ -652,6 +677,8 @@ def deidentify_structured_text(
file : DeidentifyStructuredTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -678,6 +705,7 @@ def deidentify_structured_text(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyStructuredTextRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -747,6 +775,7 @@ def deidentify_spreadsheet(
*,
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,
@@ -764,6 +793,8 @@ def deidentify_spreadsheet(
file : DeidentifySpreadsheetRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -790,6 +821,7 @@ def deidentify_spreadsheet(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifySpreadsheetRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -859,6 +891,7 @@ def deidentify_presentation(
*,
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,
@@ -876,6 +909,8 @@ def deidentify_presentation(
file : DeidentifyPresentationRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -902,6 +937,7 @@ def deidentify_presentation(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyPresentationRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -971,6 +1007,7 @@ def deidentify_audio(
*,
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,
@@ -994,6 +1031,8 @@ def deidentify_audio(
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.
@@ -1038,6 +1077,7 @@ def deidentify_audio(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyAudioRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"output_processed_audio": output_processed_audio,
"output_transcription": output_transcription,
"bleep_gain": bleep_gain,
@@ -1197,6 +1237,101 @@ 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(
+ self,
+ *,
+ vault_id: VaultId,
+ file: ReidentifyFileRequestFile,
+ format: typing.Optional[ReidentifyFileRequestFormat] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ReidentifyFileResponse]:
+ """
+ Re-identifies tokens in a file.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ReidentifyFileResponse]
+ A successful response.
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v1/detect/reidentify/file",
+ method="POST",
+ json={
+ "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,
+ parse_obj_as(
+ type_=ReidentifyFileResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ 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 == 401:
+ raise UnauthorizedError(
+ 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),
+ body=typing.cast(
+ ErrorResponse,
+ parse_obj_as(
+ type_=ErrorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ 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)
+
class AsyncRawFilesClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -1207,6 +1342,7 @@ async def deidentify_file(
*,
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,
@@ -1224,6 +1360,8 @@ async def deidentify_file(
file : DeidentifyFileRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1250,6 +1388,7 @@ async def deidentify_file(
"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"
@@ -1319,6 +1458,7 @@ async def deidentify_document(
*,
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,
@@ -1336,6 +1476,8 @@ async def deidentify_document(
file : DeidentifyDocumentRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1362,6 +1504,7 @@ async def deidentify_document(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyDocumentRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -1431,6 +1574,7 @@ async def deidentify_pdf(
*,
vault_id: VaultId,
file: DeidentifyPdfRequestFile,
+ configuration_id: typing.Optional[ConfigurationId] = OMIT,
density: typing.Optional[int] = OMIT,
max_resolution: typing.Optional[int] = OMIT,
entity_types: typing.Optional[EntityTypes] = OMIT,
@@ -1450,6 +1594,8 @@ async def deidentify_pdf(
file : DeidentifyPdfRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
density : typing.Optional[int]
Pixel density at which to process the PDF file.
@@ -1482,6 +1628,7 @@ async def deidentify_pdf(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyPdfRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"density": density,
"max_resolution": max_resolution,
"entity_types": entity_types,
@@ -1553,6 +1700,7 @@ async def deidentify_image(
*,
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,
@@ -1573,6 +1721,8 @@ async def deidentify_image(
file : DeidentifyImageRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
output_processed_image : typing.Optional[bool]
If `true`, includes processed image in the output.
@@ -1608,6 +1758,7 @@ async def deidentify_image(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyImageRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"output_processed_image": output_processed_image,
"output_ocr_text": output_ocr_text,
"masking_method": masking_method,
@@ -1680,6 +1831,7 @@ async def deidentify_text(
*,
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,
@@ -1697,6 +1849,8 @@ async def deidentify_text(
file : DeidentifyTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1723,6 +1877,7 @@ async def deidentify_text(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyTextRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -1792,6 +1947,7 @@ async def deidentify_structured_text(
*,
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,
@@ -1809,6 +1965,8 @@ async def deidentify_structured_text(
file : DeidentifyStructuredTextRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1835,6 +1993,7 @@ async def deidentify_structured_text(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyStructuredTextRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -1904,6 +2063,7 @@ async def deidentify_spreadsheet(
*,
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,
@@ -1921,6 +2081,8 @@ async def deidentify_spreadsheet(
file : DeidentifySpreadsheetRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -1947,6 +2109,7 @@ async def deidentify_spreadsheet(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifySpreadsheetRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -2016,6 +2179,7 @@ async def deidentify_presentation(
*,
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,
@@ -2033,6 +2197,8 @@ async def deidentify_presentation(
file : DeidentifyPresentationRequestFile
File to de-identify. Files are specified as Base64-encoded data.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenTypeWithoutVault]
@@ -2059,6 +2225,7 @@ async def deidentify_presentation(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyPresentationRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenTypeWithoutVault, direction="write"
@@ -2128,6 +2295,7 @@ async def deidentify_audio(
*,
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,
@@ -2151,6 +2319,8 @@ async def deidentify_audio(
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.
@@ -2195,6 +2365,7 @@ async def deidentify_audio(
"file": convert_and_respect_annotation_metadata(
object_=file, annotation=DeidentifyAudioRequestFile, direction="write"
),
+ "configuration_id": configuration_id,
"output_processed_audio": output_processed_audio,
"output_transcription": output_transcription,
"bleep_gain": bleep_gain,
@@ -2353,3 +2524,98 @@ async def get_run(
except JSONDecodeError:
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(
+ self,
+ *,
+ vault_id: VaultId,
+ file: ReidentifyFileRequestFile,
+ format: typing.Optional[ReidentifyFileRequestFormat] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ReidentifyFileResponse]:
+ """
+ Re-identifies tokens in a file.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ReidentifyFileResponse]
+ A successful response.
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v1/detect/reidentify/file",
+ method="POST",
+ json={
+ "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,
+ parse_obj_as(
+ type_=ReidentifyFileResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ 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 == 401:
+ raise UnauthorizedError(
+ 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),
+ body=typing.cast(
+ ErrorResponse,
+ parse_obj_as(
+ type_=ErrorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ 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)
diff --git a/skyflow/generated/rest/files/types/__init__.py b/skyflow/generated/rest/files/types/__init__.py
index e6343d60..78943a33 100644
--- a/skyflow/generated/rest/files/types/__init__.py
+++ b/skyflow/generated/rest/files/types/__init__.py
@@ -20,6 +20,9 @@
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
__all__ = [
"DeidentifyAudioRequestFile",
@@ -40,4 +43,7 @@
"DeidentifyStructuredTextRequestFile",
"DeidentifyStructuredTextRequestFileDataFormat",
"DeidentifyTextRequestFile",
+ "ReidentifyFileRequestFile",
+ "ReidentifyFileRequestFileDataFormat",
+ "ReidentifyFileRequestFormat",
]
diff --git a/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py b/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py
index 20581451..f3294014 100644
--- a/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py
+++ b/skyflow/generated/rest/files/types/deidentify_file_request_file_data_format.py
@@ -6,6 +6,7 @@
typing.Literal[
"bmp",
"csv",
+ "dcm",
"doc",
"docx",
"jpeg",
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
index bc0c338c..d1ff8c83 100644
--- a/skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py
+++ b/skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py
@@ -2,4 +2,4 @@
import typing
-DeidentifyImageRequestMaskingMethod = typing.Union[typing.Literal["blackbox", "blur"], typing.Any]
+DeidentifyImageRequestMaskingMethod = typing.Union[typing.Literal["blackout", "blur"], 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
new file mode 100644
index 00000000..429f22ee
--- /dev/null
+++ b/skyflow/generated/rest/files/types/reidentify_file_request_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 .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
new file mode 100644
index 00000000..5aca9bb6
--- /dev/null
+++ b/skyflow/generated/rest/files/types/reidentify_file_request_file_data_format.py
@@ -0,0 +1,7 @@
+# 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/files/types/reidentify_file_request_format.py b/skyflow/generated/rest/files/types/reidentify_file_request_format.py
new file mode 100644
index 00000000..ec7ca5f1
--- /dev/null
+++ b/skyflow/generated/rest/files/types/reidentify_file_request_format.py
@@ -0,0 +1,37 @@
+# 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 ReidentifyFileRequestFormat(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)
+ """
+ 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/deprecated/__init__.py b/skyflow/generated/rest/guardrails/__init__.py
similarity index 100%
rename from skyflow/generated/rest/deprecated/__init__.py
rename to skyflow/generated/rest/guardrails/__init__.py
diff --git a/skyflow/generated/rest/guardrails/client.py b/skyflow/generated/rest/guardrails/client.py
new file mode 100644
index 00000000..169f7de1
--- /dev/null
+++ b/skyflow/generated/rest/guardrails/client.py
@@ -0,0 +1,164 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+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 .raw_client import AsyncRawGuardrailsClient, RawGuardrailsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class GuardrailsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawGuardrailsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawGuardrailsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawGuardrailsClient
+ """
+ return self._raw_client
+
+ def check_guardrails(
+ self,
+ *,
+ vault_id: VaultId,
+ text: str,
+ check_toxicity: typing.Optional[bool] = OMIT,
+ deny_topics: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CheckGuardrailsResponse:
+ """
+ Preserve safety and compliance with usage policies.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ text : str
+ Text to check against guardrails.
+
+ check_toxicity : typing.Optional[bool]
+ Check for toxicity in the text.
+
+ deny_topics : typing.Optional[typing.Sequence[str]]
+ List of topics to deny.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CheckGuardrailsResponse
+ A successful response.
+
+ Examples
+ --------
+ from skyflow import Skyflow
+
+ client = Skyflow(
+ token="YOUR_TOKEN",
+ )
+ client.guardrails.check_guardrails(
+ vault_id="VAULT_ID",
+ text="I love to play cricket.",
+ check_toxicity=True,
+ deny_topics=["sports"],
+ )
+ """
+ _response = self._raw_client.check_guardrails(
+ vault_id=vault_id,
+ text=text,
+ check_toxicity=check_toxicity,
+ deny_topics=deny_topics,
+ request_options=request_options,
+ )
+ return _response.data
+
+
+class AsyncGuardrailsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawGuardrailsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawGuardrailsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawGuardrailsClient
+ """
+ return self._raw_client
+
+ async def check_guardrails(
+ self,
+ *,
+ vault_id: VaultId,
+ text: str,
+ check_toxicity: typing.Optional[bool] = OMIT,
+ deny_topics: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CheckGuardrailsResponse:
+ """
+ Preserve safety and compliance with usage policies.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ text : str
+ Text to check against guardrails.
+
+ check_toxicity : typing.Optional[bool]
+ Check for toxicity in the text.
+
+ deny_topics : typing.Optional[typing.Sequence[str]]
+ List of topics to deny.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CheckGuardrailsResponse
+ A successful response.
+
+ Examples
+ --------
+ import asyncio
+
+ from skyflow import AsyncSkyflow
+
+ client = AsyncSkyflow(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.guardrails.check_guardrails(
+ vault_id="VAULT_ID",
+ text="I love to play cricket.",
+ check_toxicity=True,
+ deny_topics=["sports"],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.check_guardrails(
+ vault_id=vault_id,
+ text=text,
+ check_toxicity=check_toxicity,
+ deny_topics=deny_topics,
+ request_options=request_options,
+ )
+ return _response.data
diff --git a/skyflow/generated/rest/guardrails/raw_client.py b/skyflow/generated/rest/guardrails/raw_client.py
new file mode 100644
index 00000000..11030fd3
--- /dev/null
+++ b/skyflow/generated/rest/guardrails/raw_client.py
@@ -0,0 +1,221 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.pydantic_utilities import parse_obj_as
+from ..core.request_options import RequestOptions
+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.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, ...)
+
+
+class RawGuardrailsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def check_guardrails(
+ self,
+ *,
+ vault_id: VaultId,
+ text: str,
+ check_toxicity: typing.Optional[bool] = OMIT,
+ deny_topics: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CheckGuardrailsResponse]:
+ """
+ Preserve safety and compliance with usage policies.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ text : str
+ Text to check against guardrails.
+
+ check_toxicity : typing.Optional[bool]
+ Check for toxicity in the text.
+
+ deny_topics : typing.Optional[typing.Sequence[str]]
+ List of topics to deny.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CheckGuardrailsResponse]
+ A successful response.
+ """
+ _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,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CheckGuardrailsResponse,
+ parse_obj_as(
+ type_=CheckGuardrailsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ 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 == 401:
+ raise UnauthorizedError(
+ 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),
+ body=typing.cast(
+ ErrorResponse,
+ parse_obj_as(
+ type_=ErrorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ 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)
+
+
+class AsyncRawGuardrailsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def check_guardrails(
+ self,
+ *,
+ vault_id: VaultId,
+ text: str,
+ check_toxicity: typing.Optional[bool] = OMIT,
+ deny_topics: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CheckGuardrailsResponse]:
+ """
+ Preserve safety and compliance with usage policies.
+
+ Parameters
+ ----------
+ vault_id : VaultId
+
+ text : str
+ Text to check against guardrails.
+
+ check_toxicity : typing.Optional[bool]
+ Check for toxicity in the text.
+
+ deny_topics : typing.Optional[typing.Sequence[str]]
+ List of topics to deny.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CheckGuardrailsResponse]
+ A successful response.
+ """
+ _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,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CheckGuardrailsResponse,
+ parse_obj_as(
+ type_=CheckGuardrailsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ 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 == 401:
+ raise UnauthorizedError(
+ 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),
+ body=typing.cast(
+ ErrorResponse,
+ parse_obj_as(
+ type_=ErrorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ 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)
diff --git a/skyflow/generated/rest/strings/client.py b/skyflow/generated/rest/strings/client.py
index 5c71662d..14b2266d 100644
--- a/skyflow/generated/rest/strings/client.py
+++ b/skyflow/generated/rest/strings/client.py
@@ -5,6 +5,7 @@
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
@@ -39,6 +40,7 @@ def deidentify_string(
*,
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,
@@ -56,6 +58,8 @@ def deidentify_string(
text : str
String to de-identify.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenType]
@@ -89,6 +93,7 @@ def deidentify_string(
_response = self._raw_client.deidentify_string(
vault_id=vault_id,
text=text,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
@@ -166,6 +171,7 @@ async def deidentify_string(
*,
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,
@@ -183,6 +189,8 @@ async def deidentify_string(
text : str
String to de-identify.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenType]
@@ -224,6 +232,7 @@ async def main() -> None:
_response = await self._raw_client.deidentify_string(
vault_id=vault_id,
text=text,
+ configuration_id=configuration_id,
entity_types=entity_types,
token_type=token_type,
allow_regex=allow_regex,
diff --git a/skyflow/generated/rest/strings/raw_client.py b/skyflow/generated/rest/strings/raw_client.py
index ad67433a..3ae9bf41 100644
--- a/skyflow/generated/rest/strings/raw_client.py
+++ b/skyflow/generated/rest/strings/raw_client.py
@@ -13,6 +13,7 @@
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
@@ -36,6 +37,7 @@ def deidentify_string(
*,
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,
@@ -53,6 +55,8 @@ def deidentify_string(
text : str
String to de-identify.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenType]
@@ -77,6 +81,7 @@ def deidentify_string(
json={
"vault_id": vault_id,
"text": text,
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenType, direction="write"
@@ -245,6 +250,7 @@ async def deidentify_string(
*,
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,
@@ -262,6 +268,8 @@ async def deidentify_string(
text : str
String to de-identify.
+ configuration_id : typing.Optional[ConfigurationId]
+
entity_types : typing.Optional[EntityTypes]
token_type : typing.Optional[TokenType]
@@ -286,6 +294,7 @@ async def deidentify_string(
json={
"vault_id": vault_id,
"text": text,
+ "configuration_id": configuration_id,
"entity_types": entity_types,
"token_type": convert_and_respect_annotation_metadata(
object_=token_type, annotation=TokenType, direction="write"
diff --git a/skyflow/generated/rest/types/__init__.py b/skyflow/generated/rest/types/__init__.py
index 74b8a5d1..5a48e4f4 100644
--- a/skyflow/generated/rest/types/__init__.py
+++ b/skyflow/generated/rest/types/__init__.py
@@ -2,16 +2,15 @@
# isort: skip_file
-from .advanced_options_column_mapping import AdvancedOptionsColumnMapping
-from .advanced_options_entity_column_map import AdvancedOptionsEntityColumnMap
-from .advanced_options_vault_schema import AdvancedOptionsVaultSchema
from .allow_regex import AllowRegex
-from .audio_config_transcription_type import AudioConfigTranscriptionType
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
@@ -20,12 +19,7 @@
from .deidentify_status_response import DeidentifyStatusResponse
from .deidentify_status_response_output_type import DeidentifyStatusResponseOutputType
from .deidentify_status_response_status import DeidentifyStatusResponseStatus
-from .deidentify_status_response_word_character_count import DeidentifyStatusResponseWordCharacterCount
from .deidentify_string_response import DeidentifyStringResponse
-from .detect_data_accuracy import DetectDataAccuracy
-from .detect_data_entities import DetectDataEntities
-from .detect_file_request_data_type import DetectFileRequestDataType
-from .detect_request_deidentify_option import DetectRequestDeidentifyOption
from .detected_entity import DetectedEntity
from .detokenize_record_response_value_type import DetokenizeRecordResponseValueType
from .entity_location import EntityLocation
@@ -35,9 +29,11 @@
from .error_response_error import ErrorResponseError
from .error_string import ErrorString
from .googlerpc_status import GooglerpcStatus
-from .processed_file_output_processed_file_type import ProcessedFileOutputProcessedFileType
from .protobuf_any import ProtobufAny
from .redaction_enum_redaction import RedactionEnumRedaction
+from .reidentify_file_response import ReidentifyFileResponse
+from .reidentify_file_response_output import ReidentifyFileResponseOutput
+from .reidentify_file_response_status import ReidentifyFileResponseStatus
from .reidentify_string_response import ReidentifyStringResponse
from .request_action_type import RequestActionType
from .resource_id import ResourceId
@@ -50,9 +46,6 @@
from .transformations_shift_dates import TransformationsShiftDates
from .transformations_shift_dates_entity_types_item import TransformationsShiftDatesEntityTypesItem
from .uuid_ import Uuid
-from .v_1_advanced_options import V1AdvancedOptions
-from .v_1_audio_config import V1AudioConfig
-from .v_1_audio_options import V1AudioOptions
from .v_1_audit_after_options import V1AuditAfterOptions
from .v_1_audit_event_response import V1AuditEventResponse
from .v_1_audit_response import V1AuditResponse
@@ -67,29 +60,17 @@
from .v_1_card import V1Card
from .v_1_delete_file_response import V1DeleteFileResponse
from .v_1_delete_record_response import V1DeleteRecordResponse
-from .v_1_detect_file_response import V1DetectFileResponse
-from .v_1_detect_status_response import V1DetectStatusResponse
-from .v_1_detect_status_response_status import V1DetectStatusResponseStatus
-from .v_1_detect_text_request import V1DetectTextRequest
-from .v_1_detect_text_response import V1DetectTextResponse
from .v_1_detokenize_record_request import V1DetokenizeRecordRequest
from .v_1_detokenize_record_response import V1DetokenizeRecordResponse
from .v_1_detokenize_response import V1DetokenizeResponse
from .v_1_field_records import V1FieldRecords
from .v_1_file_av_scan_status import V1FileAvScanStatus
-from .v_1_file_data_format import V1FileDataFormat
from .v_1_get_auth_token_response import V1GetAuthTokenResponse
from .v_1_get_file_scan_status_response import V1GetFileScanStatusResponse
from .v_1_get_query_response import V1GetQueryResponse
-from .v_1_image_options import V1ImageOptions
from .v_1_insert_record_response import V1InsertRecordResponse
-from .v_1_locations import V1Locations
from .v_1_member_type import V1MemberType
-from .v_1_pdf_config import V1PdfConfig
-from .v_1_pdf_options import V1PdfOptions
-from .v_1_processed_file_output import V1ProcessedFileOutput
from .v_1_record_meta_properties import V1RecordMetaProperties
-from .v_1_response_entities import V1ResponseEntities
from .v_1_tokenize_record_request import V1TokenizeRecordRequest
from .v_1_tokenize_record_response import V1TokenizeRecordResponse
from .v_1_tokenize_response import V1TokenizeResponse
@@ -99,16 +80,15 @@
from .vault_id import VaultId
__all__ = [
- "AdvancedOptionsColumnMapping",
- "AdvancedOptionsEntityColumnMap",
- "AdvancedOptionsVaultSchema",
"AllowRegex",
- "AudioConfigTranscriptionType",
"AuditEventAuditResourceType",
"AuditEventContext",
"AuditEventData",
"AuditEventHttpInfo",
"BatchRecordMethod",
+ "CheckGuardrailsResponse",
+ "CheckGuardrailsResponseValidation",
+ "ConfigurationId",
"ContextAccessType",
"ContextAuthMode",
"DeidentifyFileOutput",
@@ -117,12 +97,7 @@
"DeidentifyStatusResponse",
"DeidentifyStatusResponseOutputType",
"DeidentifyStatusResponseStatus",
- "DeidentifyStatusResponseWordCharacterCount",
"DeidentifyStringResponse",
- "DetectDataAccuracy",
- "DetectDataEntities",
- "DetectFileRequestDataType",
- "DetectRequestDeidentifyOption",
"DetectedEntity",
"DetokenizeRecordResponseValueType",
"EntityLocation",
@@ -132,9 +107,11 @@
"ErrorResponseError",
"ErrorString",
"GooglerpcStatus",
- "ProcessedFileOutputProcessedFileType",
"ProtobufAny",
"RedactionEnumRedaction",
+ "ReidentifyFileResponse",
+ "ReidentifyFileResponseOutput",
+ "ReidentifyFileResponseStatus",
"ReidentifyStringResponse",
"RequestActionType",
"ResourceId",
@@ -147,9 +124,6 @@
"TransformationsShiftDates",
"TransformationsShiftDatesEntityTypesItem",
"Uuid",
- "V1AdvancedOptions",
- "V1AudioConfig",
- "V1AudioOptions",
"V1AuditAfterOptions",
"V1AuditEventResponse",
"V1AuditResponse",
@@ -164,29 +138,17 @@
"V1Card",
"V1DeleteFileResponse",
"V1DeleteRecordResponse",
- "V1DetectFileResponse",
- "V1DetectStatusResponse",
- "V1DetectStatusResponseStatus",
- "V1DetectTextRequest",
- "V1DetectTextResponse",
"V1DetokenizeRecordRequest",
"V1DetokenizeRecordResponse",
"V1DetokenizeResponse",
"V1FieldRecords",
"V1FileAvScanStatus",
- "V1FileDataFormat",
"V1GetAuthTokenResponse",
"V1GetFileScanStatusResponse",
"V1GetQueryResponse",
- "V1ImageOptions",
"V1InsertRecordResponse",
- "V1Locations",
"V1MemberType",
- "V1PdfConfig",
- "V1PdfOptions",
- "V1ProcessedFileOutput",
"V1RecordMetaProperties",
- "V1ResponseEntities",
"V1TokenizeRecordRequest",
"V1TokenizeRecordResponse",
"V1TokenizeResponse",
diff --git a/skyflow/generated/rest/types/advanced_options_column_mapping.py b/skyflow/generated/rest/types/advanced_options_column_mapping.py
deleted file mode 100644
index 8369b329..00000000
--- a/skyflow/generated/rest/types/advanced_options_column_mapping.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 .advanced_options_entity_column_map import AdvancedOptionsEntityColumnMap
-
-
-class AdvancedOptionsColumnMapping(UniversalBaseModel):
- """
- Contains map of what has to be stored in which column.
- """
-
- session_id: str = pydantic.Field()
- """
- Table name of the vault.
- """
-
- default: str = pydantic.Field()
- """
- Name of column to store data in when no explicit mapping exists.
- """
-
- entity_column_map: typing.Optional[typing.List[AdvancedOptionsEntityColumnMap]] = pydantic.Field(default=None)
- """
- Column mapping for different 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/advanced_options_entity_column_map.py b/skyflow/generated/rest/types/advanced_options_entity_column_map.py
deleted file mode 100644
index debf836a..00000000
--- a/skyflow/generated/rest/types/advanced_options_entity_column_map.py
+++ /dev/null
@@ -1,28 +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 .detect_data_entities import DetectDataEntities
-
-
-class AdvancedOptionsEntityColumnMap(UniversalBaseModel):
- """
- Contains map of what entity has to be stored in which column.
- """
-
- entity_type: typing.Optional[DetectDataEntities] = None
- column_name: typing.Optional[str] = pydantic.Field(default=None)
- """
- Column name where the entity has to be stored.
- """
-
- 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/advanced_options_vault_schema.py b/skyflow/generated/rest/types/advanced_options_vault_schema.py
deleted file mode 100644
index 8496eb97..00000000
--- a/skyflow/generated/rest/types/advanced_options_vault_schema.py
+++ /dev/null
@@ -1,29 +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 .advanced_options_column_mapping import AdvancedOptionsColumnMapping
-
-
-class AdvancedOptionsVaultSchema(UniversalBaseModel):
- """
- Contains table name and column mapping.
- """
-
- table_name: str = pydantic.Field()
- """
- Table name of the vault.
- """
-
- mapping: AdvancedOptionsColumnMapping
-
- 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/audio_config_transcription_type.py b/skyflow/generated/rest/types/audio_config_transcription_type.py
deleted file mode 100644
index 13ad88d9..00000000
--- a/skyflow/generated/rest/types/audio_config_transcription_type.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-AudioConfigTranscriptionType = typing.Union[
- typing.Literal[
- "none",
- "skyflow_transcription",
- "aws_transcription",
- "aws_transcription_diarize",
- "aws_medical_transcription",
- "aws_medical_transcription_diarize",
- "aws_transcription_diarize_json",
- "deepgram_transcription_diarize",
- "deepgram_transcription_json",
- "deepgram_wrapper",
- ],
- typing.Any,
-]
diff --git a/skyflow/generated/rest/types/check_guardrails_response.py b/skyflow/generated/rest/types/check_guardrails_response.py
new file mode 100644
index 00000000..ad8e2dbf
--- /dev/null
+++ b/skyflow/generated/rest/types/check_guardrails_response.py
@@ -0,0 +1,42 @@
+# 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 .check_guardrails_response_validation import CheckGuardrailsResponseValidation
+
+
+class CheckGuardrailsResponse(UniversalBaseModel):
+ """
+ Response to check guardrails.
+ """
+
+ text: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Text that was checked against guardrails.
+ """
+
+ toxicity: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the text is toxic.
+ """
+
+ denied_topics: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether any denied topics were found.
+ """
+
+ validation: typing.Optional[CheckGuardrailsResponseValidation] = pydantic.Field(default=None)
+ """
+ Validation result.
+ """
+
+ 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/check_guardrails_response_validation.py b/skyflow/generated/rest/types/check_guardrails_response_validation.py
new file mode 100644
index 00000000..dcb0b789
--- /dev/null
+++ b/skyflow/generated/rest/types/check_guardrails_response_validation.py
@@ -0,0 +1,5 @@
+# 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
new file mode 100644
index 00000000..763ae161
--- /dev/null
+++ b/skyflow/generated/rest/types/configuration_id.py
@@ -0,0 +1,3 @@
+# This file was auto-generated by Fern from our API Definition.
+
+ConfigurationId = str
diff --git a/skyflow/generated/rest/types/deidentify_file_output.py b/skyflow/generated/rest/types/deidentify_file_output.py
index a4c2da4d..7e17e168 100644
--- a/skyflow/generated/rest/types/deidentify_file_output.py
+++ b/skyflow/generated/rest/types/deidentify_file_output.py
@@ -3,9 +3,7 @@
import typing
import pydantic
-import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from ..core.serialization import FieldMetadata
from .deidentify_file_output_processed_file_type import DeidentifyFileOutputProcessedFileType
@@ -14,23 +12,17 @@ class DeidentifyFileOutput(UniversalBaseModel):
Details and contents of the processed file.
"""
- processed_file: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="processedFile")] = (
- pydantic.Field(default=None)
- )
+ processed_file: typing.Optional[str] = pydantic.Field(default=None)
"""
URL or base64-encoded data of the output.
"""
- processed_file_type: typing_extensions.Annotated[
- typing.Optional[DeidentifyFileOutputProcessedFileType], FieldMetadata(alias="processedFileType")
- ] = pydantic.Field(default=None)
+ processed_file_type: typing.Optional[DeidentifyFileOutputProcessedFileType] = pydantic.Field(default=None)
"""
Type of the processed file.
"""
- processed_file_extension: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="processedFileExtension")
- ] = pydantic.Field(default=None)
+ processed_file_extension: typing.Optional[str] = pydantic.Field(default=None)
"""
Extension of the processed file.
"""
diff --git a/skyflow/generated/rest/types/deidentify_status_response.py b/skyflow/generated/rest/types/deidentify_status_response.py
index 0ad91e62..a276963c 100644
--- a/skyflow/generated/rest/types/deidentify_status_response.py
+++ b/skyflow/generated/rest/types/deidentify_status_response.py
@@ -3,13 +3,10 @@
import typing
import pydantic
-import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from ..core.serialization import FieldMetadata
from .deidentify_file_output import DeidentifyFileOutput
from .deidentify_status_response_output_type import DeidentifyStatusResponseOutputType
from .deidentify_status_response_status import DeidentifyStatusResponseStatus
-from .deidentify_status_response_word_character_count import DeidentifyStatusResponseWordCharacterCount
class DeidentifyStatusResponse(UniversalBaseModel):
@@ -27,9 +24,7 @@ class DeidentifyStatusResponse(UniversalBaseModel):
How the input file was specified.
"""
- output_type: typing_extensions.Annotated[
- typing.Optional[DeidentifyStatusResponseOutputType], FieldMetadata(alias="outputType")
- ] = pydantic.Field(default=None)
+ output_type: typing.Optional[DeidentifyStatusResponseOutputType] = pydantic.Field(default=None)
"""
How the output file is specified.
"""
@@ -39,11 +34,14 @@ class DeidentifyStatusResponse(UniversalBaseModel):
Status details about the detect run.
"""
- word_character_count: typing_extensions.Annotated[
- typing.Optional[DeidentifyStatusResponseWordCharacterCount], FieldMetadata(alias="wordCharacterCount")
- ] = pydantic.Field(default=None)
+ word_count: typing.Optional[int] = pydantic.Field(default=None)
"""
- Word and character count in the processed text.
+ 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)
@@ -51,7 +49,7 @@ class DeidentifyStatusResponse(UniversalBaseModel):
Size of the processed text in kilobytes (KB).
"""
- duration: typing.Optional[float] = pydantic.Field(default=None)
+ duration: typing.Optional[int] = pydantic.Field(default=None)
"""
Duration of the processed audio in seconds.
"""
diff --git a/skyflow/generated/rest/types/deidentify_status_response_word_character_count.py b/skyflow/generated/rest/types/deidentify_status_response_word_character_count.py
deleted file mode 100644
index 6584ca92..00000000
--- a/skyflow/generated/rest/types/deidentify_status_response_word_character_count.py
+++ /dev/null
@@ -1,26 +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
-
-
-class DeidentifyStatusResponseWordCharacterCount(UniversalBaseModel):
- """
- Word and character count in the processed text.
- """
-
- word_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="wordCount")] = None
- character_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="characterCount")] = None
-
- 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_data_accuracy.py b/skyflow/generated/rest/types/detect_data_accuracy.py
deleted file mode 100644
index 91e3619e..00000000
--- a/skyflow/generated/rest/types/detect_data_accuracy.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-DetectDataAccuracy = typing.Union[
- typing.Literal[
- "unknown",
- "standard",
- "standard_plus",
- "standard_plus_multilingual",
- "standard_plus_automatic",
- "high",
- "high_multilingual",
- "high_automatic",
- ],
- typing.Any,
-]
diff --git a/skyflow/generated/rest/types/detect_data_entities.py b/skyflow/generated/rest/types/detect_data_entities.py
deleted file mode 100644
index 4ac0bd49..00000000
--- a/skyflow/generated/rest/types/detect_data_entities.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-DetectDataEntities = 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_sexuality",
- "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",
- ],
- typing.Any,
-]
diff --git a/skyflow/generated/rest/types/detect_file_request_data_type.py b/skyflow/generated/rest/types/detect_file_request_data_type.py
deleted file mode 100644
index 825d4778..00000000
--- a/skyflow/generated/rest/types/detect_file_request_data_type.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-DetectFileRequestDataType = typing.Union[typing.Literal["UNKNOWN", "BASE64"], typing.Any]
diff --git a/skyflow/generated/rest/types/detect_request_deidentify_option.py b/skyflow/generated/rest/types/detect_request_deidentify_option.py
deleted file mode 100644
index caee5f16..00000000
--- a/skyflow/generated/rest/types/detect_request_deidentify_option.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-DetectRequestDeidentifyOption = typing.Union[typing.Literal["UNKNOWN", "ENTITY_UNQ_COUNTER", "ENTITY_ONLY"], typing.Any]
diff --git a/skyflow/generated/rest/types/entity_type.py b/skyflow/generated/rest/types/entity_type.py
index 6b48f1d8..20195417 100644
--- a/skyflow/generated/rest/types/entity_type.py
+++ b/skyflow/generated/rest/types/entity_type.py
@@ -15,17 +15,19 @@
"credit_card_expiration",
"cvv",
"date",
+ "day",
"date_interval",
"dob",
"dose",
"driver_license",
"drug",
"duration",
+ "effect",
"email_address",
"event",
"filename",
"financial_metric",
- "gender_sexuality",
+ "gender",
"healthcare_number",
"injury",
"ip_address",
@@ -42,6 +44,7 @@
"medical_code",
"medical_process",
"money",
+ "month",
"name",
"name_family",
"name_given",
@@ -49,16 +52,19 @@
"numerical_pii",
"occupation",
"organization",
+ "organization_id",
"organization_medical_facility",
"origin",
"passport_number",
"password",
"phone_number",
+ "project",
"physical_attribute",
"political_affiliation",
"product",
"religion",
"routing_number",
+ "sexuality",
"ssn",
"statistics",
"time",
@@ -66,6 +72,7 @@
"url",
"username",
"vehicle_id",
+ "year",
"zodiac_sign",
],
typing.Any,
diff --git a/skyflow/generated/rest/types/processed_file_output_processed_file_type.py b/skyflow/generated/rest/types/processed_file_output_processed_file_type.py
deleted file mode 100644
index 18758eaa..00000000
--- a/skyflow/generated/rest/types/processed_file_output_processed_file_type.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-ProcessedFileOutputProcessedFileType = typing.Union[
- typing.Literal[
- "none",
- "redacted_audio",
- "redacted_image",
- "redacted_transcription",
- "redacted_file",
- "redacted_text",
- "entities",
- "redacted_aws_transcription_diarize_json",
- "redacted_deepgram_transcription_diarize_json",
- "plaintext_transcribed",
- ],
- typing.Any,
-]
diff --git a/skyflow/generated/rest/types/v_1_pdf_options.py b/skyflow/generated/rest/types/reidentify_file_response.py
similarity index 51%
rename from skyflow/generated/rest/types/v_1_pdf_options.py
rename to skyflow/generated/rest/types/reidentify_file_response.py
index 28fdf1bc..c67b41ac 100644
--- a/skyflow/generated/rest/types/v_1_pdf_options.py
+++ b/skyflow/generated/rest/types/reidentify_file_response.py
@@ -4,23 +4,27 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
+from .reidentify_file_response_output import ReidentifyFileResponseOutput
+from .reidentify_file_response_status import ReidentifyFileResponseStatus
-class V1PdfOptions(UniversalBaseModel):
+class ReidentifyFileResponse(UniversalBaseModel):
"""
- How to handle PDF files.
+ Response to re-identify a file.
"""
- density: typing.Optional[int] = pydantic.Field(default=None)
+ status: ReidentifyFileResponseStatus = pydantic.Field()
"""
- Pixel density at which to process the PDF file.
+ Status of the re-identify operation.
"""
- max_resolution: typing.Optional[int] = pydantic.Field(default=None)
+ output_type: typing.Literal["BASE64"] = pydantic.Field(default="BASE64")
"""
- Max resolution at which to process the PDF file.
+ Format of the output file.
"""
+ output: ReidentifyFileResponseOutput
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/skyflow/generated/rest/types/v_1_image_options.py b/skyflow/generated/rest/types/reidentify_file_response_output.py
similarity index 57%
rename from skyflow/generated/rest/types/v_1_image_options.py
rename to skyflow/generated/rest/types/reidentify_file_response_output.py
index 7f4143df..bda44777 100644
--- a/skyflow/generated/rest/types/v_1_image_options.py
+++ b/skyflow/generated/rest/types/reidentify_file_response_output.py
@@ -6,19 +6,20 @@
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-class V1ImageOptions(UniversalBaseModel):
+class ReidentifyFileResponseOutput(UniversalBaseModel):
+ processed_file: str = pydantic.Field()
"""
- How to handle image files.
+ Re-identified file content in base64 format.
"""
- output_processed_image: typing.Optional[bool] = pydantic.Field(default=None)
+ processed_file_type: typing.Literal["reidentified_file"] = pydantic.Field(default="reidentified_file")
"""
- If `true`, includes processed image in the output.
+ Type of the processed file.
"""
- output_ocr_text: typing.Optional[bool] = pydantic.Field(default=None)
+ processed_file_extension: str = pydantic.Field()
"""
- If `true`, includes OCR text output in the response.
+ Extension of the processed file.
"""
if IS_PYDANTIC_V2:
diff --git a/skyflow/generated/rest/types/reidentify_file_response_status.py b/skyflow/generated/rest/types/reidentify_file_response_status.py
new file mode 100644
index 00000000..c640c3a6
--- /dev/null
+++ b/skyflow/generated/rest/types/reidentify_file_response_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ReidentifyFileResponseStatus = typing.Union[typing.Literal["failed", "in_progress", "success"], typing.Any]
diff --git a/skyflow/generated/rest/types/v_1_advanced_options.py b/skyflow/generated/rest/types/v_1_advanced_options.py
deleted file mode 100644
index ea893551..00000000
--- a/skyflow/generated/rest/types/v_1_advanced_options.py
+++ /dev/null
@@ -1,38 +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 .advanced_options_vault_schema import AdvancedOptionsVaultSchema
-
-
-class V1AdvancedOptions(UniversalBaseModel):
- """
- Advanced options for post processing.
- """
-
- date_shift: typing.Optional[int] = pydantic.Field(default=None)
- """
- No. of days by which original date has to be shifted to.
- """
-
- custom_client: typing.Optional[bool] = pydantic.Field(default=None)
- """
- Custom client specific logic.
- """
-
- schema_: typing_extensions.Annotated[typing.Optional[AdvancedOptionsVaultSchema], FieldMetadata(alias="schema")] = (
- None
- )
-
- 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/v_1_audio_config.py b/skyflow/generated/rest/types/v_1_audio_config.py
deleted file mode 100644
index dc866e47..00000000
--- a/skyflow/generated/rest/types/v_1_audio_config.py
+++ /dev/null
@@ -1,31 +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 .audio_config_transcription_type import AudioConfigTranscriptionType
-from .v_1_audio_options import V1AudioOptions
-
-
-class V1AudioConfig(UniversalBaseModel):
- """
- How to handle audio files.
- """
-
- output_transcription: typing.Optional[AudioConfigTranscriptionType] = None
- output_processed_audio: typing.Optional[bool] = pydantic.Field(default=None)
- """
- If `true`, includes processed audio file in the response.
- """
-
- options: typing.Optional[V1AudioOptions] = None
-
- 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/v_1_audio_options.py b/skyflow/generated/rest/types/v_1_audio_options.py
deleted file mode 100644
index 6e5b3df9..00000000
--- a/skyflow/generated/rest/types/v_1_audio_options.py
+++ /dev/null
@@ -1,46 +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 V1AudioOptions(UniversalBaseModel):
- """
- Options for audio files.
- """
-
- bleep_start_padding: typing.Optional[float] = pydantic.Field(default=None)
- """
- Padding added to the beginning of a bleep, in seconds.
- """
-
- bleep_end_padding: typing.Optional[float] = pydantic.Field(default=None)
- """
- Padding added to the end of a bleep, in seconds.
- """
-
- distortion_steps: typing.Optional[int] = pydantic.Field(default=None)
- """
- Specifies how the distortion will be made. Providing a number more than 0 will result in a higher tone and a coefficient less than 0 will result in a lower tone.
- """
-
- bleep_frequency: typing.Optional[int] = pydantic.Field(default=None)
- """
- This parameter configures the frequency of the sine wave used for the bleep sound in an audio segment.
- """
-
- bleep_gain: typing.Optional[int] = pydantic.Field(default=None)
- """
- It controls the relative loudness of the bleep,positive values increase its loudness, and negative values decrease it.
- """
-
- 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/v_1_detect_file_response.py b/skyflow/generated/rest/types/v_1_detect_file_response.py
deleted file mode 100644
index f933703e..00000000
--- a/skyflow/generated/rest/types/v_1_detect_file_response.py
+++ /dev/null
@@ -1,26 +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 V1DetectFileResponse(UniversalBaseModel):
- """
- Response to deidentify a file.
- """
-
- status_url: typing.Optional[str] = pydantic.Field(default=None)
- """
- Status URL for the deidentification request.
- """
-
- 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/v_1_detect_status_response.py b/skyflow/generated/rest/types/v_1_detect_status_response.py
deleted file mode 100644
index ac859394..00000000
--- a/skyflow/generated/rest/types/v_1_detect_status_response.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 .v_1_detect_status_response_status import V1DetectStatusResponseStatus
-from .v_1_processed_file_output import V1ProcessedFileOutput
-
-
-class V1DetectStatusResponse(UniversalBaseModel):
- """
- Response to get the status of a file deidentification request.
- """
-
- status: typing.Optional[V1DetectStatusResponseStatus] = None
- output: typing.Optional[typing.List[V1ProcessedFileOutput]] = pydantic.Field(default=None)
- """
- How the input file was specified.
- """
-
- message: typing.Optional[str] = pydantic.Field(default=None)
- """
- Status details about the deidentification request.
- """
-
- 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/v_1_detect_status_response_status.py b/skyflow/generated/rest/types/v_1_detect_status_response_status.py
deleted file mode 100644
index 1b9531cb..00000000
--- a/skyflow/generated/rest/types/v_1_detect_status_response_status.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-V1DetectStatusResponseStatus = typing.Union[typing.Literal["UNKNOWN", "FAILED", "SUCCESS", "IN_PROGRESS"], typing.Any]
diff --git a/skyflow/generated/rest/types/v_1_detect_text_request.py b/skyflow/generated/rest/types/v_1_detect_text_request.py
deleted file mode 100644
index f832ef7b..00000000
--- a/skyflow/generated/rest/types/v_1_detect_text_request.py
+++ /dev/null
@@ -1,68 +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 .detect_data_accuracy import DetectDataAccuracy
-from .detect_data_entities import DetectDataEntities
-from .detect_request_deidentify_option import DetectRequestDeidentifyOption
-from .v_1_advanced_options import V1AdvancedOptions
-
-
-class V1DetectTextRequest(UniversalBaseModel):
- """
- Request to deidentify a string.
- """
-
- text: str = pydantic.Field()
- """
- Data to deidentify.
- """
-
- vault_id: str = pydantic.Field()
- """
- ID of the vault.
- """
-
- session_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- Will give a handle to delete the tokens generated during a specific interaction.
- """
-
- restrict_entity_types: typing.Optional[typing.List[DetectDataEntities]] = pydantic.Field(default=None)
- """
- Entities to detect and deidentify.
- """
-
- deidentify_token_format: typing.Optional[DetectRequestDeidentifyOption] = None
- allow_regex: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
- """
- Regular expressions to ignore when detecting entities.
- """
-
- restrict_regex: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
- """
- Regular expressions to always restrict. Strings matching these regular expressions are replaced with 'RESTRICTED'.
- """
-
- return_entities: typing.Optional[bool] = pydantic.Field(default=None)
- """
- If `true`, returns the details for the detected entities.
- """
-
- accuracy: typing.Optional[DetectDataAccuracy] = None
- advanced_options: typing.Optional[V1AdvancedOptions] = None
- store_entities: typing.Optional[bool] = pydantic.Field(default=None)
- """
- Indicates whether entities should be stored in the vault.
- """
-
- 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/v_1_detect_text_response.py b/skyflow/generated/rest/types/v_1_detect_text_response.py
deleted file mode 100644
index 954e7d07..00000000
--- a/skyflow/generated/rest/types/v_1_detect_text_response.py
+++ /dev/null
@@ -1,32 +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 .v_1_response_entities import V1ResponseEntities
-
-
-class V1DetectTextResponse(UniversalBaseModel):
- """
- Response to deidentify a string.
- """
-
- processed_text: typing.Optional[str] = pydantic.Field(default=None)
- """
- Deidentified text. If the input was a file, text that was extracted or transcribed from the file and deidentified.
- """
-
- entities: typing.Optional[typing.List[V1ResponseEntities]] = pydantic.Field(default=None)
- """
- 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/v_1_file_data_format.py b/skyflow/generated/rest/types/v_1_file_data_format.py
deleted file mode 100644
index f717c793..00000000
--- a/skyflow/generated/rest/types/v_1_file_data_format.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-V1FileDataFormat = typing.Union[
- typing.Literal[
- "bmp",
- "csv",
- "doc",
- "docx",
- "jpeg",
- "jpg",
- "json",
- "mp3",
- "pdf",
- "png",
- "ppt",
- "pptx",
- "tif",
- "tiff",
- "txt",
- "unknown",
- "wav",
- "xls",
- "xlsx",
- ],
- typing.Any,
-]
diff --git a/skyflow/generated/rest/types/v_1_locations.py b/skyflow/generated/rest/types/v_1_locations.py
deleted file mode 100644
index 098d6b6e..00000000
--- a/skyflow/generated/rest/types/v_1_locations.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 V1Locations(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/v_1_pdf_config.py b/skyflow/generated/rest/types/v_1_pdf_config.py
deleted file mode 100644
index eff6107e..00000000
--- a/skyflow/generated/rest/types/v_1_pdf_config.py
+++ /dev/null
@@ -1,24 +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 .v_1_pdf_options import V1PdfOptions
-
-
-class V1PdfConfig(UniversalBaseModel):
- """
- How to handle PDF files.
- """
-
- options: typing.Optional[V1PdfOptions] = None
-
- 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/v_1_processed_file_output.py b/skyflow/generated/rest/types/v_1_processed_file_output.py
deleted file mode 100644
index 80968814..00000000
--- a/skyflow/generated/rest/types/v_1_processed_file_output.py
+++ /dev/null
@@ -1,31 +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 .detect_file_request_data_type import DetectFileRequestDataType
-from .processed_file_output_processed_file_type import ProcessedFileOutputProcessedFileType
-
-
-class V1ProcessedFileOutput(UniversalBaseModel):
- """
- Contains details and contents of the processed file.
- """
-
- output_type: typing.Optional[DetectFileRequestDataType] = None
- processed_file: typing.Optional[str] = pydantic.Field(default=None)
- """
- URL or base64-encoded data of the output.
- """
-
- processed_file_type: typing.Optional[ProcessedFileOutputProcessedFileType] = None
-
- 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/v_1_response_entities.py b/skyflow/generated/rest/types/v_1_response_entities.py
deleted file mode 100644
index fbc0ecf4..00000000
--- a/skyflow/generated/rest/types/v_1_response_entities.py
+++ /dev/null
@@ -1,43 +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 .v_1_locations import V1Locations
-
-
-class V1ResponseEntities(UniversalBaseModel):
- """
- Detected entities.
- """
-
- processed_text: typing.Optional[str] = pydantic.Field(default=None)
- """
- Processed text of the entity.
- """
-
- original_text: typing.Optional[str] = pydantic.Field(default=None)
- """
- Original text of the entity.
- """
-
- location: typing.Optional[V1Locations] = None
- best_label: typing.Optional[str] = pydantic.Field(default=None)
- """
- Highest rated label.
- """
-
- labels: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
- """
- Labels and their scores.
- """
-
- 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/utils/_version.py b/skyflow/utils/_version.py
index 343924ba..2e213012 100644
--- a/skyflow/utils/_version.py
+++ b/skyflow/utils/_version.py
@@ -1 +1 @@
-SDK_VERSION = '2.0.0b7'
\ No newline at end of file
+SDK_VERSION = '2.1.0b1'
\ No newline at end of file
diff --git a/skyflow/utils/enums/detect_entities.py b/skyflow/utils/enums/detect_entities.py
index 23b36bdc..91d5e1a2 100644
--- a/skyflow/utils/enums/detect_entities.py
+++ b/skyflow/utils/enums/detect_entities.py
@@ -12,17 +12,19 @@ class DetectEntities(Enum):
CREDIT_CARD_EXPIRATION = "credit_card_expiration"
CVV = "cvv"
DATE = "date"
+ DAY = "day"
DATE_INTERVAL = "date_interval"
DOB = "dob"
DOSE = "dose"
DRIVER_LICENSE = "driver_license"
DRUG = "drug"
DURATION = "duration"
+ EFFECT = "effect"
EMAIL_ADDRESS = "email_address"
EVENT = "event"
FILENAME = "filename"
FINANCIAL_METRIC = "financial_metric"
- GENDER_SEXUALITY = "gender_sexuality"
+ GENDER = "gender"
HEALTHCARE_NUMBER = "healthcare_number"
INJURY = "injury"
IP_ADDRESS = "ip_address"
@@ -39,6 +41,7 @@ class DetectEntities(Enum):
MEDICAL_CODE = "medical_code"
MEDICAL_PROCESS = "medical_process"
MONEY = "money"
+ MONTH = "month"
NAME = "name"
NAME_FAMILY = "name_family"
NAME_GIVEN = "name_given"
@@ -46,16 +49,19 @@ class DetectEntities(Enum):
NUMERICAL_PII = "numerical_pii"
OCCUPATION = "occupation"
ORGANIZATION = "organization"
+ ORGANIZATION_ID = "organization_id"
ORGANIZATION_MEDICAL_FACILITY = "organization_medical_facility"
ORIGIN = "origin"
PASSPORT_NUMBER = "passport_number"
PASSWORD = "password"
PHONE_NUMBER = "phone_number"
+ PROJECT = "project"
PHYSICAL_ATTRIBUTE = "physical_attribute"
POLITICAL_AFFILIATION = "political_affiliation"
PRODUCT = "product"
RELIGION = "religion"
ROUTING_NUMBER = "routing_number"
+ SEXUALITY = "sexuality"
SSN = "ssn"
STATISTICS = "statistics"
TIME = "time"
@@ -63,4 +69,5 @@ class DetectEntities(Enum):
URL = "url"
USERNAME = "username"
VEHICLE_ID = "vehicle_id"
+ YEAR = "year"
ZODIAC_SIGN = "zodiac_sign"
\ No newline at end of file
diff --git a/skyflow/vault/controller/_detect.py b/skyflow/vault/controller/_detect.py
index 606d58ef..93fac69e 100644
--- a/skyflow/vault/controller/_detect.py
+++ b/skyflow/vault/controller/_detect.py
@@ -1,10 +1,6 @@
import io
import json
import os
-from skyflow.error import SkyflowError
-from skyflow.generated.rest.types.token_type import TokenType
-from skyflow.generated.rest.types.transformations import Transformations
-from skyflow.generated.rest.types.transformations_shift_dates import TransformationsShiftDates
import base64
import time
from skyflow.generated.rest import DeidentifyTextRequestFile, DeidentifyAudioRequestFile, DeidentifyPdfRequestFile, \
@@ -88,19 +84,27 @@ def __poll_for_processed_file(self, run_id, max_wait_time=64):
raise e
def __parse_deidentify_file_response(self, data, run_id=None, status=None):
-
output = getattr(data, "output", [])
- output_type = getattr(data, "output_type", None)
- word_character_count = getattr(data, "word_character_count", None)
+ status_val = getattr(data, "status", None) or status
+ run_id_val = getattr(data, "run_id", None) or run_id
+
+ 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")
+
size = getattr(data, "size", None)
+
+ size = float(size) if size is not None else None
+
duration = getattr(data, "duration", None)
pages = getattr(data, "pages", None)
slides = getattr(data, "slides", None)
- message = getattr(data, "message", None)
- status_val = getattr(data, "status", None) or status
- run_id_val = getattr(data, "run_id", None) or run_id
- # Convert output to list of dicts if it's a list of objects
+ # Convert output to list of dicts, prefer camelCase keys
def output_to_dict_list(output):
result = []
for o in output:
@@ -112,9 +116,11 @@ def output_to_dict_list(output):
})
else:
result.append({
- "file": getattr(o, "processed_file", None),
- "type": getattr(o, "processed_file_type", None),
- "extension": getattr(o, "processed_file_extension", None)
+ "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)
})
return result
@@ -123,13 +129,9 @@ def output_to_dict_list(output):
entities = [o for o in output_list if o.get("type") == "entities"]
- word_count = getattr(word_character_count, "word_count", None)
- char_count = getattr(word_character_count, "character_count", None)
-
base64_string = first_output.get("file", None)
extension = first_output.get("extension", None)
- file_obj = None
if base64_string is not None:
file_bytes = base64.b64decode(base64_string)
file_obj = io.BytesIO(file_bytes)
diff --git a/tests/vault/controller/test__detect.py b/tests/vault/controller/test__detect.py
index 1352f85b..3096ce08 100644
--- a/tests/vault/controller/test__detect.py
+++ b/tests/vault/controller/test__detect.py
@@ -42,8 +42,8 @@ def test_deidentify_text_success(self, mock_parse_response, mock_validate):
'scores': {'confidence': 0.9}
}
],
- 'word_count': 4,
- 'char_count': 20
+ 'wordCount': 4,
+ 'charCount': 20
}
# Create request
@@ -149,7 +149,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.word_character_count = Mock(word_count=1, character_count=1)
+ processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=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",
@@ -212,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.word_character_count = Mock(word_count=1, character_count=1)
+ processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=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",
@@ -257,7 +257,7 @@ def test_get_detect_run_success(self, mock_validate):
response = Mock()
response.status = "SUCCESS"
response.output = []
- response.word_character_count = Mock(word_count=1, character_count=1)
+ response.wordCharacterCount = Mock(wordCount=1, characterCount=1)
files_api.get_run.return_value = response
with patch.object(self.detect, "_Detect__parse_deidentify_file_response",
return_value=DeidentifyFileResponse(file="file", type="txt", extension="txt", word_count=1,
@@ -299,13 +299,14 @@ def test_deidentify_file_all_branches(self, mock_poll, mock_open, mock_basename,
processed_response.output = [
{"processedFile": "dGVzdCBjb250ZW50", "processedFileType": "pdf", "processedFileExtension": "pdf"}
]
- processed_response.word_character_count = Mock(word_count=1, character_count=1)
+ 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}
mock_poll.return_value = processed_response
# Test configuration for different file types
@@ -441,7 +442,7 @@ def test_parse_deidentify_file_response_dict_and_obj(self):
{"processedFile": "YWJj", "processedFileType": "pdf", "processedFileExtension": "pdf"}, # base64 for "abc"
{"processedFile": "ZGVm", "processedFileType": "entities", "processedFileExtension": "json"} # base64 for "def"
],
- "word_character_count": {"word_count": 5, "character_count": 10},
+ "wordCharacterCount": {"wordCount": 5, "characterCount": 10},
"size": 1,
"duration": 2,
"pages": 3,
@@ -454,8 +455,8 @@ def test_parse_deidentify_file_response_dict_and_obj(self):
# Object input
class DummyWordChar:
- word_count = 7
- character_count = 14
+ wordCount = 7
+ characterCount = 14
class DummyData:
output = [
@@ -605,7 +606,8 @@ class OutputObj:
data = Mock()
data.output = [OutputObj()]
- data.word_character_count = Mock(word_count=1, character_count=1)
+ data.size = 1
+ data.wordCharacterCount = Mock(wordCount=1, characterCount=1)
result = self.detect._Detect__parse_deidentify_file_response(data)
@@ -657,7 +659,7 @@ def test_deidentify_file_using_file_path(self, mock_open, mock_basename, mock_ba
processed_response = Mock()
processed_response.status = "SUCCESS"
processed_response.output = []
- processed_response.word_character_count = Mock(word_count=1, character_count=1)
+ processed_response.wordCharacterCount = Mock(wordCount=1, characterCount=1)
# Test the method
with patch.object(self.detect, "_Detect__poll_for_processed_file",