Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
72 changes: 20 additions & 52 deletions skyflow/generated/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,12 +20,7 @@
DeidentifyStatusResponse,
DeidentifyStatusResponseOutputType,
DeidentifyStatusResponseStatus,
DeidentifyStatusResponseWordCharacterCount,
DeidentifyStringResponse,
DetectDataAccuracy,
DetectDataEntities,
DetectFileRequestDataType,
DetectRequestDeidentifyOption,
DetectedEntity,
DetokenizeRecordResponseValueType,
EntityLocation,
Expand All @@ -36,9 +30,11 @@
ErrorResponseError,
ErrorString,
GooglerpcStatus,
ProcessedFileOutputProcessedFileType,
ProtobufAny,
RedactionEnumRedaction,
ReidentifyFileResponse,
ReidentifyFileResponseOutput,
ReidentifyFileResponseStatus,
ReidentifyStringResponse,
RequestActionType,
ResourceId,
Expand All @@ -51,9 +47,6 @@
TransformationsShiftDates,
TransformationsShiftDatesEntityTypesItem,
Uuid,
V1AdvancedOptions,
V1AudioConfig,
V1AudioOptions,
V1AuditAfterOptions,
V1AuditEventResponse,
V1AuditResponse,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -130,6 +111,9 @@
DeidentifyStructuredTextRequestFile,
DeidentifyStructuredTextRequestFileDataFormat,
DeidentifyTextRequestFile,
ReidentifyFileRequestFile,
ReidentifyFileRequestFileDataFormat,
ReidentifyFileRequestFormat,
)
from .records import (
RecordServiceBulkGetRecordRequestOrderBy,
Expand All @@ -140,12 +124,8 @@
from .version import __version__

__all__ = [
"AdvancedOptionsColumnMapping",
"AdvancedOptionsEntityColumnMap",
"AdvancedOptionsVaultSchema",
"AllowRegex",
"AsyncSkyflow",
"AudioConfigTranscriptionType",
"AuditEventAuditResourceType",
"AuditEventContext",
"AuditEventData",
Expand All @@ -158,6 +138,9 @@
"AuditServiceListAuditEventsRequestSortOpsOrderBy",
"BadRequestError",
"BatchRecordMethod",
"CheckGuardrailsResponse",
"CheckGuardrailsResponseValidation",
"ConfigurationId",
"ContextAccessType",
"ContextAuthMode",
"DeidentifyAudioRequestFile",
Expand All @@ -181,15 +164,10 @@
"DeidentifyStatusResponse",
"DeidentifyStatusResponseOutputType",
"DeidentifyStatusResponseStatus",
"DeidentifyStatusResponseWordCharacterCount",
"DeidentifyStringResponse",
"DeidentifyStructuredTextRequestFile",
"DeidentifyStructuredTextRequestFileDataFormat",
"DeidentifyTextRequestFile",
"DetectDataAccuracy",
"DetectDataEntities",
"DetectFileRequestDataType",
"DetectRequestDeidentifyOption",
"DetectedEntity",
"DetokenizeRecordResponseValueType",
"EntityLocation",
Expand All @@ -201,12 +179,17 @@
"GooglerpcStatus",
"InternalServerError",
"NotFoundError",
"ProcessedFileOutputProcessedFileType",
"ProtobufAny",
"RecordServiceBulkGetRecordRequestOrderBy",
"RecordServiceBulkGetRecordRequestRedaction",
"RecordServiceGetRecordRequestRedaction",
"RedactionEnumRedaction",
"ReidentifyFileRequestFile",
"ReidentifyFileRequestFileDataFormat",
"ReidentifyFileRequestFormat",
"ReidentifyFileResponse",
"ReidentifyFileResponseOutput",
"ReidentifyFileResponseStatus",
"ReidentifyStringRequestFormat",
"ReidentifyStringResponse",
"RequestActionType",
Expand All @@ -223,9 +206,6 @@
"TransformationsShiftDatesEntityTypesItem",
"UnauthorizedError",
"Uuid",
"V1AdvancedOptions",
"V1AudioConfig",
"V1AudioOptions",
"V1AuditAfterOptions",
"V1AuditEventResponse",
"V1AuditResponse",
Expand All @@ -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",
Expand All @@ -274,8 +242,8 @@
"audit",
"authentication",
"bin_lookup",
"deprecated",
"files",
"guardrails",
"query",
"records",
"strings",
Expand Down
16 changes: 13 additions & 3 deletions skyflow/generated/rest/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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.

Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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)

Expand Down
16 changes: 12 additions & 4 deletions skyflow/generated/rest/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions skyflow/generated/rest/core/pydantic_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Loading