diff --git a/docs/set-up/config-reference.md b/docs/set-up/config-reference.md index d0db977e59..2b18566218 100644 --- a/docs/set-up/config-reference.md +++ b/docs/set-up/config-reference.md @@ -842,8 +842,8 @@ safe_synthesizer: container_image: nmp-gpu-tasks # default: '.nemo/safe-synthesizer-runtime' runtime_venv: .nemo/safe-synthesizer-runtime - # default: 'nemo-safe-synthesizer[engine,cu129]==0.1.1' - runtime_package: nemo-safe-synthesizer[engine,cu129]==0.1.1 + # default: 'nemo-safe-synthesizer[engine,cu129]==0.1.2' + runtime_package: nemo-safe-synthesizer[engine,cu129]==0.1.2 # default: '3.11' runtime_python_version: '3.11' runtime_python: diff --git a/packages/nemo_platform/pyproject.toml b/packages/nemo_platform/pyproject.toml index 4110a37966..bc065598c9 100644 --- a/packages/nemo_platform/pyproject.toml +++ b/packages/nemo_platform/pyproject.toml @@ -382,7 +382,7 @@ nemo-safe-synthesizer-plugin = [ "gunicorn>=23.0.0", "httpx>=0.27.2", "nemo-platform-plugin", - "nemo-safe-synthesizer==0.1.1", + "nemo-safe-synthesizer==0.1.2", "pydantic[email]>=2.9.2", "pydantic-settings>=2.2.1", "python-multipart~=0.0.9", diff --git a/plugins/nemo-safe-synthesizer/openapi/openapi.yaml b/plugins/nemo-safe-synthesizer/openapi/openapi.yaml index 1dce92469c..a823abec00 100644 --- a/plugins/nemo-safe-synthesizer/openapi/openapi.yaml +++ b/plugins/nemo-safe-synthesizer/openapi/openapi.yaml @@ -842,14 +842,18 @@ components: structured_generation_schema_method: type: string enum: + - auto - regex - json_schema + - structural_tag title: structured_generation_schema_method description: The method used to generate the schema from your dataset and - pass it to the generation backend. 'regex' uses a custom regex construction + pass it to the generation backend. 'auto' picks 'structural_tag' on xgrammar-capable + backends and 'regex' otherwise. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost - of speed. - default: regex + of speed. 'structural_tag' uses XGrammar Structural Tag to compose schema-constrained + JSONL output. + default: auto structured_generation_use_single_sequence: type: boolean title: structured_generation_use_single_sequence diff --git a/plugins/nemo-safe-synthesizer/pyproject.toml b/plugins/nemo-safe-synthesizer/pyproject.toml index cd9d3eda67..130dcb6b29 100644 --- a/plugins/nemo-safe-synthesizer/pyproject.toml +++ b/plugins/nemo-safe-synthesizer/pyproject.toml @@ -12,7 +12,7 @@ dependencies = [ "httpx>=0.27.2", "nemo-platform", "nemo-platform-plugin", - "nemo-safe-synthesizer==0.1.1", + "nemo-safe-synthesizer==0.1.2", "pydantic[email]>=2.9.2", "pydantic-settings>=2.2.1", "python-multipart~=0.0.9", diff --git a/plugins/nemo-safe-synthesizer/src/nemo_safe_synthesizer_plugin/config.py b/plugins/nemo-safe-synthesizer/src/nemo_safe_synthesizer_plugin/config.py index 5616abe8b1..4dce9b14ac 100644 --- a/plugins/nemo-safe-synthesizer/src/nemo_safe_synthesizer_plugin/config.py +++ b/plugins/nemo-safe-synthesizer/src/nemo_safe_synthesizer_plugin/config.py @@ -24,7 +24,7 @@ class SafeSynthesizerConfig(NemoConfig): job_executor_profile: str = "default" container_image: str = "nmp-gpu-tasks" runtime_venv: str = ".nemo/safe-synthesizer-runtime" - runtime_package: str = "nemo-safe-synthesizer[engine,cu129]==0.1.1" + runtime_package: str = "nemo-safe-synthesizer[engine,cu129]==0.1.2" runtime_python_version: str = "3.11" runtime_python: str | None = None default_job_resource_memory_request: str = "16G" diff --git a/uv.lock b/uv.lock index 90ca692ca4..88e3c24fc3 100644 --- a/uv.lock +++ b/uv.lock @@ -4760,10 +4760,10 @@ requires-dist = [ { name = "nemo-platform-sdk", marker = "extra == 'nmp-common'", editable = "sdk/python/nemo-platform" }, { name = "nemo-platform-sdk", marker = "extra == 'plugins'", editable = "sdk/python/nemo-platform" }, { name = "nemo-platform-sdk", marker = "extra == 'services'", editable = "sdk/python/nemo-platform" }, - { name = "nemo-safe-synthesizer", marker = "extra == 'all'", specifier = "==0.1.1" }, - { name = "nemo-safe-synthesizer", marker = "extra == 'nemo-safe-synthesizer-plugin'", specifier = "==0.1.1" }, - { name = "nemo-safe-synthesizer", marker = "extra == 'plugins'", specifier = "==0.1.1" }, - { name = "nemo-safe-synthesizer", marker = "extra == 'services'", specifier = "==0.1.1" }, + { name = "nemo-safe-synthesizer", marker = "extra == 'all'", specifier = "==0.1.2" }, + { name = "nemo-safe-synthesizer", marker = "extra == 'nemo-safe-synthesizer-plugin'", specifier = "==0.1.2" }, + { name = "nemo-safe-synthesizer", marker = "extra == 'plugins'", specifier = "==0.1.2" }, + { name = "nemo-safe-synthesizer", marker = "extra == 'services'", specifier = "==0.1.2" }, { name = "nemoguardrails", extras = ["tracing"], marker = "extra == 'all'", specifier = "==0.21.0" }, { name = "nemoguardrails", extras = ["tracing"], marker = "extra == 'all'", specifier = "~=0.21.0" }, { name = "nemoguardrails", extras = ["tracing"], marker = "extra == 'guardrails-service'", specifier = "~=0.21.0" }, @@ -5384,7 +5384,7 @@ test = [ [[package]] name = "nemo-safe-synthesizer" -version = "0.1.1" +version = "0.1.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" }, @@ -5402,7 +5402,7 @@ dependencies = [ { name = "tqdm", marker = "(platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/cf/ab/66c7b78eb895c66f80795d88714fb860d4c41aa43b8ea09d8a844ec754cc/nemo_safe_synthesizer-0.1.1-py3-none-any.whl", hash = "sha256:e92564b8522ffc2360fb6daaca36e88a722206e165a4fe157e7ccf65b1cac260", size = 552792, upload-time = "2026-05-28T17:01:30.367Z" }, + { url = "https://files.pythonhosted.org/packages/e7/f8/2ec77a08595640b331c420c6978cb626be6f28c770481c0e5a3e900a27ee/nemo_safe_synthesizer-0.1.2-py3-none-any.whl", hash = "sha256:fbf6f9179052d0ac27ad4493238009a5e1c7ae7775354f062d5e90725890b0ce", size = 561741, upload-time = "2026-06-04T20:03:40.12Z" }, ] [[package]] @@ -5456,7 +5456,7 @@ requires-dist = [ { name = "lark", marker = "extra == 'nemo-platform-plugin'", specifier = ">=1.1.0" }, { name = "nemo-platform", editable = "packages/nemo_platform" }, { name = "nemo-platform-plugin", editable = "packages/nemo_platform_plugin" }, - { name = "nemo-safe-synthesizer", specifier = "==0.1.1" }, + { name = "nemo-safe-synthesizer", specifier = "==0.1.2" }, { name = "openai", marker = "extra == 'nemo-platform-plugin'", specifier = ">=1.109.1" }, { name = "pydantic", marker = "extra == 'nemo-platform-plugin'", specifier = ">=2.10.3" }, { name = "pydantic", extras = ["email"], specifier = ">=2.9.2" }, diff --git a/web/packages/sdk/orval/constants.ts b/web/packages/sdk/orval/constants.ts index ee6036af21..348799fb89 100644 --- a/web/packages/sdk/orval/constants.ts +++ b/web/packages/sdk/orval/constants.ts @@ -37,6 +37,12 @@ export const serviceConfigs: Record = { apiEnvKeys: ['VITE_PLATFORM_BASE_URL'], zod: true, }, + 'safe-synthesizer': { + path: 'safe-synthesizer', + url: `../../../../plugins/nemo-safe-synthesizer/openapi/openapi.yaml`, + apiEnvKeys: ['VITE_PLATFORM_BASE_URL'], + zod: true, + }, }; export const serviceToConfig = { diff --git a/web/packages/sdk/package.json b/web/packages/sdk/package.json index ae1bd54616..c035c62cb6 100644 --- a/web/packages/sdk/package.json +++ b/web/packages/sdk/package.json @@ -24,6 +24,7 @@ "gen:platform": "tsx ./orval/generate.ts platform", "gen:platform-zod": "ORVAL_CLIENT=zod tsx ./orval/generate.ts platform", "gen:safe-synthesizer": "tsx ./orval/generate.ts safe-synthesizer", + "gen:safe-synthesizer-zod": "ORVAL_CLIENT=zod tsx ./orval/generate.ts safe-synthesizer", "test": "vitest run" }, "dependencies": { diff --git a/web/packages/sdk/vendored/safe-synthesizer/api.ts b/web/packages/sdk/vendored/safe-synthesizer/api.ts deleted file mode 100644 index f990968a95..0000000000 --- a/web/packages/sdk/vendored/safe-synthesizer/api.ts +++ /dev/null @@ -1,3224 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -// TEMP: SafeSynthesizer-specific React Query hooks and fetchers inlined while the safe-synthesizer SDK is being rebuilt. -// Source: lines 34765-37944 of @nemo/sdk/generated/platform/api.ts (verbatim). -// Restore SDK imports (`@nemo/sdk/generated/platform/api`) once the SDK regenerates with safe-synthesizer support. - -import { useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'; -import type { - DataTag, - DefinedInitialDataOptions, - DefinedUseQueryResult, - MutationFunction, - QueryClient, - QueryFunction, - QueryKey, - UndefinedInitialDataOptions, - UseMutationOptions, - UseMutationResult, - UseQueryOptions, - UseQueryResult, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from '@tanstack/react-query'; - -import { customFetch } from '../../generated/fetchers/platform'; -import type { ErrorType } from '../../generated/fetchers/platform'; - -// Non-SafeSynthesizer schema types still in the SDK -import type { - HTTPValidationError, - PlatformJobListResultResponse, - PlatformJobLogPage, - PlatformJobResultResponse, - PlatformJobStatusResponse, -} from '../../generated/platform/schema'; - -// SafeSynthesizer-specific schema types — inlined locally -import type { - SafeSynthesizerGetJobLogsParams, - SafeSynthesizerJob, - SafeSynthesizerJobRequest, - SafeSynthesizerJobsPage, - SafeSynthesizerListJobsParams, - SafeSynthesizerSummary, -} from './schema'; - -/** - * @summary Create Job - */ -export const safeSynthesizerCreateJob = ( - workspace: string, - safeSynthesizerJobRequest: SafeSynthesizerJobRequest, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs`, - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - data: safeSynthesizerJobRequest, - signal, - }); -}; - -export const getSafeSynthesizerCreateJobMutationOptions = < - TError = ErrorType, - TContext = unknown, ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; data: SafeSynthesizerJobRequest }, - TContext - >; -}): UseMutationOptions< - Awaited>, - TError, - { workspace: string; data: SafeSynthesizerJobRequest }, - TContext -> => { - const mutationKey = ['safeSynthesizerCreateJob']; - const { mutation: mutationOptions } = options - ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey - ? options - : { ...options, mutation: { ...options.mutation, mutationKey } } - : { mutation: { mutationKey } }; - - const mutationFn: MutationFunction< - Awaited>, - { workspace: string; data: SafeSynthesizerJobRequest } - > = (props) => { - const { workspace, data } = props ?? {}; - - return safeSynthesizerCreateJob(workspace, data); - }; - - return { mutationFn, ...mutationOptions }; -}; - -export type SafeSynthesizerCreateJobMutationResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerCreateJobMutationBody = SafeSynthesizerJobRequest; -export type SafeSynthesizerCreateJobMutationError = ErrorType; - -/** - * @summary Create Job - */ -export const useSafeSynthesizerCreateJob = < - TError = ErrorType, - TContext = unknown, ->( - options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; data: SafeSynthesizerJobRequest }, - TContext - >; - }, - queryClient?: QueryClient -): UseMutationResult< - Awaited>, - TError, - { workspace: string; data: SafeSynthesizerJobRequest }, - TContext -> => { - return useMutation(getSafeSynthesizerCreateJobMutationOptions(options), queryClient); -}; - -/** - * @summary List Jobs - */ -export const safeSynthesizerListJobs = ( - workspace: string, - params?: SafeSynthesizerListJobsParams, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs`, - method: 'GET', - params, - signal, - }); -}; - -export const getSafeSynthesizerListJobsQueryKey = ( - workspace: string, - params?: SafeSynthesizerListJobsParams -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs`, - ...(params ? [params] : []), - ] as const; -}; - -export const getSafeSynthesizerListJobsQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getSafeSynthesizerListJobsQueryKey(workspace, params); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerListJobs(workspace, params, signal); - - return { queryKey, queryFn, enabled: !!workspace, ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerListJobsQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerListJobsQueryError = ErrorType; - -export function useSafeSynthesizerListJobs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params: undefined | SafeSynthesizerListJobsParams, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary List Jobs - */ - -export function useSafeSynthesizerListJobs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerListJobsQueryOptions(workspace, params, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerListJobsSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getSafeSynthesizerListJobsQueryKey(workspace, params); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerListJobs(workspace, params, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerListJobsSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerListJobsSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerListJobsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params: undefined | SafeSynthesizerListJobsParams, - options: { - query: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary List Jobs - */ - -export function useSafeSynthesizerListJobsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - params?: SafeSynthesizerListJobsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerListJobsSuspenseQueryOptions(workspace, params, options); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Download Job Result Adapter - */ -export const safeSynthesizerDownloadJobResultAdapter = ( - workspace: string, - job: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/adapter/download`, - method: 'GET', - responseType: 'blob', - signal, - }); -}; - -export const getSafeSynthesizerDownloadJobResultAdapterQueryKey = ( - workspace: string, - job: string -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/adapter/download`, - ] as const; -}; - -export const getSafeSynthesizerDownloadJobResultAdapterQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultAdapterQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultAdapter(workspace, job, signal); - - return { queryKey, queryFn, enabled: !!(workspace && job), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultAdapterQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultAdapterQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultAdapter< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultAdapter< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultAdapter< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Adapter - */ - -export function useSafeSynthesizerDownloadJobResultAdapter< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultAdapterQueryOptions( - workspace, - job, - options - ); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerDownloadJobResultAdapterSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultAdapterQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultAdapter(workspace, job, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultAdapterSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultAdapterSuspenseQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultAdapterSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultAdapterSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultAdapterSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Adapter - */ - -export function useSafeSynthesizerDownloadJobResultAdapterSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultAdapterSuspenseQueryOptions( - workspace, - job, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Download Job Result Evaluation-Report - */ -export const safeSynthesizerDownloadJobResultEvaluationReport = ( - workspace: string, - job: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/evaluation-report/download`, - method: 'GET', - responseType: 'blob', - signal, - }); -}; - -export const getSafeSynthesizerDownloadJobResultEvaluationReportQueryKey = ( - workspace: string, - job: string -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/evaluation-report/download`, - ] as const; -}; - -export const getSafeSynthesizerDownloadJobResultEvaluationReportQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? - getSafeSynthesizerDownloadJobResultEvaluationReportQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultEvaluationReport(workspace, job, signal); - - return { queryKey, queryFn, enabled: !!(workspace && job), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultEvaluationReportQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultEvaluationReportQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultEvaluationReport< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultEvaluationReport< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultEvaluationReport< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Evaluation-Report - */ - -export function useSafeSynthesizerDownloadJobResultEvaluationReport< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultEvaluationReportQueryOptions( - workspace, - job, - options - ); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerDownloadJobResultEvaluationReportSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? - getSafeSynthesizerDownloadJobResultEvaluationReportQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultEvaluationReport(workspace, job, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultEvaluationReportSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultEvaluationReportSuspenseQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultEvaluationReportSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultEvaluationReportSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultEvaluationReportSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Evaluation-Report - */ - -export function useSafeSynthesizerDownloadJobResultEvaluationReportSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultEvaluationReportSuspenseQueryOptions( - workspace, - job, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Download Job Result Summary - */ -export const safeSynthesizerDownloadJobResultSummary = ( - workspace: string, - job: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/summary/download`, - method: 'GET', - signal, - }); -}; - -export const getSafeSynthesizerDownloadJobResultSummaryQueryKey = ( - workspace: string, - job: string -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/summary/download`, - ] as const; -}; - -export const getSafeSynthesizerDownloadJobResultSummaryQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultSummaryQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultSummary(workspace, job, signal); - - return { queryKey, queryFn, enabled: !!(workspace && job), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultSummaryQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultSummaryQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultSummary< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSummary< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSummary< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Summary - */ - -export function useSafeSynthesizerDownloadJobResultSummary< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultSummaryQueryOptions( - workspace, - job, - options - ); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerDownloadJobResultSummarySuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultSummaryQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultSummary(workspace, job, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultSummarySuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultSummarySuspenseQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultSummarySuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSummarySuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSummarySuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Summary - */ - -export function useSafeSynthesizerDownloadJobResultSummarySuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultSummarySuspenseQueryOptions( - workspace, - job, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Download Job Result Synthetic-Data - */ -export const safeSynthesizerDownloadJobResultSyntheticData = ( - workspace: string, - job: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/synthetic-data/download`, - method: 'GET', - responseType: 'blob', - signal, - }); -}; - -export const getSafeSynthesizerDownloadJobResultSyntheticDataQueryKey = ( - workspace: string, - job: string -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/synthetic-data/download`, - ] as const; -}; - -export const getSafeSynthesizerDownloadJobResultSyntheticDataQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? - getSafeSynthesizerDownloadJobResultSyntheticDataQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultSyntheticData(workspace, job, signal); - - return { queryKey, queryFn, enabled: !!(workspace && job), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultSyntheticDataQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultSyntheticDataQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultSyntheticData< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSyntheticData< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSyntheticData< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Synthetic-Data - */ - -export function useSafeSynthesizerDownloadJobResultSyntheticData< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultSyntheticDataQueryOptions( - workspace, - job, - options - ); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerDownloadJobResultSyntheticDataSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? - getSafeSynthesizerDownloadJobResultSyntheticDataQueryKey(workspace, job); - - const queryFn: QueryFunction< - Awaited> - > = ({ signal }) => safeSynthesizerDownloadJobResultSyntheticData(workspace, job, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultSyntheticDataSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultSyntheticDataSuspenseQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultSyntheticDataSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSyntheticDataSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSyntheticDataSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result Synthetic-Data - */ - -export function useSafeSynthesizerDownloadJobResultSyntheticDataSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultSyntheticDataSuspenseQueryOptions( - workspace, - job, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Get Job Result - */ -export const safeSynthesizerGetJobResult = ( - workspace: string, - job: string, - name: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/${encodeURIComponent(String(name))}`, - method: 'GET', - signal, - }); -}; - -export const getSafeSynthesizerGetJobResultQueryKey = ( - workspace: string, - job: string, - name: string -) => { - return [`/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/${name}`] as const; -}; - -export const getSafeSynthesizerGetJobResultQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobResultQueryKey(workspace, job, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobResult(workspace, job, name, signal); - - return { - queryKey, - queryFn, - enabled: !!(workspace && job && name), - ...queryOptions, - } as UseQueryOptions>, TError, TData> & { - queryKey: DataTag; - }; -}; - -export type SafeSynthesizerGetJobResultQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobResultQueryError = ErrorType; - -export function useSafeSynthesizerGetJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Result - */ - -export function useSafeSynthesizerGetJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobResultQueryOptions(workspace, job, name, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerGetJobResultSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobResultQueryKey(workspace, job, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobResult(workspace, job, name, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobResultSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobResultSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerGetJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Result - */ - -export function useSafeSynthesizerGetJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobResultSuspenseQueryOptions( - workspace, - job, - name, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Download Job Result - */ -export const safeSynthesizerDownloadJobResult = ( - workspace: string, - job: string, - name: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(job))}/results/${encodeURIComponent(String(name))}/download`, - method: 'GET', - responseType: 'blob', - signal, - }); -}; - -export const getSafeSynthesizerDownloadJobResultQueryKey = ( - workspace: string, - job: string, - name: string -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${job}/results/${name}/download`, - ] as const; -}; - -export const getSafeSynthesizerDownloadJobResultQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultQueryKey(workspace, job, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerDownloadJobResult(workspace, job, name, signal); - - return { - queryKey, - queryFn, - enabled: !!(workspace && job && name), - ...queryOptions, - } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultQueryError = ErrorType; - -export function useSafeSynthesizerDownloadJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result - */ - -export function useSafeSynthesizerDownloadJobResult< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultQueryOptions( - workspace, - job, - name, - options - ); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerDownloadJobResultSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerDownloadJobResultQueryKey(workspace, job, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerDownloadJobResult(workspace, job, name, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerDownloadJobResultSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerDownloadJobResultSuspenseQueryError = - ErrorType; - -export function useSafeSynthesizerDownloadJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerDownloadJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Download Job Result - */ - -export function useSafeSynthesizerDownloadJobResultSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - job: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerDownloadJobResultSuspenseQueryOptions( - workspace, - job, - name, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Get Job - */ -export const safeSynthesizerGetJob = (workspace: string, name: string, signal?: AbortSignal) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}`, - method: 'GET', - signal, - }); -}; - -export const getSafeSynthesizerGetJobQueryKey = (workspace: string, name: string) => { - return [`/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${name}`] as const; -}; - -export const getSafeSynthesizerGetJobQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getSafeSynthesizerGetJobQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ signal }) => - safeSynthesizerGetJob(workspace, name, signal); - - return { queryKey, queryFn, enabled: !!(workspace && name), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobQueryError = ErrorType; - -export function useSafeSynthesizerGetJob< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJob< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJob< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job - */ - -export function useSafeSynthesizerGetJob< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobQueryOptions(workspace, name, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerGetJobSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getSafeSynthesizerGetJobQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ signal }) => - safeSynthesizerGetJob(workspace, name, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerGetJobSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job - */ - -export function useSafeSynthesizerGetJobSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobSuspenseQueryOptions(workspace, name, options); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Delete Job - */ -export const safeSynthesizerDeleteJob = (workspace: string, name: string, signal?: AbortSignal) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}`, - method: 'DELETE', - signal, - }); -}; - -export const getSafeSynthesizerDeleteJobMutationOptions = < - TError = ErrorType, - TContext = unknown, ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext - >; -}): UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext -> => { - const mutationKey = ['safeSynthesizerDeleteJob']; - const { mutation: mutationOptions } = options - ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey - ? options - : { ...options, mutation: { ...options.mutation, mutationKey } } - : { mutation: { mutationKey } }; - - const mutationFn: MutationFunction< - Awaited>, - { workspace: string; name: string } - > = (props) => { - const { workspace, name } = props ?? {}; - - return safeSynthesizerDeleteJob(workspace, name); - }; - - return { mutationFn, ...mutationOptions }; -}; - -export type SafeSynthesizerDeleteJobMutationResult = NonNullable< - Awaited> ->; - -export type SafeSynthesizerDeleteJobMutationError = ErrorType; - -/** - * @summary Delete Job - */ -export const useSafeSynthesizerDeleteJob = < - TError = ErrorType, - TContext = unknown, ->( - options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext - >; - }, - queryClient?: QueryClient -): UseMutationResult< - Awaited>, - TError, - { workspace: string; name: string }, - TContext -> => { - return useMutation(getSafeSynthesizerDeleteJobMutationOptions(options), queryClient); -}; - -/** - * @summary Cancel Job - */ -export const safeSynthesizerCancelJob = (workspace: string, name: string, signal?: AbortSignal) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}/cancel`, - method: 'POST', - signal, - }); -}; - -export const getSafeSynthesizerCancelJobMutationOptions = < - TError = ErrorType, - TContext = unknown, ->(options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext - >; -}): UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext -> => { - const mutationKey = ['safeSynthesizerCancelJob']; - const { mutation: mutationOptions } = options - ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey - ? options - : { ...options, mutation: { ...options.mutation, mutationKey } } - : { mutation: { mutationKey } }; - - const mutationFn: MutationFunction< - Awaited>, - { workspace: string; name: string } - > = (props) => { - const { workspace, name } = props ?? {}; - - return safeSynthesizerCancelJob(workspace, name); - }; - - return { mutationFn, ...mutationOptions }; -}; - -export type SafeSynthesizerCancelJobMutationResult = NonNullable< - Awaited> ->; - -export type SafeSynthesizerCancelJobMutationError = ErrorType; - -/** - * @summary Cancel Job - */ -export const useSafeSynthesizerCancelJob = < - TError = ErrorType, - TContext = unknown, ->( - options?: { - mutation?: UseMutationOptions< - Awaited>, - TError, - { workspace: string; name: string }, - TContext - >; - }, - queryClient?: QueryClient -): UseMutationResult< - Awaited>, - TError, - { workspace: string; name: string }, - TContext -> => { - return useMutation(getSafeSynthesizerCancelJobMutationOptions(options), queryClient); -}; - -/** - * @summary Get Job Logs - */ -export const safeSynthesizerGetJobLogs = ( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}/logs`, - method: 'GET', - params, - signal, - }); -}; - -export const getSafeSynthesizerGetJobLogsQueryKey = ( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams -) => { - return [ - `/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${name}/logs`, - ...(params ? [params] : []), - ] as const; -}; - -export const getSafeSynthesizerGetJobLogsQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobLogsQueryKey(workspace, name, params); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobLogs(workspace, name, params, signal); - - return { queryKey, queryFn, enabled: !!(workspace && name), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobLogsQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobLogsQueryError = ErrorType; - -export function useSafeSynthesizerGetJobLogs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params: undefined | SafeSynthesizerGetJobLogsParams, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobLogs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobLogs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Logs - */ - -export function useSafeSynthesizerGetJobLogs< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobLogsQueryOptions(workspace, name, params, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerGetJobLogsSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobLogsQueryKey(workspace, name, params); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobLogs(workspace, name, params, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobLogsSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobLogsSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerGetJobLogsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params: undefined | SafeSynthesizerGetJobLogsParams, - options: { - query: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobLogsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobLogsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Logs - */ - -export function useSafeSynthesizerGetJobLogsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - params?: SafeSynthesizerGetJobLogsParams, - options?: { - query?: Partial< - UseSuspenseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobLogsSuspenseQueryOptions( - workspace, - name, - params, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary List Job Results - */ -export const safeSynthesizerListJobResults = ( - workspace: string, - name: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}/results`, - method: 'GET', - signal, - }); -}; - -export const getSafeSynthesizerListJobResultsQueryKey = (workspace: string, name: string) => { - return [`/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${name}/results`] as const; -}; - -export const getSafeSynthesizerListJobResultsQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerListJobResultsQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerListJobResults(workspace, name, signal); - - return { queryKey, queryFn, enabled: !!(workspace && name), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerListJobResultsQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerListJobResultsQueryError = ErrorType; - -export function useSafeSynthesizerListJobResults< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobResults< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobResults< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary List Job Results - */ - -export function useSafeSynthesizerListJobResults< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerListJobResultsQueryOptions(workspace, name, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerListJobResultsSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerListJobResultsQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerListJobResults(workspace, name, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerListJobResultsSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerListJobResultsSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerListJobResultsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobResultsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerListJobResultsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary List Job Results - */ - -export function useSafeSynthesizerListJobResultsSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerListJobResultsSuspenseQueryOptions( - workspace, - name, - options - ); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -/** - * @summary Get Job Status - */ -export const safeSynthesizerGetJobStatus = ( - workspace: string, - name: string, - signal?: AbortSignal -) => { - return customFetch({ - url: `/apis/safe-synthesizer/v2/workspaces/${encodeURIComponent(String(workspace))}/jobs/${encodeURIComponent(String(name))}/status`, - method: 'GET', - signal, - }); -}; - -export const getSafeSynthesizerGetJobStatusQueryKey = (workspace: string, name: string) => { - return [`/apis/safe-synthesizer/v2/workspaces/${workspace}/jobs/${name}/status`] as const; -}; - -export const getSafeSynthesizerGetJobStatusQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobStatusQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobStatus(workspace, name, signal); - - return { queryKey, queryFn, enabled: !!(workspace && name), ...queryOptions } as UseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobStatusQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobStatusQueryError = ErrorType; - -export function useSafeSynthesizerGetJobStatus< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - DefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): DefinedUseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobStatus< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - > & - Pick< - UndefinedInitialDataOptions< - Awaited>, - TError, - Awaited> - >, - 'initialData' - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobStatus< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Status - */ - -export function useSafeSynthesizerGetJobStatus< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseQueryOptions>, TError, TData> - >; - }, - queryClient?: QueryClient -): UseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobStatusQueryOptions(workspace, name, options); - - const query = useQuery(queryOptions, queryClient) as UseQueryResult & { - queryKey: DataTag; - }; - - return { ...query, queryKey: queryOptions.queryKey }; -} - -export const getSafeSynthesizerGetJobStatusSuspenseQueryOptions = < - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - } -) => { - const { query: queryOptions } = options ?? {}; - - const queryKey = - queryOptions?.queryKey ?? getSafeSynthesizerGetJobStatusQueryKey(workspace, name); - - const queryFn: QueryFunction>> = ({ - signal, - }) => safeSynthesizerGetJobStatus(workspace, name, signal); - - return { queryKey, queryFn, ...queryOptions } as UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > & { queryKey: DataTag }; -}; - -export type SafeSynthesizerGetJobStatusSuspenseQueryResult = NonNullable< - Awaited> ->; -export type SafeSynthesizerGetJobStatusSuspenseQueryError = ErrorType; - -export function useSafeSynthesizerGetJobStatusSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options: { - query: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobStatusSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -export function useSafeSynthesizerGetJobStatusSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag }; -/** - * @summary Get Job Status - */ - -export function useSafeSynthesizerGetJobStatusSuspense< - TData = Awaited>, - TError = ErrorType, ->( - workspace: string, - name: string, - options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > - >; - }, - queryClient?: QueryClient -): UseSuspenseQueryResult & { queryKey: DataTag } { - const queryOptions = getSafeSynthesizerGetJobStatusSuspenseQueryOptions(workspace, name, options); - - const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult< - TData, - TError - > & { queryKey: DataTag }; - - return { ...query, queryKey: queryOptions.queryKey }; -} diff --git a/web/packages/sdk/vendored/safe-synthesizer/schema.ts b/web/packages/sdk/vendored/safe-synthesizer/schema.ts deleted file mode 100644 index 0cb717639c..0000000000 --- a/web/packages/sdk/vendored/safe-synthesizer/schema.ts +++ /dev/null @@ -1,634 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -// TEMP: SafeSynthesizer-specific schema types inlined while the safe-synthesizer SDK is being rebuilt. -// Source: @nemo/sdk/generated/platform/schema/SafeSynthesizer*.ts plus SS-only config types -// (ClassifyConfig, Column, GenerateParameters, etc. — these were referenced only by SafeSynthesizer). -// Restore SDK imports (`@nemo/sdk/generated/platform/schema`) once the SDK regenerates with safe-synthesizer support. - -// Truly shared types still live in the SDK — re-export from there. -export type { - DatetimeFilter, - PaginationData, - PlatformJobStatus, -} from '../../generated/platform/schema'; - -import type { - DatetimeFilter, - PaginationData, - PlatformJobStatus, -} from '../../generated/platform/schema'; - -// ----- SafeSynthesizerJob ----- -export interface SafeSynthesizerJob { - id?: string; - name: string; - description?: string; - project?: string; - workspace?: string; - created_at?: string; - updated_at?: string; - spec: SafeSynthesizerJobConfig; - status?: PlatformJobStatus; - status_details?: SafeSynthesizerJobStatusDetails; - error_details?: SafeSynthesizerJobErrorDetails; - ownership?: SafeSynthesizerJobOwnership; - custom_fields?: SafeSynthesizerJobCustomFields; -} - -// ----- SafeSynthesizerJobConfig ----- -/** - * Configuration model for Safe Synthesizer jobs. - -Used primarily internally to configure a run submitted to the NeMo Jobs -Microservice. - */ -export interface SafeSynthesizerJobConfig { - /** The data source for the job. */ - data_source: string; - /** The Safe Synthesizer parameters configuration. */ - config: SafeSynthesizerParameters; - /** Name of platform secret containing the HuggingFace token. Must exist in the same workspace as the job. */ - hf_token_secret?: string; - /** Whether to run LLM training and generation phases. When False the task only performs PII replacement and returns the processed data. */ - enable_synthesis?: boolean; -} - -// ----- SafeSynthesizerJobCustomFields ----- -export type SafeSynthesizerJobCustomFields = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobErrorDetails ----- -export type SafeSynthesizerJobErrorDetails = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobOwnership ----- -export type SafeSynthesizerJobOwnership = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobRequest ----- -export interface SafeSynthesizerJobRequest { - name?: string; - description?: string; - project?: string; - spec: SafeSynthesizerJobConfig; - ownership?: SafeSynthesizerJobRequestOwnership; - custom_fields?: SafeSynthesizerJobRequestCustomFields; -} - -// ----- SafeSynthesizerJobRequestCustomFields ----- -export type SafeSynthesizerJobRequestCustomFields = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobRequestOwnership ----- -export type SafeSynthesizerJobRequestOwnership = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobStatusDetails ----- -export type SafeSynthesizerJobStatusDetails = { [key: string]: unknown }; - -// ----- SafeSynthesizerJobsListFilter ----- -export interface SafeSynthesizerJobsListFilter { - /** Jobs created at 'gte' datetime or 'lte' datetime. */ - created_at?: DatetimeFilter; - /** Name of the job. */ - name?: string; - /** Workspace of the job. */ - workspace?: string; - /** Project containing the job. */ - project?: string; - /** The current status. */ - status?: PlatformJobStatus; - /** Jobs updated at 'gte' datetime or 'lte' datetime. */ - updated_at?: DatetimeFilter; -} - -// ----- SafeSynthesizerJobsSortField ----- -export type SafeSynthesizerJobsSortField = - (typeof SafeSynthesizerJobsSortField)[keyof typeof SafeSynthesizerJobsSortField]; - -export const SafeSynthesizerJobsSortField = { - created_at: 'created_at', - '-created_at': '-created_at', - updated_at: 'updated_at', - '-updated_at': '-updated_at', -} as const; - -// ----- SafeSynthesizerJobsPage ----- -export interface SafeSynthesizerJobsPage { - data: SafeSynthesizerJob[]; - /** Pagination information. */ - pagination?: PaginationData; - /** The field on which the results are sorted. */ - sort?: string; - /** Filtering information. */ - filter?: SafeSynthesizerJobsPageFilter; -} - -// ----- SafeSynthesizerJobsPageFilter ----- -/** - * Filtering information. - */ -export type SafeSynthesizerJobsPageFilter = { [key: string]: unknown }; - -// ----- SafeSynthesizerParameters ----- -/** - * Main configuration class for the Safe Synthesizer pipeline. - -This is the top-level configuration class that orchestrates all aspects of -synthetic data generation including training, generation, privacy, evaluation, -and data handling. It provides validation to ensure parameter compatibility. - */ -export interface SafeSynthesizerParameters { - /** Configuration controlling how input data is grouped and split for training and evaluation. */ - data?: DataParameters; - /** Parameters for evaluating the quality of generated synthetic data. */ - evaluation?: EvaluationParameters; - /** Hyperparameters for model training such as learning rate, batch size, and LoRA adapter settings. */ - training?: TrainingHyperparams; - /** Parameters governing synthetic data generation including temperature, top-p, and number of records to produce. */ - generation?: GenerateParameters; - /** Differential-privacy hyperparameters. When ``None``, differential privacy is disabled entirely. */ - privacy?: DifferentialPrivacyHyperparams; - /** Configuration for time-series mode. Time-series pipeline is currently experimental. */ - time_series?: TimeSeriesParameters; - /** PII replacement configuration. When ``None``, PII replacement is skipped. */ - replace_pii?: PiiReplacerConfig; -} - -// ----- SafeSynthesizerSummary ----- -/** - * Aggregated quality, privacy, and record-count metrics for a pipeline run. - */ -export interface SafeSynthesizerSummary { - /** Weighted composite of the five sub-scores below (SQS). Higher is better (0--10 scale). */ - synthetic_data_quality_score?: number; - /** How closely pairwise column correlations in synthetic data match the original for numeric and categorical columns. */ - column_correlation_stability_score?: number; - /** PCA-based comparison of multivariate structure between real and synthetic data for numeric and categorical columns. */ - deep_structure_stability_score?: number; - /** Per-column Jensen-Shannon distance between training and synthetic distributions averaged across all numeric and categorical columns. */ - column_distribution_stability_score?: number; - /** Embedding-based semantic closeness between real and synthetic free-text columns. */ - text_semantic_similarity_score?: number; - /** Jensen-Shannon divergence over sentence count, words-per-sentence, and characters-per-word distributions between real and synthetic free-text columns. */ - text_structure_similarity_score?: number; - /** Composite of MIA and AIA protection scores. */ - data_privacy_score?: number; - /** Resistance to attacks that try to determine whether a record was in the training set. */ - membership_inference_protection_score?: number; - /** Resistance to attacks that try to infer sensitive attributes from quasi-identifiers. */ - attribute_inference_protection_score?: number; - /** Count of synthetic records that passed schema and format validation. */ - num_valid_records?: number; - /** Count of synthetic records filtered out during validation. */ - num_invalid_records?: number; - /** Total LLM generation prompts issued. */ - num_prompts?: number; - /** Ratio of valid records: ``num_valid_records / (num_valid_records + num_invalid_records)``. */ - valid_record_fraction?: number; - /** Per-stage wall-clock durations. */ - timing: SafeSynthesizerTiming; -} - -// ----- SafeSynthesizerTiming ----- -/** - * Wall-clock durations for each pipeline stage. - */ -export interface SafeSynthesizerTiming { - /** Total end-to-end pipeline duration in seconds. */ - total_time_sec?: number; - /** Time spent on PII replacement. */ - pii_replacer_time_sec?: number; - /** Time spent on model training. */ - training_time_sec?: number; - /** Time spent generating synthetic records. */ - generation_time_sec?: number; - /** Time spent evaluating synthetic data quality. */ - evaluation_time_sec?: number; -} - -// ----- SafeSynthesizerListJobsParams ----- -export type SafeSynthesizerListJobsParams = { - /** - * Page number. - * @exclusiveMinimum 0 - */ - page?: number; - /** - * Page size. - * @exclusiveMinimum 0 - */ - page_size?: number; - /** - * The field to sort by. To sort in decreasing order, use `-` in front of the field name. - */ - sort?: SafeSynthesizerJobsSortField; - /** - * Filter jobs on various criteria. - */ - filter?: SafeSynthesizerJobsListFilter; -}; - -// ----- SafeSynthesizerGetJobLogsParams ----- -export type SafeSynthesizerGetJobLogsParams = { - limit?: number; - page_cursor?: string; -}; - -// ----- ClassifyConfig ----- -/** - * Configuration for column classification using an LLM. - */ -export interface ClassifyConfig { - /** Enable column classification. */ - enable_classify?: boolean; - /** List of entity types to classify. */ - entities?: string[]; - /** Number of column values to sample for classification. */ - num_samples?: number; - /** Name of the model provider in the Inference Gateway for column classification. The job compiler will resolve this to the appropriate endpoint URL. */ - classify_model_provider?: string; -} - -// ----- Column ----- -/** - * Rule matcher for selecting columns by name, position, condition, entity, or type. - */ -export interface Column { - /** Column name. */ - name?: string; - /** Column position. */ - position?: number | number[]; - /** Column condition. */ - condition?: string; - /** Rename to value. */ - value?: string; - /** Column entity match. */ - entity?: string | string[]; - /** Column type match. */ - type?: string | string[]; -} - -// ----- ColumnActions ----- -/** - * Container for column add, drop, and rename operations. - */ -export interface ColumnActions { - /** Columns to add. */ - add?: Column[]; - /** Columns to drop. */ - drop?: Column[]; - /** Columns to rename. */ - rename?: Column[]; -} - -// ----- DataParameters ----- -/** - * Configuration for grouping, ordering, and splitting input data for training and evaluation. - */ -export interface DataParameters { - /** Column to group training examples by. This is useful when you want the model to learn inter-record correlations for a given grouping of records. */ - group_training_examples_by?: string; - /** Column to order training examples by. This is useful when you want the model to learn sequential relationships for a given ordering of records. If you provide this parameter, you must also provide ``group_training_examples_by``. */ - order_training_examples_by?: string; - /** If specified, adds at most this number of sequences per example. Supports 'auto' where a value of 1 is chosen if differential privacy is enabled, and 10 otherwise. If not specified or set to 'auto', fills up context. Required for DP to limit contribution of each example. */ - max_sequences_per_example?: 'auto' | number; - /** Amount of records to hold out for evaluation. If this is a float between 0 and 1, that ratio of records is held out. If an integer greater than 1, that number of records is held out. If the value is equal to zero, no holdout will be performed. Must be >= 0. */ - holdout?: number; - /** Maximum number of records to hold out. Overrides any behavior set by ``holdout``. Must be >= 0. */ - max_holdout?: number; - /** Random state for holdout split to ensure reproducibility. */ - random_state?: number; -} - -// ----- DifferentialPrivacyHyperparams ----- -/** - * Hyperparameters for differential privacy during training. - -These parameters configure differential privacy (DP) training using DP-SGD algorithm. -When enabled, they provide formal privacy guarantees by adding calibrated noise -during training. - */ -export interface DifferentialPrivacyHyperparams { - /** Enable differentially-private training with DP-SGD. */ - dp_enabled?: boolean; - /** Target privacy budget -- lower values provide stronger privacy. Must be > 0. */ - epsilon?: number; - /** Probability of accidentally leaking information. Should be much smaller than 1/n where n is the number of training records. Setting to 'auto' uses delta of 1/n^1.2. Must be in [0, 1) or 'auto'. */ - delta?: 'auto' | number; - /** Maximum L2 norm for per-sample gradient clipping. Must be > 0. */ - per_sample_max_grad_norm?: number; -} - -// ----- EvaluationParameters ----- -/** - * Configuration for evaluating synthetic data quality and privacy. - -This class controls which evaluation metrics are computed and how they are configured. -It includes privacy attack evaluations, statistical quality metrics, and downstream -machine learning performance assessments. - */ -export interface EvaluationParameters { - /** Enable membership inference attack evaluation for privacy assessment. */ - mia_enabled?: boolean; - /** Enable attribute inference attack evaluation for privacy assessment. */ - aia_enabled?: boolean; - /** Number of columns to include in statistical quality reports. */ - sqs_report_columns?: number; - /** Number of rows to include in statistical quality reports. */ - sqs_report_rows?: number; - /** Number of mandatory columns that must be used in evaluation. */ - mandatory_columns?: number; - /** Enable or disable evaluation. */ - enabled?: boolean; - /** Number of quasi-identifiers to sample for privacy attacks. */ - quasi_identifier_count?: number; - /** Enable PII Replay detection. */ - pii_replay_enabled?: boolean; - /** List of entities for PII Replay. If not provided, default entities will be used. */ - pii_replay_entities?: string[]; - /** List of columns for PII Replay. If not provided, only entities will be used. */ - pii_replay_columns?: string[]; -} - -// ----- GenerateParameters ----- -/** - * Configuration parameters for synthetic data generation. - -These parameters control how synthetic data is generated after the model is trained. -They affect the quality, diversity, and validity of the generated synthetic records. - */ -export interface GenerateParameters { - /** Number of records to generate. */ - num_records?: number; - /** Sampling temperature for controlling randomness (higher = more random). */ - temperature?: number; - /** The value used to control the likelihood of the model repeating the same token. Must be > 0. */ - repetition_penalty?: number; - /** Nucleus sampling probability for token selection. Must be in (0, 1]. */ - top_p?: number; - /** Number of consecutive generations where the ``invalid_fraction_threshold`` is reached before stopping generation. Must be >= 1. */ - patience?: number; - /** The fraction of invalid records that will stop generation after the ``patience`` limit is reached. Must be in [0, 1]. */ - invalid_fraction_threshold?: number; - /** Whether to use structured generation for better format control. */ - use_structured_generation?: boolean; - /** The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend. */ - structured_generation_backend?: GenerateParametersStructuredGenerationBackend; - /** The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed. */ - structured_generation_schema_method?: GenerateParametersStructuredGenerationSchemaMethod; - /** Whether to use a regex that matches exactly one sequence or record if ``max_sequences_per_example`` is 1. */ - structured_generation_use_single_sequence?: boolean; - /** Enforce time-series fidelity by enforcing order, intervals, start and end times of the records. */ - enforce_timeseries_fidelity?: boolean; - /** Validation parameters controlling validation logic and automatic fixes when parsing LLM output and converting to tabular data. */ - validation?: ValidationParameters; - /** The attention backend for the vLLM engine. Common values: 'FLASHINFER', 'FLASH_ATTN', 'TRITON_ATTN', 'FLEX_ATTENTION'. If ``None`` or 'auto', vLLM will auto-select the best available backend. */ - attention_backend?: string; -} - -// ----- GenerateParametersStructuredGenerationBackend ----- -/** - * The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend. - */ -export type GenerateParametersStructuredGenerationBackend = - (typeof GenerateParametersStructuredGenerationBackend)[keyof typeof GenerateParametersStructuredGenerationBackend]; - -export const GenerateParametersStructuredGenerationBackend = { - auto: 'auto', - xgrammar: 'xgrammar', - guidance: 'guidance', - outlines: 'outlines', - 'lm-format-enforcer': 'lm-format-enforcer', -} as const; - -// ----- GenerateParametersStructuredGenerationSchemaMethod ----- -/** - * The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed. - */ -export type GenerateParametersStructuredGenerationSchemaMethod = - (typeof GenerateParametersStructuredGenerationSchemaMethod)[keyof typeof GenerateParametersStructuredGenerationSchemaMethod]; - -export const GenerateParametersStructuredGenerationSchemaMethod = { - regex: 'regex', - json_schema: 'json_schema', -} as const; - -// ----- GlinerConfig ----- -/** - * Configuration for the GLiNER named-entity recognition model. - */ -export interface GlinerConfig { - /** Enable GLiNER NER module. */ - enable_gliner?: boolean; - /** Enable GLiNER batch mode. */ - enable_batch_mode?: boolean; - /** GLiNER batch size. */ - batch_size?: number; - /** GLiNER batch chunk length in characters. */ - chunk_length?: number; - /** GLiNER model name. */ - gliner_model?: string; -} - -// ----- Globals ----- -/** - * Global settings for the PII replacer including locales, seed, NER, and classification. - */ -export interface Globals { - /** List of locales. */ - locales?: string[]; - /** Optional random seed. */ - seed?: number; - /** Column classification configuration. */ - classify?: ClassifyConfig; - /** Named Entity Recognition configuration. */ - ner?: NERConfig; - /** List of columns to preserve as immutable across all transformations. */ - lock_columns?: string[]; -} - -// ----- NERConfig ----- -/** - * Configuration for Named Entity Recognition. - */ -export interface NERConfig { - /** NER model threshold. */ - ner_threshold?: number; - /** Enable NER regular expressions (experimental). */ - enable_regexps?: boolean; - /** GLiNER NER configuration. */ - gliner?: GlinerConfig; - /** List of entity types to recognize. If unset, classification entity types are used. */ - ner_entities?: string[]; -} - -// ----- PiiReplacerConfig ----- -/** - * Configuration for PII replacer. - -Defines how PII data should be detected and replaced in a dataset. - */ -export interface PiiReplacerConfig { - /** Global configuration options. */ - globals?: Globals; - /** - * List of transformation steps to perform on input data. - * @minItems 1 - * @maxItems 10 - */ - steps: StepDefinition[]; -} - -// ----- Row ----- -/** - * Rule matcher for selecting rows by name, condition, entity, or type. - */ -export interface Row { - /** Row name. */ - name?: string | string[]; - /** Row condition match. */ - condition?: string; - /** Foreach expression. */ - foreach?: string; - /** Row value definition. */ - value?: string; - /** Row entity match. */ - entity?: string | string[]; - /** Row type match. */ - type?: string | string[]; - /** Row fallback value. */ - fallback_value?: string; - /** Rule description for human consumption. */ - description?: string; -} - -// ----- RowActions ----- -/** - * Container for row drop and update operations. - */ -export interface RowActions { - /** Rows to drop. */ - drop?: Row[]; - /** Rows to update. */ - update?: Row[]; -} - -// ----- StepDefinition ----- -/** - * Single transformation step with optional variables, column actions, and row actions. - */ -export interface StepDefinition { - /** Variable names and templates. */ - vars?: StepDefinitionVars; - /** Columns transform configuration. */ - columns?: ColumnActions; - /** Rows transform configurations. */ - rows?: RowActions; -} - -// ----- StepDefinitionVars ----- -/** - * Variable names and templates. - */ -export type StepDefinitionVars = { [key: string]: string | { [key: string]: unknown } | unknown[] }; - -// ----- TimeSeriesParameters ----- -/** - * Configuration for time-series mode in the Safe Synthesizer pipeline. - -Controls whether a dataset is treated as time-series data, including -timestamp column selection, interval inference, and format validation. -The time-series pipeline is currently experimental. - */ -export interface TimeSeriesParameters { - /** Whether to treat the dataset as time series. When enabled, either ``timestamp_column`` or ``timestamp_interval_seconds`` is required. For grouped time series, ``group_training_examples_by`` needs to be set. */ - is_timeseries?: boolean; - /** Name of the column containing timestamps used to order records when ``is_timeseries`` is ``True``. Required only when ``is_timeseries`` is ``True`` and ``timestamp_interval_seconds`` is not provided. */ - timestamp_column?: string; - /** Interval in seconds between timestamps. If not provided, the timestamp column will be used to infer the interval. */ - timestamp_interval_seconds?: number; - /** Format of the timestamp column. Accepts either: (1) Python strftime format codes for string timestamps (e.g., '%Y-%m-%d %H:%M:%S', '%m/%d/%Y'), or (2) 'elapsed_seconds' for numeric (int/float) timestamps representing seconds as an increasing counter (e.g., 0, 60, 120 for 1-minute intervals). If not provided, the format will be inferred from the data. */ - timestamp_format?: string; - /** Start timestamp. If not provided, the first timestamp in the timestamp column will be used. */ - start_timestamp?: string | number; - /** Stop timestamp. If not provided, the last timestamp in the timestamp column will be used. */ - stop_timestamp?: string | number; -} - -// ----- TrainingHyperparams ----- -/** - * Hyperparameters that control the training process behavior. - -This class contains all the fine-tuning hyperparameters that control how the model -learns, including learning rates, batch sizes, LoRA configuration, and optimization -settings. These parameters directly affect training performance and quality. - */ -export interface TrainingHyperparams { - /** Number of records the model will see during training. This parameter is a proxy for training time. For example, if its value is the same size as the input dataset, this is like training for a single epoch. If its value is larger, this is like training for multiple (possibly fractional) epochs. If its value is smaller, this is like training for a fraction of an epoch. Supports 'auto' where a reasonable value is chosen based on other config params and data. */ - num_input_records_to_sample?: 'auto' | number; - /** The batch size per device for training. Must be >= 1. */ - batch_size?: number; - /** Number of update steps to accumulate the gradients for, before performing a backward/update pass. This technique increases the effective batch size that will fit into GPU memory. Must be >= 1. */ - gradient_accumulation_steps?: number; - /** The weight decay to apply to all layers except all bias and LayerNorm weights in the AdamW optimizer. Must be in (0, 1). */ - weight_decay?: number; - /** Ratio of total training steps used for a linear warmup from 0 to the learning rate. Must be > 0. */ - warmup_ratio?: number; - /** The scheduler type to use. See the HuggingFace documentation of ``SchedulerType`` for all possible values. */ - lr_scheduler?: string; - /** The initial learning rate for `AdamW` optimizer. Must be in (0, 1). Setting to 'auto' uses a model-specific default if one exists. */ - learning_rate?: 'auto' | number; - /** The rank of the LoRA update matrices. Lower rank results in smaller update matrices with fewer trainable parameters. Must be > 0. */ - lora_r?: number; - /** The ratio of the LoRA scaling factor (alpha) to the LoRA rank. Empirically, this parameter works well when set to 0.5, 1, or 2. Must be in [0.5, 3]. */ - lora_alpha_over_r?: number; - /** The list of transformer modules to apply LoRA to. Possible modules: 'q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'. */ - lora_target_modules?: string[]; - /** Whether to use Unsloth for optimized training. */ - use_unsloth?: 'auto' | boolean; - /** Scale the base LLM's context length by this factor using RoPE scaling. Must be >= 1 or 'auto'. */ - rope_scaling_factor?: 'auto' | number; - /** The fraction of the training data used for validation. Must be in [0, 1]. If set to 0, no validation will be performed. If set larger than 0, validation loss will be computed and reported throughout training. */ - validation_ratio?: number; - /** The number of steps between validation checks for the HF Trainer arguments. Must be > 0. */ - validation_steps?: number; - /** Pretrained model to use for fine-tuning. Defaults to SmolLM3. May be a Hugging Face model ID (loaded from the Hugging Face Hub or cache) or a local path. See security note in docs before using untrusted sources. */ - pretrained_model?: string; - /** Whether to quantize the model during training. This can reduce memory usage and potentially speed up training, but may also impact model accuracy. */ - quantize_model?: boolean; - /** The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4. */ - quantization_bits?: TrainingHyperparamsQuantizationBits; - /** The PEFT (Parameter-Efficient Fine-Tuning) implementation to use. Options: 'lora' for Low-Rank Adaptation, 'QLORA' for Quantized LoRA. */ - peft_implementation?: string; - /** The fraction of the total VRAM to use for training. Modify this to allow longer sequences. Must be in [0, 1]. */ - max_vram_fraction?: number; - /** The attention implementation to use for model loading. Default uses Flash Attention 3 via the HuggingFace Kernels Hub (requires the 'kernels' pip package; falls back to 'sdpa' if the 'kernels' package is not installed). Other common values: 'flash_attention_2' (requires flash-attn pip package), 'sdpa' (PyTorch scaled dot product attention), 'eager' (standard PyTorch). Custom HuggingFace Kernels Hub paths (e.g. 'kernels-community/flash-attn2') are also supported. */ - attn_implementation?: string; -} - -// ----- TrainingHyperparamsQuantizationBits ----- -/** - * The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4. - */ -export type TrainingHyperparamsQuantizationBits = - (typeof TrainingHyperparamsQuantizationBits)[keyof typeof TrainingHyperparamsQuantizationBits]; - -export const TrainingHyperparamsQuantizationBits = { - NUMBER_4: 4, - NUMBER_8: 8, -} as const; - -// ----- ValidationParameters ----- -/** - * Configuration for record and sequence validation. - -These parameters control the validation and automatic fixes when going -from LLM output to tabular data. - */ -export interface ValidationParameters { - /** Whether to accept completions without both beginning and end of sequence delineators as a single sequence. */ - group_by_accept_no_delineator?: boolean; - /** Whether to ignore invalid records in a sequence and proceed with the valid records. */ - group_by_ignore_invalid_records?: boolean; - /** Whether to automatically fix non-unique group-by values in a sequence by using the first unique value for all records. */ - group_by_fix_non_unique_value?: boolean; - /** Whether to automatically fix unordered records in a sequence by sorting the records. */ - group_by_fix_unordered_records?: boolean; -} diff --git a/web/packages/sdk/vendored/safe-synthesizer/zod.ts b/web/packages/sdk/vendored/safe-synthesizer/zod.ts deleted file mode 100644 index 72b18d4941..0000000000 --- a/web/packages/sdk/vendored/safe-synthesizer/zod.ts +++ /dev/null @@ -1,4119 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -// TEMP: SafeSynthesizer zod schemas inlined while the safe-synthesizer SDK is being rebuilt. -// Source: @nemo/sdk/generated/platform/zod/safe-synthesizer.ts (verbatim copy). -// Restore SDK imports once the SDK regenerates with safe-synthesizer support. - -/* eslint-disable */ -// Verbatim copy of generated code; eslint suppressed (typecheck still runs). - -import * as zod from 'zod'; - -/** - * @summary Create Job - */ -export const SafeSynthesizerCreateJobParams = zod.object({ - workspace: zod.string(), -}); - -export const safeSynthesizerCreateJobBodySpecConfigOneDataOneMaxSequencesPerExampleDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneDataOneHoldoutDefault = 0.05; -export const safeSynthesizerCreateJobBodySpecConfigOneDataOneMaxHoldoutDefault = 2000; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneMiaEnabledDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneAiaEnabledDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneSqsReportColumnsDefault = 250; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneSqsReportRowsDefault = 5000; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneEnabledDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneQuasiIdentifierCountDefault = 3; -export const safeSynthesizerCreateJobBodySpecConfigOneEvaluationOnePiiReplayEnabledDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneNumInputRecordsToSampleDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneBatchSizeDefault = 1; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneGradientAccumulationStepsDefault = 8; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneWeightDecayDefault = 0.01; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneWarmupRatioDefault = 0.05; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLrSchedulerDefault = `cosine`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLearningRateDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraRDefault = 32; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraAlphaOverRDefault = 1; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraTargetModulesDefault = [ - `q_proj`, - `k_proj`, - `v_proj`, - `o_proj`, -]; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneUseUnslothDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneRopeScalingFactorDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneValidationRatioDefault = 0; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneValidationStepsDefault = 15; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOnePretrainedModelDefault = `HuggingFaceTB/SmolLM3-3B`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneQuantizeModelDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneQuantizationBitsDefault = 8; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOnePeftImplementationDefault = `QLORA`; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneMaxVramFractionDefault = 0.8; -export const safeSynthesizerCreateJobBodySpecConfigOneTrainingOneAttnImplementationDefault = `kernels-community/vllm-flash-attn3`; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneNumRecordsDefault = 1000; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneTemperatureDefault = 0.9; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneRepetitionPenaltyDefault = 1; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneTopPDefault = 1; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOnePatienceDefault = 3; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneInvalidFractionThresholdDefault = 0.8; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneUseStructuredGenerationDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationBackendDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault = `regex`; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneGenerationOneAttentionBackendDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneDpEnabledDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneEpsilonDefault = 8; -export const safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneDeltaDefault = `auto`; -export const safeSynthesizerCreateJobBodySpecConfigOnePrivacyOnePerSampleMaxGradNormDefault = 1; -export const safeSynthesizerCreateJobBodySpecConfigOneTimeSeriesOneIsTimeseriesDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault = 3; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneClassifyDefault = { - num_samples: 3, -}; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault = 0.3; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault = false; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault = true; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault = 8; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault = 512; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault = `nvidia/gliner-PII`; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault = { - enable_gliner: true, - enable_batch_mode: true, - batch_size: 8, - chunk_length: 512, - gliner_model: 'nvidia/gliner-PII', -}; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerDefault = { - ner_threshold: 0.3, - enable_regexps: false, -}; -export const safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneStepsMax = 10; - -export const safeSynthesizerCreateJobBodySpecEnableSynthesisDefault = true; - -export const SafeSynthesizerCreateJobBody = zod.object({ - name: zod.string().optional(), - description: zod.string().optional(), - project: zod.string().optional(), - spec: zod - .object({ - data_source: zod.string().describe('The data source for the job.'), - config: zod - .object({ - data: zod - .object({ - group_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to group training examples by. This is useful when you want the model to learn inter-record correlations for a given grouping of records.' - ), - order_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to order training examples by. This is useful when you want the model to learn sequential relationships for a given ordering of records. If you provide this parameter, you must also provide ``group_training_examples_by``.' - ), - max_sequences_per_example: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCreateJobBodySpecConfigOneDataOneMaxSequencesPerExampleDefault - ) - .describe( - "If specified, adds at most this number of sequences per example. Supports 'auto' where a value of 1 is chosen if differential privacy is enabled, and 10 otherwise. If not specified or set to 'auto', fills up context. Required for DP to limit contribution of each example." - ), - holdout: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneDataOneHoldoutDefault) - .describe( - 'Amount of records to hold out for evaluation. If this is a float between 0 and 1, that ratio of records is held out. If an integer greater than 1, that number of records is held out. If the value is equal to zero, no holdout will be performed. Must be >= 0.' - ), - max_holdout: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneDataOneMaxHoldoutDefault) - .describe( - 'Maximum number of records to hold out. Overrides any behavior set by ``holdout``. Must be >= 0.' - ), - random_state: zod - .number() - .optional() - .describe('Random state for holdout split to ensure reproducibility.'), - }) - .describe( - 'Configuration for grouping, ordering, and splitting input data for training and evaluation.' - ) - .optional() - .describe( - 'Configuration controlling how input data is grouped and split for training and evaluation.' - ), - evaluation: zod - .object({ - mia_enabled: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneMiaEnabledDefault) - .describe('Enable membership inference attack evaluation for privacy assessment.'), - aia_enabled: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneAiaEnabledDefault) - .describe('Enable attribute inference attack evaluation for privacy assessment.'), - sqs_report_columns: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneSqsReportColumnsDefault - ) - .describe('Number of columns to include in statistical quality reports.'), - sqs_report_rows: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneSqsReportRowsDefault) - .describe('Number of rows to include in statistical quality reports.'), - mandatory_columns: zod - .number() - .optional() - .describe('Number of mandatory columns that must be used in evaluation.'), - enabled: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneEnabledDefault) - .describe('Enable or disable evaluation.'), - quasi_identifier_count: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneEvaluationOneQuasiIdentifierCountDefault - ) - .describe('Number of quasi-identifiers to sample for privacy attacks.'), - pii_replay_enabled: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneEvaluationOnePiiReplayEnabledDefault - ) - .describe('Enable PII Replay detection.'), - pii_replay_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entities for PII Replay. If not provided, default entities will be used.' - ), - pii_replay_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns for PII Replay. If not provided, only entities will be used.' - ), - }) - .describe( - 'Configuration for evaluating synthetic data quality and privacy.\n\nThis class controls which evaluation metrics are computed and how they are configured.\nIt includes privacy attack evaluations, statistical quality metrics, and downstream\nmachine learning performance assessments.' - ) - .optional() - .describe('Parameters for evaluating the quality of generated synthetic data.'), - training: zod - .object({ - num_input_records_to_sample: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneNumInputRecordsToSampleDefault - ) - .describe( - "Number of records the model will see during training. This parameter is a proxy for training time. For example, if its value is the same size as the input dataset, this is like training for a single epoch. If its value is larger, this is like training for multiple (possibly fractional) epochs. If its value is smaller, this is like training for a fraction of an epoch. Supports 'auto' where a reasonable value is chosen based on other config params and data." - ), - batch_size: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneBatchSizeDefault) - .describe('The batch size per device for training. Must be >= 1.'), - gradient_accumulation_steps: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneGradientAccumulationStepsDefault - ) - .describe( - 'Number of update steps to accumulate the gradients for, before performing a backward\/update pass. This technique increases the effective batch size that will fit into GPU memory. Must be >= 1.' - ), - weight_decay: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneWeightDecayDefault) - .describe( - 'The weight decay to apply to all layers except all bias and LayerNorm weights in the AdamW optimizer. Must be in (0, 1).' - ), - warmup_ratio: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneWarmupRatioDefault) - .describe( - 'Ratio of total training steps used for a linear warmup from 0 to the learning rate. Must be > 0.' - ), - lr_scheduler: zod - .string() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLrSchedulerDefault) - .describe( - 'The scheduler type to use. See the HuggingFace documentation of ``SchedulerType`` for all possible values.' - ), - learning_rate: zod - .union([zod.literal('auto'), zod.number()]) - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLearningRateDefault) - .describe( - "The initial learning rate for `AdamW` optimizer. Must be in (0, 1). Setting to 'auto' uses a model-specific default if one exists." - ), - lora_r: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraRDefault) - .describe( - 'The rank of the LoRA update matrices. Lower rank results in smaller update matrices with fewer trainable parameters. Must be > 0.' - ), - lora_alpha_over_r: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraAlphaOverRDefault) - .describe( - 'The ratio of the LoRA scaling factor (alpha) to the LoRA rank. Empirically, this parameter works well when set to 0.5, 1, or 2. Must be in [0.5, 3].' - ), - lora_target_modules: zod - .array(zod.string()) - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneLoraTargetModulesDefault - ) - .describe( - "The list of transformer modules to apply LoRA to. Possible modules: 'q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'." - ), - use_unsloth: zod - .union([zod.literal('auto'), zod.boolean()]) - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneUseUnslothDefault) - .describe('Whether to use Unsloth for optimized training.'), - rope_scaling_factor: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneRopeScalingFactorDefault - ) - .describe( - "Scale the base LLM's context length by this factor using RoPE scaling. Must be >= 1 or 'auto'." - ), - validation_ratio: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneValidationRatioDefault) - .describe( - 'The fraction of the training data used for validation. Must be in [0, 1]. If set to 0, no validation will be performed. If set larger than 0, validation loss will be computed and reported throughout training.' - ), - validation_steps: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneValidationStepsDefault) - .describe( - 'The number of steps between validation checks for the HF Trainer arguments. Must be > 0.' - ), - pretrained_model: zod - .string() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOnePretrainedModelDefault) - .describe( - 'Pretrained model to use for fine-tuning. Defaults to SmolLM3. May be a Hugging Face model ID (loaded from the Hugging Face Hub or cache) or a local path. See security note in docs before using untrusted sources.' - ), - quantize_model: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneQuantizeModelDefault) - .describe( - 'Whether to quantize the model during training. This can reduce memory usage and potentially speed up training, but may also impact model accuracy.' - ), - quantization_bits: zod - .union([zod.literal(4), zod.literal(8)]) - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneQuantizationBitsDefault - ) - .describe( - 'The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4.' - ), - peft_implementation: zod - .string() - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOnePeftImplementationDefault - ) - .describe( - "The PEFT (Parameter-Efficient Fine-Tuning) implementation to use. Options: 'lora' for Low-Rank Adaptation, 'QLORA' for Quantized LoRA." - ), - max_vram_fraction: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneTrainingOneMaxVramFractionDefault) - .describe( - 'The fraction of the total VRAM to use for training. Modify this to allow longer sequences. Must be in [0, 1].' - ), - attn_implementation: zod - .string() - .default( - safeSynthesizerCreateJobBodySpecConfigOneTrainingOneAttnImplementationDefault - ) - .describe( - "The attention implementation to use for model loading. Default uses Flash Attention 3 via the HuggingFace Kernels Hub (requires the 'kernels' pip package; falls back to 'sdpa' if the 'kernels' package is not installed). Other common values: 'flash_attention_2' (requires flash-attn pip package), 'sdpa' (PyTorch scaled dot product attention), 'eager' (standard PyTorch). Custom HuggingFace Kernels Hub paths (e.g. 'kernels-community\/flash-attn2') are also supported." - ), - }) - .describe( - 'Hyperparameters that control the training process behavior.\n\nThis class contains all the fine-tuning hyperparameters that control how the model\nlearns, including learning rates, batch sizes, LoRA configuration, and optimization\nsettings. These parameters directly affect training performance and quality.' - ) - .optional() - .describe( - 'Hyperparameters for model training such as learning rate, batch size, and LoRA adapter settings.' - ), - generation: zod - .object({ - num_records: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneGenerationOneNumRecordsDefault) - .describe('Number of records to generate.'), - temperature: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneGenerationOneTemperatureDefault) - .describe( - 'Sampling temperature for controlling randomness (higher = more random).' - ), - repetition_penalty: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneRepetitionPenaltyDefault - ) - .describe( - 'The value used to control the likelihood of the model repeating the same token. Must be > 0.' - ), - top_p: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneGenerationOneTopPDefault) - .describe('Nucleus sampling probability for token selection. Must be in (0, 1].'), - patience: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOneGenerationOnePatienceDefault) - .describe( - 'Number of consecutive generations where the ``invalid_fraction_threshold`` is reached before stopping generation. Must be >= 1.' - ), - invalid_fraction_threshold: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneInvalidFractionThresholdDefault - ) - .describe( - 'The fraction of invalid records that will stop generation after the ``patience`` limit is reached. Must be in [0, 1].' - ), - use_structured_generation: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneUseStructuredGenerationDefault - ) - .describe('Whether to use structured generation for better format control.'), - structured_generation_backend: zod - .enum(['auto', 'xgrammar', 'guidance', 'outlines', 'lm-format-enforcer']) - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationBackendDefault - ) - .describe( - "The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend." - ), - structured_generation_schema_method: zod - .enum(['regex', 'json_schema']) - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault - ) - .describe( - "The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed." - ), - structured_generation_use_single_sequence: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault - ) - .describe( - 'Whether to use a regex that matches exactly one sequence or record if ``max_sequences_per_example`` is 1.' - ), - enforce_timeseries_fidelity: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault - ) - .describe( - 'Enforce time-series fidelity by enforcing order, intervals, start and end times of the records.' - ), - validation: zod - .object({ - group_by_accept_no_delineator: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault - ) - .describe( - 'Whether to accept completions without both beginning and end of sequence delineators as a single sequence.' - ), - group_by_ignore_invalid_records: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault - ) - .describe( - 'Whether to ignore invalid records in a sequence and proceed with the valid records.' - ), - group_by_fix_non_unique_value: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault - ) - .describe( - 'Whether to automatically fix non-unique group-by values in a sequence by using the first unique value for all records.' - ), - group_by_fix_unordered_records: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault - ) - .describe( - 'Whether to automatically fix unordered records in a sequence by sorting the records.' - ), - }) - .describe( - 'Configuration for record and sequence validation.\n\nThese parameters control the validation and automatic fixes when going\nfrom LLM output to tabular data.' - ) - .optional() - .describe( - 'Validation parameters controlling validation logic and automatic fixes when parsing LLM output and converting to tabular data.' - ), - attention_backend: zod - .string() - .default( - safeSynthesizerCreateJobBodySpecConfigOneGenerationOneAttentionBackendDefault - ) - .describe( - "The attention backend for the vLLM engine. Common values: 'FLASHINFER', 'FLASH_ATTN', 'TRITON_ATTN', 'FLEX_ATTENTION'. If ``None`` or 'auto', vLLM will auto-select the best available backend." - ), - }) - .describe( - 'Configuration parameters for synthetic data generation.\n\nThese parameters control how synthetic data is generated after the model is trained.\nThey affect the quality, diversity, and validity of the generated synthetic records.' - ) - .optional() - .describe( - 'Parameters governing synthetic data generation including temperature, top-p, and number of records to produce.' - ), - privacy: zod - .object({ - dp_enabled: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneDpEnabledDefault) - .describe('Enable differentially-private training with DP-SGD.'), - epsilon: zod - .number() - .default(safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneEpsilonDefault) - .describe( - 'Target privacy budget -- lower values provide stronger privacy. Must be > 0.' - ), - delta: zod - .union([zod.literal('auto'), zod.number()]) - .default(safeSynthesizerCreateJobBodySpecConfigOnePrivacyOneDeltaDefault) - .describe( - "Probability of accidentally leaking information. Should be much smaller than 1\/n where n is the number of training records. Setting to 'auto' uses delta of 1\/n^1.2. Must be in [0, 1) or 'auto'." - ), - per_sample_max_grad_norm: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOnePrivacyOnePerSampleMaxGradNormDefault - ) - .describe('Maximum L2 norm for per-sample gradient clipping. Must be > 0.'), - }) - .describe( - 'Hyperparameters for differential privacy during training.\n\nThese parameters configure differential privacy (DP) training using DP-SGD algorithm.\nWhen enabled, they provide formal privacy guarantees by adding calibrated noise\nduring training.' - ) - .optional() - .describe( - 'Differential-privacy hyperparameters. When ``None``, differential privacy is disabled entirely.' - ), - time_series: zod - .object({ - is_timeseries: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecConfigOneTimeSeriesOneIsTimeseriesDefault) - .describe( - 'Whether to treat the dataset as time series. When enabled, either ``timestamp_column`` or ``timestamp_interval_seconds`` is required. For grouped time series, ``group_training_examples_by`` needs to be set.' - ), - timestamp_column: zod - .string() - .optional() - .describe( - 'Name of the column containing timestamps used to order records when ``is_timeseries`` is ``True``. Required only when ``is_timeseries`` is ``True`` and ``timestamp_interval_seconds`` is not provided.' - ), - timestamp_interval_seconds: zod - .number() - .optional() - .describe( - 'Interval in seconds between timestamps. If not provided, the timestamp column will be used to infer the interval.' - ), - timestamp_format: zod - .string() - .optional() - .describe( - "Format of the timestamp column. Accepts either: (1) Python strftime format codes for string timestamps (e.g., '%Y-%m-%d %H:%M:%S', '%m\/%d\/%Y'), or (2) 'elapsed_seconds' for numeric (int\/float) timestamps representing seconds as an increasing counter (e.g., 0, 60, 120 for 1-minute intervals). If not provided, the format will be inferred from the data." - ), - start_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Start timestamp. If not provided, the first timestamp in the timestamp column will be used.' - ), - stop_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Stop timestamp. If not provided, the last timestamp in the timestamp column will be used.' - ), - }) - .describe( - 'Configuration for time-series mode in the Safe Synthesizer pipeline.\n\nControls whether a dataset is treated as time-series data, including\ntimestamp column selection, interval inference, and format validation.\nThe time-series pipeline is currently experimental.' - ) - .optional() - .describe( - 'Configuration for time-series mode. Time-series pipeline is currently experimental.' - ), - replace_pii: zod - .object({ - globals: zod - .object({ - locales: zod.array(zod.string()).optional().describe('List of locales.'), - seed: zod.number().optional().describe('Optional random seed.'), - classify: zod - .object({ - enable_classify: zod - .boolean() - .optional() - .describe('Enable column classification.'), - entities: zod - .array(zod.string()) - .optional() - .describe('List of entity types to classify.'), - num_samples: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault - ) - .describe('Number of column values to sample for classification.'), - classify_model_provider: zod - .string() - .optional() - .describe( - 'Name of the model provider in the Inference Gateway for column classification. The job compiler will resolve this to the appropriate endpoint URL.' - ), - }) - .describe('Configuration for column classification using an LLM.') - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneClassifyDefault - ) - .describe('Column classification configuration.'), - ner: zod - .object({ - ner_threshold: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault - ) - .describe('NER model threshold.'), - enable_regexps: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault - ) - .describe('Enable NER regular expressions (experimental).'), - gliner: zod - .object({ - enable_gliner: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault - ) - .describe('Enable GLiNER NER module.'), - enable_batch_mode: zod - .boolean() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault - ) - .describe('Enable GLiNER batch mode.'), - batch_size: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault - ) - .describe('GLiNER batch size.'), - chunk_length: zod - .number() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault - ) - .describe('GLiNER batch chunk length in characters.'), - gliner_model: zod - .string() - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault - ) - .describe('GLiNER model name.'), - }) - .describe('Configuration for the GLiNER named-entity recognition model.') - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault - ) - .describe('GLiNER NER configuration.'), - ner_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entity types to recognize. If unset, classification entity types are used.' - ), - }) - .describe('Configuration for Named Entity Recognition.') - .default( - safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneGlobalsOneNerDefault - ) - .describe('Named Entity Recognition configuration.'), - lock_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns to preserve as immutable across all transformations.' - ), - }) - .describe( - 'Global settings for the PII replacer including locales, seed, NER, and classification.' - ) - .optional() - .describe('Global configuration options.'), - steps: zod - .array( - zod - .object({ - vars: zod - .record( - zod.string(), - zod.union([ - zod.string(), - zod.record(zod.string(), zod.unknown()), - zod.array(zod.unknown()), - ]) - ) - .optional() - .describe('Variable names and templates.'), - columns: zod - .object({ - add: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to add.'), - drop: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to drop.'), - rename: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to rename.'), - }) - .describe('Container for column add, drop, and rename operations.') - .optional() - .describe('Columns transform configuration.'), - rows: zod - .object({ - drop: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to drop.'), - update: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to update.'), - }) - .describe('Container for row drop and update operations.') - .optional() - .describe('Rows transform configurations.'), - }) - .describe( - 'Single transformation step with optional variables, column actions, and row actions.' - ) - ) - .min(1) - .max(safeSynthesizerCreateJobBodySpecConfigOneReplacePiiOneStepsMax) - .describe('List of transformation steps to perform on input data.'), - }) - .describe( - 'Configuration for PII replacer.\n\nDefines how PII data should be detected and replaced in a dataset.' - ) - .optional() - .describe('PII replacement configuration. When ``None``, PII replacement is skipped.'), - }) - .describe( - 'Main configuration class for the Safe Synthesizer pipeline.\n\nThis is the top-level configuration class that orchestrates all aspects of\nsynthetic data generation including training, generation, privacy, evaluation,\nand data handling. It provides validation to ensure parameter compatibility.' - ) - .describe('The Safe Synthesizer parameters configuration.'), - hf_token_secret: zod - .string() - .optional() - .describe( - 'Name of platform secret containing the HuggingFace token. Must exist in the same workspace as the job.' - ), - enable_synthesis: zod - .boolean() - .default(safeSynthesizerCreateJobBodySpecEnableSynthesisDefault) - .describe( - 'Whether to run LLM training and generation phases. When False the task only performs PII replacement and returns the processed data.' - ), - }) - .describe( - 'Configuration model for Safe Synthesizer jobs.\n\nUsed primarily internally to configure a run submitted to the NeMo Jobs\nMicroservice.' - ), - ownership: zod.record(zod.string(), zod.unknown()).optional(), - custom_fields: zod.record(zod.string(), zod.unknown()).optional(), -}); - -/** - * @summary List Jobs - */ -export const SafeSynthesizerListJobsParams = zod.object({ - workspace: zod.string(), -}); - -export const safeSynthesizerListJobsQueryPageDefault = 1; -export const safeSynthesizerListJobsQueryPageExclusiveMin = 0; - -export const safeSynthesizerListJobsQueryPageSizeDefault = 10; -export const safeSynthesizerListJobsQueryPageSizeExclusiveMin = 0; - -export const safeSynthesizerListJobsQuerySortDefault = `-created_at`; - -export const SafeSynthesizerListJobsQueryParams = zod.object({ - page: zod - .number() - .gt(safeSynthesizerListJobsQueryPageExclusiveMin) - .default(safeSynthesizerListJobsQueryPageDefault) - .describe('Page number.'), - page_size: zod - .number() - .gt(safeSynthesizerListJobsQueryPageSizeExclusiveMin) - .default(safeSynthesizerListJobsQueryPageSizeDefault) - .describe('Page size.'), - sort: zod - .enum(['created_at', '-created_at', 'updated_at', '-updated_at']) - .default(safeSynthesizerListJobsQuerySortDefault) - .describe( - 'The field to sort by. To sort in decreasing order, use `-` in front of the field name.' - ), - filter: zod - .object({ - created_at: zod - .object({ - $gte: zod - .string() - .optional() - .describe('Filter for results greater than or equal to this datetime.'), - $lte: zod - .string() - .optional() - .describe('Filter for results less than or equal to this datetime.'), - }) - .optional() - .describe("Jobs created at 'gte' datetime or 'lte' datetime."), - name: zod.string().optional().describe('Name of the job.'), - workspace: zod.string().optional().describe('Workspace of the job.'), - project: zod.string().optional().describe('Project containing the job.'), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ) - .optional() - .describe('The current status.'), - updated_at: zod - .object({ - $gte: zod - .string() - .optional() - .describe('Filter for results greater than or equal to this datetime.'), - $lte: zod - .string() - .optional() - .describe('Filter for results less than or equal to this datetime.'), - }) - .optional() - .describe("Jobs updated at 'gte' datetime or 'lte' datetime."), - }) - .optional() - .describe('Filter jobs on various criteria.'), -}); - -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneMaxSequencesPerExampleDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneHoldoutDefault = 0.05; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneMaxHoldoutDefault = 2000; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneMiaEnabledDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneAiaEnabledDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneSqsReportColumnsDefault = 250; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneSqsReportRowsDefault = 5000; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneEnabledDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneQuasiIdentifierCountDefault = 3; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOnePiiReplayEnabledDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneNumInputRecordsToSampleDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneBatchSizeDefault = 1; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneGradientAccumulationStepsDefault = 8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneWeightDecayDefault = 0.01; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneWarmupRatioDefault = 0.05; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLrSchedulerDefault = `cosine`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLearningRateDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraRDefault = 32; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraAlphaOverRDefault = 1; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraTargetModulesDefault = - [`q_proj`, `k_proj`, `v_proj`, `o_proj`]; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneUseUnslothDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneRopeScalingFactorDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneValidationRatioDefault = 0; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneValidationStepsDefault = 15; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOnePretrainedModelDefault = `HuggingFaceTB/SmolLM3-3B`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneQuantizeModelDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneQuantizationBitsDefault = 8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOnePeftImplementationDefault = `QLORA`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneMaxVramFractionDefault = 0.8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneAttnImplementationDefault = `kernels-community/vllm-flash-attn3`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneNumRecordsDefault = 1000; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneTemperatureDefault = 0.9; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneRepetitionPenaltyDefault = 1; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneTopPDefault = 1; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOnePatienceDefault = 3; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneInvalidFractionThresholdDefault = 0.8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneUseStructuredGenerationDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationBackendDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault = `regex`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneAttentionBackendDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneDpEnabledDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneEpsilonDefault = 8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneDeltaDefault = `auto`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault = 1; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneTimeSeriesOneIsTimeseriesDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault = 3; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault = - { num_samples: 3 }; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault = 0.3; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault = false; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault = true; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault = 8; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault = 512; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault = `nvidia/gliner-PII`; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault = - { - enable_gliner: true, - enable_batch_mode: true, - batch_size: 8, - chunk_length: 512, - gliner_model: 'nvidia/gliner-PII', - }; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerDefault = - { ner_threshold: 0.3, enable_regexps: false }; -export const safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneStepsMax = 10; - -export const safeSynthesizerListJobsResponseDataItemSpecEnableSynthesisDefault = true; - -export const SafeSynthesizerListJobsResponse = zod.object({ - data: zod.array( - zod.object({ - id: zod.string().optional(), - name: zod.string(), - description: zod.string().optional(), - project: zod.string().optional(), - workspace: zod.string().optional(), - created_at: zod.string().optional(), - updated_at: zod.string().optional(), - spec: zod - .object({ - data_source: zod.string().describe('The data source for the job.'), - config: zod - .object({ - data: zod - .object({ - group_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to group training examples by. This is useful when you want the model to learn inter-record correlations for a given grouping of records.' - ), - order_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to order training examples by. This is useful when you want the model to learn sequential relationships for a given ordering of records. If you provide this parameter, you must also provide ``group_training_examples_by``.' - ), - max_sequences_per_example: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneMaxSequencesPerExampleDefault - ) - .describe( - "If specified, adds at most this number of sequences per example. Supports 'auto' where a value of 1 is chosen if differential privacy is enabled, and 10 otherwise. If not specified or set to 'auto', fills up context. Required for DP to limit contribution of each example." - ), - holdout: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneHoldoutDefault - ) - .describe( - 'Amount of records to hold out for evaluation. If this is a float between 0 and 1, that ratio of records is held out. If an integer greater than 1, that number of records is held out. If the value is equal to zero, no holdout will be performed. Must be >= 0.' - ), - max_holdout: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneDataOneMaxHoldoutDefault - ) - .describe( - 'Maximum number of records to hold out. Overrides any behavior set by ``holdout``. Must be >= 0.' - ), - random_state: zod - .number() - .optional() - .describe('Random state for holdout split to ensure reproducibility.'), - }) - .describe( - 'Configuration for grouping, ordering, and splitting input data for training and evaluation.' - ) - .optional() - .describe( - 'Configuration controlling how input data is grouped and split for training and evaluation.' - ), - evaluation: zod - .object({ - mia_enabled: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneMiaEnabledDefault - ) - .describe( - 'Enable membership inference attack evaluation for privacy assessment.' - ), - aia_enabled: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneAiaEnabledDefault - ) - .describe( - 'Enable attribute inference attack evaluation for privacy assessment.' - ), - sqs_report_columns: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneSqsReportColumnsDefault - ) - .describe('Number of columns to include in statistical quality reports.'), - sqs_report_rows: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneSqsReportRowsDefault - ) - .describe('Number of rows to include in statistical quality reports.'), - mandatory_columns: zod - .number() - .optional() - .describe('Number of mandatory columns that must be used in evaluation.'), - enabled: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneEnabledDefault - ) - .describe('Enable or disable evaluation.'), - quasi_identifier_count: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOneQuasiIdentifierCountDefault - ) - .describe('Number of quasi-identifiers to sample for privacy attacks.'), - pii_replay_enabled: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneEvaluationOnePiiReplayEnabledDefault - ) - .describe('Enable PII Replay detection.'), - pii_replay_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entities for PII Replay. If not provided, default entities will be used.' - ), - pii_replay_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns for PII Replay. If not provided, only entities will be used.' - ), - }) - .describe( - 'Configuration for evaluating synthetic data quality and privacy.\n\nThis class controls which evaluation metrics are computed and how they are configured.\nIt includes privacy attack evaluations, statistical quality metrics, and downstream\nmachine learning performance assessments.' - ) - .optional() - .describe('Parameters for evaluating the quality of generated synthetic data.'), - training: zod - .object({ - num_input_records_to_sample: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneNumInputRecordsToSampleDefault - ) - .describe( - "Number of records the model will see during training. This parameter is a proxy for training time. For example, if its value is the same size as the input dataset, this is like training for a single epoch. If its value is larger, this is like training for multiple (possibly fractional) epochs. If its value is smaller, this is like training for a fraction of an epoch. Supports 'auto' where a reasonable value is chosen based on other config params and data." - ), - batch_size: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneBatchSizeDefault - ) - .describe('The batch size per device for training. Must be >= 1.'), - gradient_accumulation_steps: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneGradientAccumulationStepsDefault - ) - .describe( - 'Number of update steps to accumulate the gradients for, before performing a backward\/update pass. This technique increases the effective batch size that will fit into GPU memory. Must be >= 1.' - ), - weight_decay: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneWeightDecayDefault - ) - .describe( - 'The weight decay to apply to all layers except all bias and LayerNorm weights in the AdamW optimizer. Must be in (0, 1).' - ), - warmup_ratio: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneWarmupRatioDefault - ) - .describe( - 'Ratio of total training steps used for a linear warmup from 0 to the learning rate. Must be > 0.' - ), - lr_scheduler: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLrSchedulerDefault - ) - .describe( - 'The scheduler type to use. See the HuggingFace documentation of ``SchedulerType`` for all possible values.' - ), - learning_rate: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLearningRateDefault - ) - .describe( - "The initial learning rate for `AdamW` optimizer. Must be in (0, 1). Setting to 'auto' uses a model-specific default if one exists." - ), - lora_r: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraRDefault - ) - .describe( - 'The rank of the LoRA update matrices. Lower rank results in smaller update matrices with fewer trainable parameters. Must be > 0.' - ), - lora_alpha_over_r: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraAlphaOverRDefault - ) - .describe( - 'The ratio of the LoRA scaling factor (alpha) to the LoRA rank. Empirically, this parameter works well when set to 0.5, 1, or 2. Must be in [0.5, 3].' - ), - lora_target_modules: zod - .array(zod.string()) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneLoraTargetModulesDefault - ) - .describe( - "The list of transformer modules to apply LoRA to. Possible modules: 'q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'." - ), - use_unsloth: zod - .union([zod.literal('auto'), zod.boolean()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneUseUnslothDefault - ) - .describe('Whether to use Unsloth for optimized training.'), - rope_scaling_factor: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneRopeScalingFactorDefault - ) - .describe( - "Scale the base LLM's context length by this factor using RoPE scaling. Must be >= 1 or 'auto'." - ), - validation_ratio: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneValidationRatioDefault - ) - .describe( - 'The fraction of the training data used for validation. Must be in [0, 1]. If set to 0, no validation will be performed. If set larger than 0, validation loss will be computed and reported throughout training.' - ), - validation_steps: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneValidationStepsDefault - ) - .describe( - 'The number of steps between validation checks for the HF Trainer arguments. Must be > 0.' - ), - pretrained_model: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOnePretrainedModelDefault - ) - .describe( - 'Pretrained model to use for fine-tuning. Defaults to SmolLM3. May be a Hugging Face model ID (loaded from the Hugging Face Hub or cache) or a local path. See security note in docs before using untrusted sources.' - ), - quantize_model: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneQuantizeModelDefault - ) - .describe( - 'Whether to quantize the model during training. This can reduce memory usage and potentially speed up training, but may also impact model accuracy.' - ), - quantization_bits: zod - .union([zod.literal(4), zod.literal(8)]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneQuantizationBitsDefault - ) - .describe( - 'The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4.' - ), - peft_implementation: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOnePeftImplementationDefault - ) - .describe( - "The PEFT (Parameter-Efficient Fine-Tuning) implementation to use. Options: 'lora' for Low-Rank Adaptation, 'QLORA' for Quantized LoRA." - ), - max_vram_fraction: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneMaxVramFractionDefault - ) - .describe( - 'The fraction of the total VRAM to use for training. Modify this to allow longer sequences. Must be in [0, 1].' - ), - attn_implementation: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTrainingOneAttnImplementationDefault - ) - .describe( - "The attention implementation to use for model loading. Default uses Flash Attention 3 via the HuggingFace Kernels Hub (requires the 'kernels' pip package; falls back to 'sdpa' if the 'kernels' package is not installed). Other common values: 'flash_attention_2' (requires flash-attn pip package), 'sdpa' (PyTorch scaled dot product attention), 'eager' (standard PyTorch). Custom HuggingFace Kernels Hub paths (e.g. 'kernels-community\/flash-attn2') are also supported." - ), - }) - .describe( - 'Hyperparameters that control the training process behavior.\n\nThis class contains all the fine-tuning hyperparameters that control how the model\nlearns, including learning rates, batch sizes, LoRA configuration, and optimization\nsettings. These parameters directly affect training performance and quality.' - ) - .optional() - .describe( - 'Hyperparameters for model training such as learning rate, batch size, and LoRA adapter settings.' - ), - generation: zod - .object({ - num_records: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneNumRecordsDefault - ) - .describe('Number of records to generate.'), - temperature: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneTemperatureDefault - ) - .describe( - 'Sampling temperature for controlling randomness (higher = more random).' - ), - repetition_penalty: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneRepetitionPenaltyDefault - ) - .describe( - 'The value used to control the likelihood of the model repeating the same token. Must be > 0.' - ), - top_p: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneTopPDefault - ) - .describe( - 'Nucleus sampling probability for token selection. Must be in (0, 1].' - ), - patience: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOnePatienceDefault - ) - .describe( - 'Number of consecutive generations where the ``invalid_fraction_threshold`` is reached before stopping generation. Must be >= 1.' - ), - invalid_fraction_threshold: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneInvalidFractionThresholdDefault - ) - .describe( - 'The fraction of invalid records that will stop generation after the ``patience`` limit is reached. Must be in [0, 1].' - ), - use_structured_generation: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneUseStructuredGenerationDefault - ) - .describe('Whether to use structured generation for better format control.'), - structured_generation_backend: zod - .enum(['auto', 'xgrammar', 'guidance', 'outlines', 'lm-format-enforcer']) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationBackendDefault - ) - .describe( - "The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend." - ), - structured_generation_schema_method: zod - .enum(['regex', 'json_schema']) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault - ) - .describe( - "The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed." - ), - structured_generation_use_single_sequence: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault - ) - .describe( - 'Whether to use a regex that matches exactly one sequence or record if ``max_sequences_per_example`` is 1.' - ), - enforce_timeseries_fidelity: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault - ) - .describe( - 'Enforce time-series fidelity by enforcing order, intervals, start and end times of the records.' - ), - validation: zod - .object({ - group_by_accept_no_delineator: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault - ) - .describe( - 'Whether to accept completions without both beginning and end of sequence delineators as a single sequence.' - ), - group_by_ignore_invalid_records: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault - ) - .describe( - 'Whether to ignore invalid records in a sequence and proceed with the valid records.' - ), - group_by_fix_non_unique_value: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault - ) - .describe( - 'Whether to automatically fix non-unique group-by values in a sequence by using the first unique value for all records.' - ), - group_by_fix_unordered_records: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault - ) - .describe( - 'Whether to automatically fix unordered records in a sequence by sorting the records.' - ), - }) - .describe( - 'Configuration for record and sequence validation.\n\nThese parameters control the validation and automatic fixes when going\nfrom LLM output to tabular data.' - ) - .optional() - .describe( - 'Validation parameters controlling validation logic and automatic fixes when parsing LLM output and converting to tabular data.' - ), - attention_backend: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneGenerationOneAttentionBackendDefault - ) - .describe( - "The attention backend for the vLLM engine. Common values: 'FLASHINFER', 'FLASH_ATTN', 'TRITON_ATTN', 'FLEX_ATTENTION'. If ``None`` or 'auto', vLLM will auto-select the best available backend." - ), - }) - .describe( - 'Configuration parameters for synthetic data generation.\n\nThese parameters control how synthetic data is generated after the model is trained.\nThey affect the quality, diversity, and validity of the generated synthetic records.' - ) - .optional() - .describe( - 'Parameters governing synthetic data generation including temperature, top-p, and number of records to produce.' - ), - privacy: zod - .object({ - dp_enabled: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneDpEnabledDefault - ) - .describe('Enable differentially-private training with DP-SGD.'), - epsilon: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneEpsilonDefault - ) - .describe( - 'Target privacy budget -- lower values provide stronger privacy. Must be > 0.' - ), - delta: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOneDeltaDefault - ) - .describe( - "Probability of accidentally leaking information. Should be much smaller than 1\/n where n is the number of training records. Setting to 'auto' uses delta of 1\/n^1.2. Must be in [0, 1) or 'auto'." - ), - per_sample_max_grad_norm: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault - ) - .describe('Maximum L2 norm for per-sample gradient clipping. Must be > 0.'), - }) - .describe( - 'Hyperparameters for differential privacy during training.\n\nThese parameters configure differential privacy (DP) training using DP-SGD algorithm.\nWhen enabled, they provide formal privacy guarantees by adding calibrated noise\nduring training.' - ) - .optional() - .describe( - 'Differential-privacy hyperparameters. When ``None``, differential privacy is disabled entirely.' - ), - time_series: zod - .object({ - is_timeseries: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneTimeSeriesOneIsTimeseriesDefault - ) - .describe( - 'Whether to treat the dataset as time series. When enabled, either ``timestamp_column`` or ``timestamp_interval_seconds`` is required. For grouped time series, ``group_training_examples_by`` needs to be set.' - ), - timestamp_column: zod - .string() - .optional() - .describe( - 'Name of the column containing timestamps used to order records when ``is_timeseries`` is ``True``. Required only when ``is_timeseries`` is ``True`` and ``timestamp_interval_seconds`` is not provided.' - ), - timestamp_interval_seconds: zod - .number() - .optional() - .describe( - 'Interval in seconds between timestamps. If not provided, the timestamp column will be used to infer the interval.' - ), - timestamp_format: zod - .string() - .optional() - .describe( - "Format of the timestamp column. Accepts either: (1) Python strftime format codes for string timestamps (e.g., '%Y-%m-%d %H:%M:%S', '%m\/%d\/%Y'), or (2) 'elapsed_seconds' for numeric (int\/float) timestamps representing seconds as an increasing counter (e.g., 0, 60, 120 for 1-minute intervals). If not provided, the format will be inferred from the data." - ), - start_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Start timestamp. If not provided, the first timestamp in the timestamp column will be used.' - ), - stop_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Stop timestamp. If not provided, the last timestamp in the timestamp column will be used.' - ), - }) - .describe( - 'Configuration for time-series mode in the Safe Synthesizer pipeline.\n\nControls whether a dataset is treated as time-series data, including\ntimestamp column selection, interval inference, and format validation.\nThe time-series pipeline is currently experimental.' - ) - .optional() - .describe( - 'Configuration for time-series mode. Time-series pipeline is currently experimental.' - ), - replace_pii: zod - .object({ - globals: zod - .object({ - locales: zod.array(zod.string()).optional().describe('List of locales.'), - seed: zod.number().optional().describe('Optional random seed.'), - classify: zod - .object({ - enable_classify: zod - .boolean() - .optional() - .describe('Enable column classification.'), - entities: zod - .array(zod.string()) - .optional() - .describe('List of entity types to classify.'), - num_samples: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault - ) - .describe('Number of column values to sample for classification.'), - classify_model_provider: zod - .string() - .optional() - .describe( - 'Name of the model provider in the Inference Gateway for column classification. The job compiler will resolve this to the appropriate endpoint URL.' - ), - }) - .describe('Configuration for column classification using an LLM.') - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault - ) - .describe('Column classification configuration.'), - ner: zod - .object({ - ner_threshold: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault - ) - .describe('NER model threshold.'), - enable_regexps: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault - ) - .describe('Enable NER regular expressions (experimental).'), - gliner: zod - .object({ - enable_gliner: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault - ) - .describe('Enable GLiNER NER module.'), - enable_batch_mode: zod - .boolean() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault - ) - .describe('Enable GLiNER batch mode.'), - batch_size: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault - ) - .describe('GLiNER batch size.'), - chunk_length: zod - .number() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault - ) - .describe('GLiNER batch chunk length in characters.'), - gliner_model: zod - .string() - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault - ) - .describe('GLiNER model name.'), - }) - .describe( - 'Configuration for the GLiNER named-entity recognition model.' - ) - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault - ) - .describe('GLiNER NER configuration.'), - ner_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entity types to recognize. If unset, classification entity types are used.' - ), - }) - .describe('Configuration for Named Entity Recognition.') - .default( - safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneGlobalsOneNerDefault - ) - .describe('Named Entity Recognition configuration.'), - lock_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns to preserve as immutable across all transformations.' - ), - }) - .describe( - 'Global settings for the PII replacer including locales, seed, NER, and classification.' - ) - .optional() - .describe('Global configuration options.'), - steps: zod - .array( - zod - .object({ - vars: zod - .record( - zod.string(), - zod.union([ - zod.string(), - zod.record(zod.string(), zod.unknown()), - zod.array(zod.unknown()), - ]) - ) - .optional() - .describe('Variable names and templates.'), - columns: zod - .object({ - add: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod - .string() - .optional() - .describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to add.'), - drop: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod - .string() - .optional() - .describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to drop.'), - rename: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod - .string() - .optional() - .describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to rename.'), - }) - .describe('Container for column add, drop, and rename operations.') - .optional() - .describe('Columns transform configuration.'), - rows: zod - .object({ - drop: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod - .string() - .optional() - .describe('Foreach expression.'), - value: zod - .string() - .optional() - .describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to drop.'), - update: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod - .string() - .optional() - .describe('Foreach expression.'), - value: zod - .string() - .optional() - .describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to update.'), - }) - .describe('Container for row drop and update operations.') - .optional() - .describe('Rows transform configurations.'), - }) - .describe( - 'Single transformation step with optional variables, column actions, and row actions.' - ) - ) - .min(1) - .max(safeSynthesizerListJobsResponseDataItemSpecConfigOneReplacePiiOneStepsMax) - .describe('List of transformation steps to perform on input data.'), - }) - .describe( - 'Configuration for PII replacer.\n\nDefines how PII data should be detected and replaced in a dataset.' - ) - .optional() - .describe( - 'PII replacement configuration. When ``None``, PII replacement is skipped.' - ), - }) - .describe( - 'Main configuration class for the Safe Synthesizer pipeline.\n\nThis is the top-level configuration class that orchestrates all aspects of\nsynthetic data generation including training, generation, privacy, evaluation,\nand data handling. It provides validation to ensure parameter compatibility.' - ) - .describe('The Safe Synthesizer parameters configuration.'), - hf_token_secret: zod - .string() - .optional() - .describe( - 'Name of platform secret containing the HuggingFace token. Must exist in the same workspace as the job.' - ), - enable_synthesis: zod - .boolean() - .default(safeSynthesizerListJobsResponseDataItemSpecEnableSynthesisDefault) - .describe( - 'Whether to run LLM training and generation phases. When False the task only performs PII replacement and returns the processed data.' - ), - }) - .describe( - 'Configuration model for Safe Synthesizer jobs.\n\nUsed primarily internally to configure a run submitted to the NeMo Jobs\nMicroservice.' - ), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .optional() - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()).optional(), - error_details: zod.record(zod.string(), zod.unknown()).optional(), - ownership: zod.record(zod.string(), zod.unknown()).optional(), - custom_fields: zod.record(zod.string(), zod.unknown()).optional(), - }) - ), - pagination: zod - .object({ - page: zod.number().describe('The current page number.'), - page_size: zod.number().describe('The page size used for the query.'), - current_page_size: zod.number().describe('The size for the current page.'), - total_pages: zod.number().describe('The total number of pages.'), - total_results: zod.number().describe('The total number of results.'), - }) - .optional() - .describe('Pagination information.'), - sort: zod.string().optional().describe('The field on which the results are sorted.'), - filter: zod.record(zod.string(), zod.unknown()).optional().describe('Filtering information.'), -}); - -/** - * @summary Download Job Result Adapter - */ -export const SafeSynthesizerDownloadJobResultAdapterParams = zod.object({ - workspace: zod.string(), - job: zod.string(), -}); - -/** - * @summary Download Job Result Evaluation-Report - */ -export const SafeSynthesizerDownloadJobResultEvaluationReportParams = zod.object({ - workspace: zod.string(), - job: zod.string(), -}); - -/** - * @summary Download Job Result Summary - */ -export const SafeSynthesizerDownloadJobResultSummaryParams = zod.object({ - workspace: zod.string(), - job: zod.string(), -}); - -export const SafeSynthesizerDownloadJobResultSummaryResponse = zod - .object({ - synthetic_data_quality_score: zod - .number() - .optional() - .describe( - 'Weighted composite of the five sub-scores below (SQS). Higher is better (0--10 scale).' - ), - column_correlation_stability_score: zod - .number() - .optional() - .describe( - 'How closely pairwise column correlations in synthetic data match the original for numeric and categorical columns.' - ), - deep_structure_stability_score: zod - .number() - .optional() - .describe( - 'PCA-based comparison of multivariate structure between real and synthetic data for numeric and categorical columns.' - ), - column_distribution_stability_score: zod - .number() - .optional() - .describe( - 'Per-column Jensen-Shannon distance between training and synthetic distributions averaged across all numeric and categorical columns.' - ), - text_semantic_similarity_score: zod - .number() - .optional() - .describe('Embedding-based semantic closeness between real and synthetic free-text columns.'), - text_structure_similarity_score: zod - .number() - .optional() - .describe( - 'Jensen-Shannon divergence over sentence count, words-per-sentence, and characters-per-word distributions between real and synthetic free-text columns.' - ), - data_privacy_score: zod - .number() - .optional() - .describe('Composite of MIA and AIA protection scores.'), - membership_inference_protection_score: zod - .number() - .optional() - .describe( - 'Resistance to attacks that try to determine whether a record was in the training set.' - ), - attribute_inference_protection_score: zod - .number() - .optional() - .describe( - 'Resistance to attacks that try to infer sensitive attributes from quasi-identifiers.' - ), - num_valid_records: zod - .number() - .optional() - .describe('Count of synthetic records that passed schema and format validation.'), - num_invalid_records: zod - .number() - .optional() - .describe('Count of synthetic records filtered out during validation.'), - num_prompts: zod.number().optional().describe('Total LLM generation prompts issued.'), - valid_record_fraction: zod - .number() - .optional() - .describe( - 'Ratio of valid records: ``num_valid_records \/ (num_valid_records + num_invalid_records)``.' - ), - timing: zod - .object({ - total_time_sec: zod - .number() - .optional() - .describe('Total end-to-end pipeline duration in seconds.'), - pii_replacer_time_sec: zod.number().optional().describe('Time spent on PII replacement.'), - training_time_sec: zod.number().optional().describe('Time spent on model training.'), - generation_time_sec: zod - .number() - .optional() - .describe('Time spent generating synthetic records.'), - evaluation_time_sec: zod - .number() - .optional() - .describe('Time spent evaluating synthetic data quality.'), - }) - .describe('Wall-clock durations for each pipeline stage.') - .describe('Per-stage wall-clock durations.'), - }) - .describe('Aggregated quality, privacy, and record-count metrics for a pipeline run.'); - -/** - * @summary Download Job Result Synthetic-Data - */ -export const SafeSynthesizerDownloadJobResultSyntheticDataParams = zod.object({ - workspace: zod.string(), - job: zod.string(), -}); - -/** - * @summary Get Job Result - */ -export const SafeSynthesizerGetJobResultParams = zod.object({ - workspace: zod.string(), - job: zod.string(), - name: zod.string(), -}); - -export const SafeSynthesizerGetJobResultResponse = zod.object({ - name: zod.string(), - job: zod.string(), - workspace: zod.string(), - project: zod.string().optional(), - created_at: zod.string().datetime({}).optional(), - updated_at: zod.string().datetime({}).optional(), - artifact_url: zod.string(), - artifact_storage_type: zod.enum(['fileset']), - download_url: zod.string().optional(), -}); - -/** - * @summary Download Job Result - */ -export const SafeSynthesizerDownloadJobResultParams = zod.object({ - workspace: zod.string(), - job: zod.string(), - name: zod.string(), -}); - -/** - * @summary Get Job - */ -export const SafeSynthesizerGetJobParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -export const safeSynthesizerGetJobResponseSpecConfigOneDataOneMaxSequencesPerExampleDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneDataOneHoldoutDefault = 0.05; -export const safeSynthesizerGetJobResponseSpecConfigOneDataOneMaxHoldoutDefault = 2000; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneMiaEnabledDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneAiaEnabledDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneSqsReportColumnsDefault = 250; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneSqsReportRowsDefault = 5000; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneEnabledDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneQuasiIdentifierCountDefault = 3; -export const safeSynthesizerGetJobResponseSpecConfigOneEvaluationOnePiiReplayEnabledDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneNumInputRecordsToSampleDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneBatchSizeDefault = 1; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneGradientAccumulationStepsDefault = 8; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneWeightDecayDefault = 0.01; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneWarmupRatioDefault = 0.05; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLrSchedulerDefault = `cosine`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLearningRateDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraRDefault = 32; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraAlphaOverRDefault = 1; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraTargetModulesDefault = [ - `q_proj`, - `k_proj`, - `v_proj`, - `o_proj`, -]; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneUseUnslothDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneRopeScalingFactorDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneValidationRatioDefault = 0; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneValidationStepsDefault = 15; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOnePretrainedModelDefault = `HuggingFaceTB/SmolLM3-3B`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneQuantizeModelDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneQuantizationBitsDefault = 8; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOnePeftImplementationDefault = `QLORA`; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneMaxVramFractionDefault = 0.8; -export const safeSynthesizerGetJobResponseSpecConfigOneTrainingOneAttnImplementationDefault = `kernels-community/vllm-flash-attn3`; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneNumRecordsDefault = 1000; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneTemperatureDefault = 0.9; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneRepetitionPenaltyDefault = 1; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneTopPDefault = 1; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOnePatienceDefault = 3; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneInvalidFractionThresholdDefault = 0.8; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneUseStructuredGenerationDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationBackendDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault = `regex`; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneGenerationOneAttentionBackendDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneDpEnabledDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneEpsilonDefault = 8; -export const safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneDeltaDefault = `auto`; -export const safeSynthesizerGetJobResponseSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault = 1; -export const safeSynthesizerGetJobResponseSpecConfigOneTimeSeriesOneIsTimeseriesDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault = 3; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault = { - num_samples: 3, -}; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault = 0.3; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault = false; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault = true; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault = 8; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault = 512; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault = `nvidia/gliner-PII`; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault = - { - enable_gliner: true, - enable_batch_mode: true, - batch_size: 8, - chunk_length: 512, - gliner_model: 'nvidia/gliner-PII', - }; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerDefault = { - ner_threshold: 0.3, - enable_regexps: false, -}; -export const safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneStepsMax = 10; - -export const safeSynthesizerGetJobResponseSpecEnableSynthesisDefault = true; - -export const SafeSynthesizerGetJobResponse = zod.object({ - id: zod.string().optional(), - name: zod.string(), - description: zod.string().optional(), - project: zod.string().optional(), - workspace: zod.string().optional(), - created_at: zod.string().optional(), - updated_at: zod.string().optional(), - spec: zod - .object({ - data_source: zod.string().describe('The data source for the job.'), - config: zod - .object({ - data: zod - .object({ - group_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to group training examples by. This is useful when you want the model to learn inter-record correlations for a given grouping of records.' - ), - order_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to order training examples by. This is useful when you want the model to learn sequential relationships for a given ordering of records. If you provide this parameter, you must also provide ``group_training_examples_by``.' - ), - max_sequences_per_example: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerGetJobResponseSpecConfigOneDataOneMaxSequencesPerExampleDefault - ) - .describe( - "If specified, adds at most this number of sequences per example. Supports 'auto' where a value of 1 is chosen if differential privacy is enabled, and 10 otherwise. If not specified or set to 'auto', fills up context. Required for DP to limit contribution of each example." - ), - holdout: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneDataOneHoldoutDefault) - .describe( - 'Amount of records to hold out for evaluation. If this is a float between 0 and 1, that ratio of records is held out. If an integer greater than 1, that number of records is held out. If the value is equal to zero, no holdout will be performed. Must be >= 0.' - ), - max_holdout: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneDataOneMaxHoldoutDefault) - .describe( - 'Maximum number of records to hold out. Overrides any behavior set by ``holdout``. Must be >= 0.' - ), - random_state: zod - .number() - .optional() - .describe('Random state for holdout split to ensure reproducibility.'), - }) - .describe( - 'Configuration for grouping, ordering, and splitting input data for training and evaluation.' - ) - .optional() - .describe( - 'Configuration controlling how input data is grouped and split for training and evaluation.' - ), - evaluation: zod - .object({ - mia_enabled: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneMiaEnabledDefault) - .describe('Enable membership inference attack evaluation for privacy assessment.'), - aia_enabled: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneAiaEnabledDefault) - .describe('Enable attribute inference attack evaluation for privacy assessment.'), - sqs_report_columns: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneSqsReportColumnsDefault - ) - .describe('Number of columns to include in statistical quality reports.'), - sqs_report_rows: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneSqsReportRowsDefault - ) - .describe('Number of rows to include in statistical quality reports.'), - mandatory_columns: zod - .number() - .optional() - .describe('Number of mandatory columns that must be used in evaluation.'), - enabled: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneEnabledDefault) - .describe('Enable or disable evaluation.'), - quasi_identifier_count: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneEvaluationOneQuasiIdentifierCountDefault - ) - .describe('Number of quasi-identifiers to sample for privacy attacks.'), - pii_replay_enabled: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneEvaluationOnePiiReplayEnabledDefault - ) - .describe('Enable PII Replay detection.'), - pii_replay_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entities for PII Replay. If not provided, default entities will be used.' - ), - pii_replay_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns for PII Replay. If not provided, only entities will be used.' - ), - }) - .describe( - 'Configuration for evaluating synthetic data quality and privacy.\n\nThis class controls which evaluation metrics are computed and how they are configured.\nIt includes privacy attack evaluations, statistical quality metrics, and downstream\nmachine learning performance assessments.' - ) - .optional() - .describe('Parameters for evaluating the quality of generated synthetic data.'), - training: zod - .object({ - num_input_records_to_sample: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneNumInputRecordsToSampleDefault - ) - .describe( - "Number of records the model will see during training. This parameter is a proxy for training time. For example, if its value is the same size as the input dataset, this is like training for a single epoch. If its value is larger, this is like training for multiple (possibly fractional) epochs. If its value is smaller, this is like training for a fraction of an epoch. Supports 'auto' where a reasonable value is chosen based on other config params and data." - ), - batch_size: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneBatchSizeDefault) - .describe('The batch size per device for training. Must be >= 1.'), - gradient_accumulation_steps: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneGradientAccumulationStepsDefault - ) - .describe( - 'Number of update steps to accumulate the gradients for, before performing a backward\/update pass. This technique increases the effective batch size that will fit into GPU memory. Must be >= 1.' - ), - weight_decay: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneWeightDecayDefault) - .describe( - 'The weight decay to apply to all layers except all bias and LayerNorm weights in the AdamW optimizer. Must be in (0, 1).' - ), - warmup_ratio: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneWarmupRatioDefault) - .describe( - 'Ratio of total training steps used for a linear warmup from 0 to the learning rate. Must be > 0.' - ), - lr_scheduler: zod - .string() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLrSchedulerDefault) - .describe( - 'The scheduler type to use. See the HuggingFace documentation of ``SchedulerType`` for all possible values.' - ), - learning_rate: zod - .union([zod.literal('auto'), zod.number()]) - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLearningRateDefault) - .describe( - "The initial learning rate for `AdamW` optimizer. Must be in (0, 1). Setting to 'auto' uses a model-specific default if one exists." - ), - lora_r: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraRDefault) - .describe( - 'The rank of the LoRA update matrices. Lower rank results in smaller update matrices with fewer trainable parameters. Must be > 0.' - ), - lora_alpha_over_r: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraAlphaOverRDefault) - .describe( - 'The ratio of the LoRA scaling factor (alpha) to the LoRA rank. Empirically, this parameter works well when set to 0.5, 1, or 2. Must be in [0.5, 3].' - ), - lora_target_modules: zod - .array(zod.string()) - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneLoraTargetModulesDefault - ) - .describe( - "The list of transformer modules to apply LoRA to. Possible modules: 'q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'." - ), - use_unsloth: zod - .union([zod.literal('auto'), zod.boolean()]) - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneUseUnslothDefault) - .describe('Whether to use Unsloth for optimized training.'), - rope_scaling_factor: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneRopeScalingFactorDefault - ) - .describe( - "Scale the base LLM's context length by this factor using RoPE scaling. Must be >= 1 or 'auto'." - ), - validation_ratio: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneValidationRatioDefault - ) - .describe( - 'The fraction of the training data used for validation. Must be in [0, 1]. If set to 0, no validation will be performed. If set larger than 0, validation loss will be computed and reported throughout training.' - ), - validation_steps: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneValidationStepsDefault - ) - .describe( - 'The number of steps between validation checks for the HF Trainer arguments. Must be > 0.' - ), - pretrained_model: zod - .string() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOnePretrainedModelDefault - ) - .describe( - 'Pretrained model to use for fine-tuning. Defaults to SmolLM3. May be a Hugging Face model ID (loaded from the Hugging Face Hub or cache) or a local path. See security note in docs before using untrusted sources.' - ), - quantize_model: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOneTrainingOneQuantizeModelDefault) - .describe( - 'Whether to quantize the model during training. This can reduce memory usage and potentially speed up training, but may also impact model accuracy.' - ), - quantization_bits: zod - .union([zod.literal(4), zod.literal(8)]) - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneQuantizationBitsDefault - ) - .describe( - 'The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4.' - ), - peft_implementation: zod - .string() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOnePeftImplementationDefault - ) - .describe( - "The PEFT (Parameter-Efficient Fine-Tuning) implementation to use. Options: 'lora' for Low-Rank Adaptation, 'QLORA' for Quantized LoRA." - ), - max_vram_fraction: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneMaxVramFractionDefault - ) - .describe( - 'The fraction of the total VRAM to use for training. Modify this to allow longer sequences. Must be in [0, 1].' - ), - attn_implementation: zod - .string() - .default( - safeSynthesizerGetJobResponseSpecConfigOneTrainingOneAttnImplementationDefault - ) - .describe( - "The attention implementation to use for model loading. Default uses Flash Attention 3 via the HuggingFace Kernels Hub (requires the 'kernels' pip package; falls back to 'sdpa' if the 'kernels' package is not installed). Other common values: 'flash_attention_2' (requires flash-attn pip package), 'sdpa' (PyTorch scaled dot product attention), 'eager' (standard PyTorch). Custom HuggingFace Kernels Hub paths (e.g. 'kernels-community\/flash-attn2') are also supported." - ), - }) - .describe( - 'Hyperparameters that control the training process behavior.\n\nThis class contains all the fine-tuning hyperparameters that control how the model\nlearns, including learning rates, batch sizes, LoRA configuration, and optimization\nsettings. These parameters directly affect training performance and quality.' - ) - .optional() - .describe( - 'Hyperparameters for model training such as learning rate, batch size, and LoRA adapter settings.' - ), - generation: zod - .object({ - num_records: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneGenerationOneNumRecordsDefault) - .describe('Number of records to generate.'), - temperature: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneGenerationOneTemperatureDefault) - .describe( - 'Sampling temperature for controlling randomness (higher = more random).' - ), - repetition_penalty: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneRepetitionPenaltyDefault - ) - .describe( - 'The value used to control the likelihood of the model repeating the same token. Must be > 0.' - ), - top_p: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneGenerationOneTopPDefault) - .describe('Nucleus sampling probability for token selection. Must be in (0, 1].'), - patience: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOneGenerationOnePatienceDefault) - .describe( - 'Number of consecutive generations where the ``invalid_fraction_threshold`` is reached before stopping generation. Must be >= 1.' - ), - invalid_fraction_threshold: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneInvalidFractionThresholdDefault - ) - .describe( - 'The fraction of invalid records that will stop generation after the ``patience`` limit is reached. Must be in [0, 1].' - ), - use_structured_generation: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneUseStructuredGenerationDefault - ) - .describe('Whether to use structured generation for better format control.'), - structured_generation_backend: zod - .enum(['auto', 'xgrammar', 'guidance', 'outlines', 'lm-format-enforcer']) - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationBackendDefault - ) - .describe( - "The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend." - ), - structured_generation_schema_method: zod - .enum(['regex', 'json_schema']) - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault - ) - .describe( - "The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed." - ), - structured_generation_use_single_sequence: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault - ) - .describe( - 'Whether to use a regex that matches exactly one sequence or record if ``max_sequences_per_example`` is 1.' - ), - enforce_timeseries_fidelity: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault - ) - .describe( - 'Enforce time-series fidelity by enforcing order, intervals, start and end times of the records.' - ), - validation: zod - .object({ - group_by_accept_no_delineator: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault - ) - .describe( - 'Whether to accept completions without both beginning and end of sequence delineators as a single sequence.' - ), - group_by_ignore_invalid_records: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault - ) - .describe( - 'Whether to ignore invalid records in a sequence and proceed with the valid records.' - ), - group_by_fix_non_unique_value: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault - ) - .describe( - 'Whether to automatically fix non-unique group-by values in a sequence by using the first unique value for all records.' - ), - group_by_fix_unordered_records: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault - ) - .describe( - 'Whether to automatically fix unordered records in a sequence by sorting the records.' - ), - }) - .describe( - 'Configuration for record and sequence validation.\n\nThese parameters control the validation and automatic fixes when going\nfrom LLM output to tabular data.' - ) - .optional() - .describe( - 'Validation parameters controlling validation logic and automatic fixes when parsing LLM output and converting to tabular data.' - ), - attention_backend: zod - .string() - .default( - safeSynthesizerGetJobResponseSpecConfigOneGenerationOneAttentionBackendDefault - ) - .describe( - "The attention backend for the vLLM engine. Common values: 'FLASHINFER', 'FLASH_ATTN', 'TRITON_ATTN', 'FLEX_ATTENTION'. If ``None`` or 'auto', vLLM will auto-select the best available backend." - ), - }) - .describe( - 'Configuration parameters for synthetic data generation.\n\nThese parameters control how synthetic data is generated after the model is trained.\nThey affect the quality, diversity, and validity of the generated synthetic records.' - ) - .optional() - .describe( - 'Parameters governing synthetic data generation including temperature, top-p, and number of records to produce.' - ), - privacy: zod - .object({ - dp_enabled: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneDpEnabledDefault) - .describe('Enable differentially-private training with DP-SGD.'), - epsilon: zod - .number() - .default(safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneEpsilonDefault) - .describe( - 'Target privacy budget -- lower values provide stronger privacy. Must be > 0.' - ), - delta: zod - .union([zod.literal('auto'), zod.number()]) - .default(safeSynthesizerGetJobResponseSpecConfigOnePrivacyOneDeltaDefault) - .describe( - "Probability of accidentally leaking information. Should be much smaller than 1\/n where n is the number of training records. Setting to 'auto' uses delta of 1\/n^1.2. Must be in [0, 1) or 'auto'." - ), - per_sample_max_grad_norm: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault - ) - .describe('Maximum L2 norm for per-sample gradient clipping. Must be > 0.'), - }) - .describe( - 'Hyperparameters for differential privacy during training.\n\nThese parameters configure differential privacy (DP) training using DP-SGD algorithm.\nWhen enabled, they provide formal privacy guarantees by adding calibrated noise\nduring training.' - ) - .optional() - .describe( - 'Differential-privacy hyperparameters. When ``None``, differential privacy is disabled entirely.' - ), - time_series: zod - .object({ - is_timeseries: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecConfigOneTimeSeriesOneIsTimeseriesDefault) - .describe( - 'Whether to treat the dataset as time series. When enabled, either ``timestamp_column`` or ``timestamp_interval_seconds`` is required. For grouped time series, ``group_training_examples_by`` needs to be set.' - ), - timestamp_column: zod - .string() - .optional() - .describe( - 'Name of the column containing timestamps used to order records when ``is_timeseries`` is ``True``. Required only when ``is_timeseries`` is ``True`` and ``timestamp_interval_seconds`` is not provided.' - ), - timestamp_interval_seconds: zod - .number() - .optional() - .describe( - 'Interval in seconds between timestamps. If not provided, the timestamp column will be used to infer the interval.' - ), - timestamp_format: zod - .string() - .optional() - .describe( - "Format of the timestamp column. Accepts either: (1) Python strftime format codes for string timestamps (e.g., '%Y-%m-%d %H:%M:%S', '%m\/%d\/%Y'), or (2) 'elapsed_seconds' for numeric (int\/float) timestamps representing seconds as an increasing counter (e.g., 0, 60, 120 for 1-minute intervals). If not provided, the format will be inferred from the data." - ), - start_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Start timestamp. If not provided, the first timestamp in the timestamp column will be used.' - ), - stop_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Stop timestamp. If not provided, the last timestamp in the timestamp column will be used.' - ), - }) - .describe( - 'Configuration for time-series mode in the Safe Synthesizer pipeline.\n\nControls whether a dataset is treated as time-series data, including\ntimestamp column selection, interval inference, and format validation.\nThe time-series pipeline is currently experimental.' - ) - .optional() - .describe( - 'Configuration for time-series mode. Time-series pipeline is currently experimental.' - ), - replace_pii: zod - .object({ - globals: zod - .object({ - locales: zod.array(zod.string()).optional().describe('List of locales.'), - seed: zod.number().optional().describe('Optional random seed.'), - classify: zod - .object({ - enable_classify: zod - .boolean() - .optional() - .describe('Enable column classification.'), - entities: zod - .array(zod.string()) - .optional() - .describe('List of entity types to classify.'), - num_samples: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault - ) - .describe('Number of column values to sample for classification.'), - classify_model_provider: zod - .string() - .optional() - .describe( - 'Name of the model provider in the Inference Gateway for column classification. The job compiler will resolve this to the appropriate endpoint URL.' - ), - }) - .describe('Configuration for column classification using an LLM.') - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault - ) - .describe('Column classification configuration.'), - ner: zod - .object({ - ner_threshold: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault - ) - .describe('NER model threshold.'), - enable_regexps: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault - ) - .describe('Enable NER regular expressions (experimental).'), - gliner: zod - .object({ - enable_gliner: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault - ) - .describe('Enable GLiNER NER module.'), - enable_batch_mode: zod - .boolean() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault - ) - .describe('Enable GLiNER batch mode.'), - batch_size: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault - ) - .describe('GLiNER batch size.'), - chunk_length: zod - .number() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault - ) - .describe('GLiNER batch chunk length in characters.'), - gliner_model: zod - .string() - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault - ) - .describe('GLiNER model name.'), - }) - .describe('Configuration for the GLiNER named-entity recognition model.') - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault - ) - .describe('GLiNER NER configuration.'), - ner_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entity types to recognize. If unset, classification entity types are used.' - ), - }) - .describe('Configuration for Named Entity Recognition.') - .default( - safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerDefault - ) - .describe('Named Entity Recognition configuration.'), - lock_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns to preserve as immutable across all transformations.' - ), - }) - .describe( - 'Global settings for the PII replacer including locales, seed, NER, and classification.' - ) - .optional() - .describe('Global configuration options.'), - steps: zod - .array( - zod - .object({ - vars: zod - .record( - zod.string(), - zod.union([ - zod.string(), - zod.record(zod.string(), zod.unknown()), - zod.array(zod.unknown()), - ]) - ) - .optional() - .describe('Variable names and templates.'), - columns: zod - .object({ - add: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to add.'), - drop: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to drop.'), - rename: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to rename.'), - }) - .describe('Container for column add, drop, and rename operations.') - .optional() - .describe('Columns transform configuration.'), - rows: zod - .object({ - drop: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to drop.'), - update: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to update.'), - }) - .describe('Container for row drop and update operations.') - .optional() - .describe('Rows transform configurations.'), - }) - .describe( - 'Single transformation step with optional variables, column actions, and row actions.' - ) - ) - .min(1) - .max(safeSynthesizerGetJobResponseSpecConfigOneReplacePiiOneStepsMax) - .describe('List of transformation steps to perform on input data.'), - }) - .describe( - 'Configuration for PII replacer.\n\nDefines how PII data should be detected and replaced in a dataset.' - ) - .optional() - .describe('PII replacement configuration. When ``None``, PII replacement is skipped.'), - }) - .describe( - 'Main configuration class for the Safe Synthesizer pipeline.\n\nThis is the top-level configuration class that orchestrates all aspects of\nsynthetic data generation including training, generation, privacy, evaluation,\nand data handling. It provides validation to ensure parameter compatibility.' - ) - .describe('The Safe Synthesizer parameters configuration.'), - hf_token_secret: zod - .string() - .optional() - .describe( - 'Name of platform secret containing the HuggingFace token. Must exist in the same workspace as the job.' - ), - enable_synthesis: zod - .boolean() - .default(safeSynthesizerGetJobResponseSpecEnableSynthesisDefault) - .describe( - 'Whether to run LLM training and generation phases. When False the task only performs PII replacement and returns the processed data.' - ), - }) - .describe( - 'Configuration model for Safe Synthesizer jobs.\n\nUsed primarily internally to configure a run submitted to the NeMo Jobs\nMicroservice.' - ), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .optional() - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()).optional(), - error_details: zod.record(zod.string(), zod.unknown()).optional(), - ownership: zod.record(zod.string(), zod.unknown()).optional(), - custom_fields: zod.record(zod.string(), zod.unknown()).optional(), -}); - -/** - * @summary Delete Job - */ -export const SafeSynthesizerDeleteJobParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -/** - * @summary Cancel Job - */ -export const SafeSynthesizerCancelJobParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -export const safeSynthesizerCancelJobResponseSpecConfigOneDataOneMaxSequencesPerExampleDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneDataOneHoldoutDefault = 0.05; -export const safeSynthesizerCancelJobResponseSpecConfigOneDataOneMaxHoldoutDefault = 2000; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneMiaEnabledDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneAiaEnabledDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneSqsReportColumnsDefault = 250; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneSqsReportRowsDefault = 5000; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneEnabledDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneQuasiIdentifierCountDefault = 3; -export const safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOnePiiReplayEnabledDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneNumInputRecordsToSampleDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneBatchSizeDefault = 1; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneGradientAccumulationStepsDefault = 8; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneWeightDecayDefault = 0.01; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneWarmupRatioDefault = 0.05; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLrSchedulerDefault = `cosine`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLearningRateDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraRDefault = 32; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraAlphaOverRDefault = 1; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraTargetModulesDefault = [ - `q_proj`, - `k_proj`, - `v_proj`, - `o_proj`, -]; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneUseUnslothDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneRopeScalingFactorDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneValidationRatioDefault = 0; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneValidationStepsDefault = 15; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOnePretrainedModelDefault = `HuggingFaceTB/SmolLM3-3B`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneQuantizeModelDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneQuantizationBitsDefault = 8; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOnePeftImplementationDefault = `QLORA`; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneMaxVramFractionDefault = 0.8; -export const safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneAttnImplementationDefault = `kernels-community/vllm-flash-attn3`; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneNumRecordsDefault = 1000; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneTemperatureDefault = 0.9; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneRepetitionPenaltyDefault = 1; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneTopPDefault = 1; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOnePatienceDefault = 3; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneInvalidFractionThresholdDefault = 0.8; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneUseStructuredGenerationDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationBackendDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault = `regex`; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneAttentionBackendDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneDpEnabledDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneEpsilonDefault = 8; -export const safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneDeltaDefault = `auto`; -export const safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault = 1; -export const safeSynthesizerCancelJobResponseSpecConfigOneTimeSeriesOneIsTimeseriesDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault = 3; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault = { - num_samples: 3, -}; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault = 0.3; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault = false; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault = true; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault = 8; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault = 512; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault = `nvidia/gliner-PII`; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault = - { - enable_gliner: true, - enable_batch_mode: true, - batch_size: 8, - chunk_length: 512, - gliner_model: 'nvidia/gliner-PII', - }; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerDefault = { - ner_threshold: 0.3, - enable_regexps: false, -}; -export const safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneStepsMax = 10; - -export const safeSynthesizerCancelJobResponseSpecEnableSynthesisDefault = true; - -export const SafeSynthesizerCancelJobResponse = zod.object({ - id: zod.string().optional(), - name: zod.string(), - description: zod.string().optional(), - project: zod.string().optional(), - workspace: zod.string().optional(), - created_at: zod.string().optional(), - updated_at: zod.string().optional(), - spec: zod - .object({ - data_source: zod.string().describe('The data source for the job.'), - config: zod - .object({ - data: zod - .object({ - group_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to group training examples by. This is useful when you want the model to learn inter-record correlations for a given grouping of records.' - ), - order_training_examples_by: zod - .string() - .optional() - .describe( - 'Column to order training examples by. This is useful when you want the model to learn sequential relationships for a given ordering of records. If you provide this parameter, you must also provide ``group_training_examples_by``.' - ), - max_sequences_per_example: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneDataOneMaxSequencesPerExampleDefault - ) - .describe( - "If specified, adds at most this number of sequences per example. Supports 'auto' where a value of 1 is chosen if differential privacy is enabled, and 10 otherwise. If not specified or set to 'auto', fills up context. Required for DP to limit contribution of each example." - ), - holdout: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneDataOneHoldoutDefault) - .describe( - 'Amount of records to hold out for evaluation. If this is a float between 0 and 1, that ratio of records is held out. If an integer greater than 1, that number of records is held out. If the value is equal to zero, no holdout will be performed. Must be >= 0.' - ), - max_holdout: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneDataOneMaxHoldoutDefault) - .describe( - 'Maximum number of records to hold out. Overrides any behavior set by ``holdout``. Must be >= 0.' - ), - random_state: zod - .number() - .optional() - .describe('Random state for holdout split to ensure reproducibility.'), - }) - .describe( - 'Configuration for grouping, ordering, and splitting input data for training and evaluation.' - ) - .optional() - .describe( - 'Configuration controlling how input data is grouped and split for training and evaluation.' - ), - evaluation: zod - .object({ - mia_enabled: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneMiaEnabledDefault - ) - .describe('Enable membership inference attack evaluation for privacy assessment.'), - aia_enabled: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneAiaEnabledDefault - ) - .describe('Enable attribute inference attack evaluation for privacy assessment.'), - sqs_report_columns: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneSqsReportColumnsDefault - ) - .describe('Number of columns to include in statistical quality reports.'), - sqs_report_rows: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneSqsReportRowsDefault - ) - .describe('Number of rows to include in statistical quality reports.'), - mandatory_columns: zod - .number() - .optional() - .describe('Number of mandatory columns that must be used in evaluation.'), - enabled: zod - .boolean() - .default(safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneEnabledDefault) - .describe('Enable or disable evaluation.'), - quasi_identifier_count: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOneQuasiIdentifierCountDefault - ) - .describe('Number of quasi-identifiers to sample for privacy attacks.'), - pii_replay_enabled: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneEvaluationOnePiiReplayEnabledDefault - ) - .describe('Enable PII Replay detection.'), - pii_replay_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entities for PII Replay. If not provided, default entities will be used.' - ), - pii_replay_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns for PII Replay. If not provided, only entities will be used.' - ), - }) - .describe( - 'Configuration for evaluating synthetic data quality and privacy.\n\nThis class controls which evaluation metrics are computed and how they are configured.\nIt includes privacy attack evaluations, statistical quality metrics, and downstream\nmachine learning performance assessments.' - ) - .optional() - .describe('Parameters for evaluating the quality of generated synthetic data.'), - training: zod - .object({ - num_input_records_to_sample: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneNumInputRecordsToSampleDefault - ) - .describe( - "Number of records the model will see during training. This parameter is a proxy for training time. For example, if its value is the same size as the input dataset, this is like training for a single epoch. If its value is larger, this is like training for multiple (possibly fractional) epochs. If its value is smaller, this is like training for a fraction of an epoch. Supports 'auto' where a reasonable value is chosen based on other config params and data." - ), - batch_size: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneBatchSizeDefault) - .describe('The batch size per device for training. Must be >= 1.'), - gradient_accumulation_steps: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneGradientAccumulationStepsDefault - ) - .describe( - 'Number of update steps to accumulate the gradients for, before performing a backward\/update pass. This technique increases the effective batch size that will fit into GPU memory. Must be >= 1.' - ), - weight_decay: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneWeightDecayDefault) - .describe( - 'The weight decay to apply to all layers except all bias and LayerNorm weights in the AdamW optimizer. Must be in (0, 1).' - ), - warmup_ratio: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneWarmupRatioDefault) - .describe( - 'Ratio of total training steps used for a linear warmup from 0 to the learning rate. Must be > 0.' - ), - lr_scheduler: zod - .string() - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLrSchedulerDefault) - .describe( - 'The scheduler type to use. See the HuggingFace documentation of ``SchedulerType`` for all possible values.' - ), - learning_rate: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLearningRateDefault - ) - .describe( - "The initial learning rate for `AdamW` optimizer. Must be in (0, 1). Setting to 'auto' uses a model-specific default if one exists." - ), - lora_r: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraRDefault) - .describe( - 'The rank of the LoRA update matrices. Lower rank results in smaller update matrices with fewer trainable parameters. Must be > 0.' - ), - lora_alpha_over_r: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraAlphaOverRDefault - ) - .describe( - 'The ratio of the LoRA scaling factor (alpha) to the LoRA rank. Empirically, this parameter works well when set to 0.5, 1, or 2. Must be in [0.5, 3].' - ), - lora_target_modules: zod - .array(zod.string()) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneLoraTargetModulesDefault - ) - .describe( - "The list of transformer modules to apply LoRA to. Possible modules: 'q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'." - ), - use_unsloth: zod - .union([zod.literal('auto'), zod.boolean()]) - .default(safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneUseUnslothDefault) - .describe('Whether to use Unsloth for optimized training.'), - rope_scaling_factor: zod - .union([zod.literal('auto'), zod.number()]) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneRopeScalingFactorDefault - ) - .describe( - "Scale the base LLM's context length by this factor using RoPE scaling. Must be >= 1 or 'auto'." - ), - validation_ratio: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneValidationRatioDefault - ) - .describe( - 'The fraction of the training data used for validation. Must be in [0, 1]. If set to 0, no validation will be performed. If set larger than 0, validation loss will be computed and reported throughout training.' - ), - validation_steps: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneValidationStepsDefault - ) - .describe( - 'The number of steps between validation checks for the HF Trainer arguments. Must be > 0.' - ), - pretrained_model: zod - .string() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOnePretrainedModelDefault - ) - .describe( - 'Pretrained model to use for fine-tuning. Defaults to SmolLM3. May be a Hugging Face model ID (loaded from the Hugging Face Hub or cache) or a local path. See security note in docs before using untrusted sources.' - ), - quantize_model: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneQuantizeModelDefault - ) - .describe( - 'Whether to quantize the model during training. This can reduce memory usage and potentially speed up training, but may also impact model accuracy.' - ), - quantization_bits: zod - .union([zod.literal(4), zod.literal(8)]) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneQuantizationBitsDefault - ) - .describe( - 'The number of bits to use for quantization if ``quantize_model`` is ``True``. Accepts 8 or 4.' - ), - peft_implementation: zod - .string() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOnePeftImplementationDefault - ) - .describe( - "The PEFT (Parameter-Efficient Fine-Tuning) implementation to use. Options: 'lora' for Low-Rank Adaptation, 'QLORA' for Quantized LoRA." - ), - max_vram_fraction: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneMaxVramFractionDefault - ) - .describe( - 'The fraction of the total VRAM to use for training. Modify this to allow longer sequences. Must be in [0, 1].' - ), - attn_implementation: zod - .string() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTrainingOneAttnImplementationDefault - ) - .describe( - "The attention implementation to use for model loading. Default uses Flash Attention 3 via the HuggingFace Kernels Hub (requires the 'kernels' pip package; falls back to 'sdpa' if the 'kernels' package is not installed). Other common values: 'flash_attention_2' (requires flash-attn pip package), 'sdpa' (PyTorch scaled dot product attention), 'eager' (standard PyTorch). Custom HuggingFace Kernels Hub paths (e.g. 'kernels-community\/flash-attn2') are also supported." - ), - }) - .describe( - 'Hyperparameters that control the training process behavior.\n\nThis class contains all the fine-tuning hyperparameters that control how the model\nlearns, including learning rates, batch sizes, LoRA configuration, and optimization\nsettings. These parameters directly affect training performance and quality.' - ) - .optional() - .describe( - 'Hyperparameters for model training such as learning rate, batch size, and LoRA adapter settings.' - ), - generation: zod - .object({ - num_records: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneNumRecordsDefault - ) - .describe('Number of records to generate.'), - temperature: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneTemperatureDefault - ) - .describe( - 'Sampling temperature for controlling randomness (higher = more random).' - ), - repetition_penalty: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneRepetitionPenaltyDefault - ) - .describe( - 'The value used to control the likelihood of the model repeating the same token. Must be > 0.' - ), - top_p: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneTopPDefault) - .describe('Nucleus sampling probability for token selection. Must be in (0, 1].'), - patience: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOneGenerationOnePatienceDefault) - .describe( - 'Number of consecutive generations where the ``invalid_fraction_threshold`` is reached before stopping generation. Must be >= 1.' - ), - invalid_fraction_threshold: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneInvalidFractionThresholdDefault - ) - .describe( - 'The fraction of invalid records that will stop generation after the ``patience`` limit is reached. Must be in [0, 1].' - ), - use_structured_generation: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneUseStructuredGenerationDefault - ) - .describe('Whether to use structured generation for better format control.'), - structured_generation_backend: zod - .enum(['auto', 'xgrammar', 'guidance', 'outlines', 'lm-format-enforcer']) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationBackendDefault - ) - .describe( - "The backend used by vLLM when ``use_structured_generation`` is ``True``. Supported backends: 'outlines', 'guidance', 'xgrammar', 'lm-format-enforcer'. 'auto' will allow vLLM to choose the backend." - ), - structured_generation_schema_method: zod - .enum(['regex', 'json_schema']) - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationSchemaMethodDefault - ) - .describe( - "The method used to generate the schema from your dataset and pass it to the generation backend. 'regex' uses a custom regex construction method that tends to be more comprehensive than 'json_schema' at the cost of speed." - ), - structured_generation_use_single_sequence: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneStructuredGenerationUseSingleSequenceDefault - ) - .describe( - 'Whether to use a regex that matches exactly one sequence or record if ``max_sequences_per_example`` is 1.' - ), - enforce_timeseries_fidelity: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneEnforceTimeseriesFidelityDefault - ) - .describe( - 'Enforce time-series fidelity by enforcing order, intervals, start and end times of the records.' - ), - validation: zod - .object({ - group_by_accept_no_delineator: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByAcceptNoDelineatorDefault - ) - .describe( - 'Whether to accept completions without both beginning and end of sequence delineators as a single sequence.' - ), - group_by_ignore_invalid_records: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByIgnoreInvalidRecordsDefault - ) - .describe( - 'Whether to ignore invalid records in a sequence and proceed with the valid records.' - ), - group_by_fix_non_unique_value: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixNonUniqueValueDefault - ) - .describe( - 'Whether to automatically fix non-unique group-by values in a sequence by using the first unique value for all records.' - ), - group_by_fix_unordered_records: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneValidationOneGroupByFixUnorderedRecordsDefault - ) - .describe( - 'Whether to automatically fix unordered records in a sequence by sorting the records.' - ), - }) - .describe( - 'Configuration for record and sequence validation.\n\nThese parameters control the validation and automatic fixes when going\nfrom LLM output to tabular data.' - ) - .optional() - .describe( - 'Validation parameters controlling validation logic and automatic fixes when parsing LLM output and converting to tabular data.' - ), - attention_backend: zod - .string() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneGenerationOneAttentionBackendDefault - ) - .describe( - "The attention backend for the vLLM engine. Common values: 'FLASHINFER', 'FLASH_ATTN', 'TRITON_ATTN', 'FLEX_ATTENTION'. If ``None`` or 'auto', vLLM will auto-select the best available backend." - ), - }) - .describe( - 'Configuration parameters for synthetic data generation.\n\nThese parameters control how synthetic data is generated after the model is trained.\nThey affect the quality, diversity, and validity of the generated synthetic records.' - ) - .optional() - .describe( - 'Parameters governing synthetic data generation including temperature, top-p, and number of records to produce.' - ), - privacy: zod - .object({ - dp_enabled: zod - .boolean() - .default(safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneDpEnabledDefault) - .describe('Enable differentially-private training with DP-SGD.'), - epsilon: zod - .number() - .default(safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneEpsilonDefault) - .describe( - 'Target privacy budget -- lower values provide stronger privacy. Must be > 0.' - ), - delta: zod - .union([zod.literal('auto'), zod.number()]) - .default(safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOneDeltaDefault) - .describe( - "Probability of accidentally leaking information. Should be much smaller than 1\/n where n is the number of training records. Setting to 'auto' uses delta of 1\/n^1.2. Must be in [0, 1) or 'auto'." - ), - per_sample_max_grad_norm: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOnePrivacyOnePerSampleMaxGradNormDefault - ) - .describe('Maximum L2 norm for per-sample gradient clipping. Must be > 0.'), - }) - .describe( - 'Hyperparameters for differential privacy during training.\n\nThese parameters configure differential privacy (DP) training using DP-SGD algorithm.\nWhen enabled, they provide formal privacy guarantees by adding calibrated noise\nduring training.' - ) - .optional() - .describe( - 'Differential-privacy hyperparameters. When ``None``, differential privacy is disabled entirely.' - ), - time_series: zod - .object({ - is_timeseries: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneTimeSeriesOneIsTimeseriesDefault - ) - .describe( - 'Whether to treat the dataset as time series. When enabled, either ``timestamp_column`` or ``timestamp_interval_seconds`` is required. For grouped time series, ``group_training_examples_by`` needs to be set.' - ), - timestamp_column: zod - .string() - .optional() - .describe( - 'Name of the column containing timestamps used to order records when ``is_timeseries`` is ``True``. Required only when ``is_timeseries`` is ``True`` and ``timestamp_interval_seconds`` is not provided.' - ), - timestamp_interval_seconds: zod - .number() - .optional() - .describe( - 'Interval in seconds between timestamps. If not provided, the timestamp column will be used to infer the interval.' - ), - timestamp_format: zod - .string() - .optional() - .describe( - "Format of the timestamp column. Accepts either: (1) Python strftime format codes for string timestamps (e.g., '%Y-%m-%d %H:%M:%S', '%m\/%d\/%Y'), or (2) 'elapsed_seconds' for numeric (int\/float) timestamps representing seconds as an increasing counter (e.g., 0, 60, 120 for 1-minute intervals). If not provided, the format will be inferred from the data." - ), - start_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Start timestamp. If not provided, the first timestamp in the timestamp column will be used.' - ), - stop_timestamp: zod - .union([zod.string(), zod.number()]) - .optional() - .describe( - 'Stop timestamp. If not provided, the last timestamp in the timestamp column will be used.' - ), - }) - .describe( - 'Configuration for time-series mode in the Safe Synthesizer pipeline.\n\nControls whether a dataset is treated as time-series data, including\ntimestamp column selection, interval inference, and format validation.\nThe time-series pipeline is currently experimental.' - ) - .optional() - .describe( - 'Configuration for time-series mode. Time-series pipeline is currently experimental.' - ), - replace_pii: zod - .object({ - globals: zod - .object({ - locales: zod.array(zod.string()).optional().describe('List of locales.'), - seed: zod.number().optional().describe('Optional random seed.'), - classify: zod - .object({ - enable_classify: zod - .boolean() - .optional() - .describe('Enable column classification.'), - entities: zod - .array(zod.string()) - .optional() - .describe('List of entity types to classify.'), - num_samples: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyOneNumSamplesDefault - ) - .describe('Number of column values to sample for classification.'), - classify_model_provider: zod - .string() - .optional() - .describe( - 'Name of the model provider in the Inference Gateway for column classification. The job compiler will resolve this to the appropriate endpoint URL.' - ), - }) - .describe('Configuration for column classification using an LLM.') - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneClassifyDefault - ) - .describe('Column classification configuration.'), - ner: zod - .object({ - ner_threshold: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneNerThresholdDefault - ) - .describe('NER model threshold.'), - enable_regexps: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneEnableRegexpsDefault - ) - .describe('Enable NER regular expressions (experimental).'), - gliner: zod - .object({ - enable_gliner: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableGlinerDefault - ) - .describe('Enable GLiNER NER module.'), - enable_batch_mode: zod - .boolean() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneEnableBatchModeDefault - ) - .describe('Enable GLiNER batch mode.'), - batch_size: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneBatchSizeDefault - ) - .describe('GLiNER batch size.'), - chunk_length: zod - .number() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneChunkLengthDefault - ) - .describe('GLiNER batch chunk length in characters.'), - gliner_model: zod - .string() - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerOneGlinerModelDefault - ) - .describe('GLiNER model name.'), - }) - .describe('Configuration for the GLiNER named-entity recognition model.') - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerOneGlinerDefault - ) - .describe('GLiNER NER configuration.'), - ner_entities: zod - .array(zod.string()) - .optional() - .describe( - 'List of entity types to recognize. If unset, classification entity types are used.' - ), - }) - .describe('Configuration for Named Entity Recognition.') - .default( - safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneGlobalsOneNerDefault - ) - .describe('Named Entity Recognition configuration.'), - lock_columns: zod - .array(zod.string()) - .optional() - .describe( - 'List of columns to preserve as immutable across all transformations.' - ), - }) - .describe( - 'Global settings for the PII replacer including locales, seed, NER, and classification.' - ) - .optional() - .describe('Global configuration options.'), - steps: zod - .array( - zod - .object({ - vars: zod - .record( - zod.string(), - zod.union([ - zod.string(), - zod.record(zod.string(), zod.unknown()), - zod.array(zod.unknown()), - ]) - ) - .optional() - .describe('Variable names and templates.'), - columns: zod - .object({ - add: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to add.'), - drop: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to drop.'), - rename: zod - .array( - zod - .object({ - name: zod.string().optional().describe('Column name.'), - position: zod - .union([zod.number(), zod.array(zod.number())]) - .optional() - .describe('Column position.'), - condition: zod.string().optional().describe('Column condition.'), - value: zod.string().optional().describe('Rename to value.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Column type match.'), - }) - .describe( - 'Rule matcher for selecting columns by name, position, condition, entity, or type.' - ) - ) - .optional() - .describe('Columns to rename.'), - }) - .describe('Container for column add, drop, and rename operations.') - .optional() - .describe('Columns transform configuration.'), - rows: zod - .object({ - drop: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to drop.'), - update: zod - .array( - zod - .object({ - name: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row name.'), - condition: zod - .string() - .optional() - .describe('Row condition match.'), - foreach: zod.string().optional().describe('Foreach expression.'), - value: zod.string().optional().describe('Row value definition.'), - entity: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row entity match.'), - type: zod - .union([zod.string(), zod.array(zod.string())]) - .optional() - .describe('Row type match.'), - fallback_value: zod - .string() - .optional() - .describe('Row fallback value.'), - description: zod - .string() - .optional() - .describe('Rule description for human consumption.'), - }) - .describe( - 'Rule matcher for selecting rows by name, condition, entity, or type.' - ) - ) - .optional() - .describe('Rows to update.'), - }) - .describe('Container for row drop and update operations.') - .optional() - .describe('Rows transform configurations.'), - }) - .describe( - 'Single transformation step with optional variables, column actions, and row actions.' - ) - ) - .min(1) - .max(safeSynthesizerCancelJobResponseSpecConfigOneReplacePiiOneStepsMax) - .describe('List of transformation steps to perform on input data.'), - }) - .describe( - 'Configuration for PII replacer.\n\nDefines how PII data should be detected and replaced in a dataset.' - ) - .optional() - .describe('PII replacement configuration. When ``None``, PII replacement is skipped.'), - }) - .describe( - 'Main configuration class for the Safe Synthesizer pipeline.\n\nThis is the top-level configuration class that orchestrates all aspects of\nsynthetic data generation including training, generation, privacy, evaluation,\nand data handling. It provides validation to ensure parameter compatibility.' - ) - .describe('The Safe Synthesizer parameters configuration.'), - hf_token_secret: zod - .string() - .optional() - .describe( - 'Name of platform secret containing the HuggingFace token. Must exist in the same workspace as the job.' - ), - enable_synthesis: zod - .boolean() - .default(safeSynthesizerCancelJobResponseSpecEnableSynthesisDefault) - .describe( - 'Whether to run LLM training and generation phases. When False the task only performs PII replacement and returns the processed data.' - ), - }) - .describe( - 'Configuration model for Safe Synthesizer jobs.\n\nUsed primarily internally to configure a run submitted to the NeMo Jobs\nMicroservice.' - ), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .optional() - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()).optional(), - error_details: zod.record(zod.string(), zod.unknown()).optional(), - ownership: zod.record(zod.string(), zod.unknown()).optional(), - custom_fields: zod.record(zod.string(), zod.unknown()).optional(), -}); - -/** - * @summary Get Job Logs - */ -export const SafeSynthesizerGetJobLogsParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -export const SafeSynthesizerGetJobLogsQueryParams = zod.object({ - limit: zod.number().optional(), - page_cursor: zod.string().optional(), -}); - -export const SafeSynthesizerGetJobLogsResponse = zod.object({ - data: zod.array( - zod.object({ - timestamp: zod.string().datetime({}), - job: zod.string(), - job_step: zod.string(), - job_task: zod.string(), - message: zod.string(), - }) - ), - total: zod.number(), - next_page: zod.string(), - prev_page: zod.string(), -}); - -/** - * @summary List Job Results - */ -export const SafeSynthesizerListJobResultsParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -export const SafeSynthesizerListJobResultsResponse = zod.object({ - data: zod.array( - zod.object({ - name: zod.string(), - job: zod.string(), - workspace: zod.string(), - project: zod.string().optional(), - created_at: zod.string().datetime({}).optional(), - updated_at: zod.string().datetime({}).optional(), - artifact_url: zod.string(), - artifact_storage_type: zod.enum(['fileset']), - download_url: zod.string().optional(), - }) - ), -}); - -/** - * @summary Get Job Status - */ -export const SafeSynthesizerGetJobStatusParams = zod.object({ - workspace: zod.string(), - name: zod.string(), -}); - -export const SafeSynthesizerGetJobStatusResponse = zod.object({ - id: zod.string(), - name: zod.string(), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()), - error_details: zod.record(zod.string(), zod.unknown()), - steps: zod.array( - zod.object({ - id: zod.string(), - name: zod.string(), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()), - error_details: zod.record(zod.string(), zod.unknown()), - tasks: zod.array( - zod.object({ - id: zod.string(), - name: zod.string(), - status: zod - .enum([ - 'created', - 'pending', - 'active', - 'cancelled', - 'cancelling', - 'error', - 'completed', - 'paused', - 'pausing', - 'resuming', - ]) - .describe( - 'Enumeration of possible job statuses.\n\nThis enum represents the various states a job can be in during its lifecycle,\nfrom creation to a terminal state.' - ), - status_details: zod.record(zod.string(), zod.unknown()), - error_details: zod.record(zod.string(), zod.unknown()), - error_stack: zod.string(), - created_at: zod.string().datetime({}), - updated_at: zod.string().datetime({}), - }) - ), - created_at: zod.string().datetime({}), - updated_at: zod.string().datetime({}), - }) - ), - created_at: zod.string().datetime({}), - updated_at: zod.string().datetime({}), -}); diff --git a/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.spec.tsx b/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.spec.tsx index 38fff8ac6a..d1590ae139 100644 --- a/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.spec.tsx +++ b/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.spec.tsx @@ -7,8 +7,8 @@ import { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; import { useSafeSynthesizerDownloadJobResultSyntheticData, useSafeSynthesizerListJobResults, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; -import { type SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; +import { type SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { SafeSynthesizerFilesetPreview } from '@studio/components/SafeSynthesizerFilesetPreview'; import { mockUseParams } from '@studio/tests/util/mockUseParams'; @@ -25,8 +25,8 @@ vi.mock('papaparse', () => ({ }, })); -// Mock API hooks — SafeSynthesizer hooks are in the vendored module -vi.mock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ +// Mock generated SafeSynthesizer API hooks +vi.mock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerListJobResults: vi.fn(), useSafeSynthesizerDownloadJobResultSyntheticData: vi.fn(), })); diff --git a/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.tsx b/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.tsx index 170221972e..540d5a3494 100644 --- a/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.tsx +++ b/web/packages/studio/src/components/SafeSynthesizerFilesetPreview/index.tsx @@ -8,8 +8,8 @@ import { useToast } from '@nemo/common/src/providers/toast/useToast'; import { useSafeSynthesizerDownloadJobResultSyntheticData as useDownloadJobResultSyntheticDataV1beta1SafeSynthesizerJobsJobIdResultsSyntheticDataDownloadGet, useSafeSynthesizerListJobResults as useListJobResultsV1beta1SafeSynthesizerJobsJobIdResultsGet, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Anchor, CodeSnippet, diff --git a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.test.tsx b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.test.tsx index 8d7b92d1c4..cadc7ff3b7 100644 --- a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.test.tsx +++ b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.test.tsx @@ -3,7 +3,7 @@ import { ToastProvider } from '@nemo/common/src/providers/toast/ToastProvider'; import { useJobsDeleteJob } from '@nemo/sdk/generated/platform/api'; -import { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; diff --git a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.tsx b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.tsx index cb27f93b20..91b6079fd8 100644 --- a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.tsx +++ b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { useJobsDeleteJob } from '@nemo/sdk/generated/platform/api'; -import { getSafeSynthesizerListJobsQueryKey } from '@nemo/sdk/vendored/safe-synthesizer/api'; -import { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { getSafeSynthesizerListJobsQueryKey } from '@nemo/sdk/generated/safe-synthesizer/api'; +import { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { DeleteConfirmationModal } from '@studio/components/DeleteConfirmationModal'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; import { useQueryClient } from '@tanstack/react-query'; diff --git a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/index.tsx b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/index.tsx index 95658447f5..cba71677c1 100644 --- a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/index.tsx +++ b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/index.tsx @@ -21,12 +21,12 @@ import { getSafeSynthesizerDownloadJobResultSummaryQueryOptions as getDownloadJobResultSummaryQueryOptions, getSafeSynthesizerListJobsQueryKey, useSafeSynthesizerListJobs, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; import { SafeSynthesizerJob, SafeSynthesizerJobsListFilter, SafeSynthesizerJobsSortField, -} from '@nemo/sdk/vendored/safe-synthesizer/schema'; +} from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Banner, Button, Stack } from '@nvidia/foundations-react-core'; import { DeleteJobModal } from '@studio/components/dataViews/SafeSynthesizerJobsDataView/DeleteJobModal'; import { isCancellableJob } from '@studio/components/dataViews/SafeSynthesizerJobsDataView/utils'; diff --git a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.test.ts b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.test.ts index 40b0358a74..ab5f21d5ba 100644 --- a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.test.ts +++ b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.test.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { isCancellableJob } from '@studio/components/dataViews/SafeSynthesizerJobsDataView/utils'; describe('SafeSynthesizerJobsDataView utils', () => { diff --git a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.ts b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.ts index cccddbfa46..1ac7804da0 100644 --- a/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.ts +++ b/web/packages/studio/src/components/dataViews/SafeSynthesizerJobsDataView/utils.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; export const isCancellableJob = (status: SafeSynthesizerJob['status']) => { return status === 'created' || status === 'pending' || status === 'active'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.spec.tsx index efed4de7e9..18bff8ff83 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.spec.tsx @@ -3,7 +3,7 @@ import { MockToastProvider } from '@nemo/common/src/tests/MockToastProvider'; import { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; -import { type SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { type SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { JobConfigDrawer } from '@studio/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer'; import { render, screen } from '@testing-library/react'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.tsx index 35d536cf03..bc9b9d2929 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobConfigDrawer.tsx @@ -4,7 +4,7 @@ import { CodeEditor } from '@nemo/common/src/components/CodeEditor'; import { ContentType } from '@nemo/common/src/components/CodeEditor/constants'; import { useToast } from '@nemo/common/src/providers/toast/useToast'; -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { SidePanel, Stack } from '@nvidia/foundations-react-core'; import { Cog } from 'lucide-react'; import { FC, useMemo } from 'react'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.spec.tsx index fb8a5db521..519cb82db3 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.spec.tsx @@ -3,8 +3,8 @@ import { formatTimeInSeconds, getDifferenceInMilliseconds } from '@nemo/common/src/utils/date'; import type { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; -import * as safeSynthesizerApi from '@nemo/sdk/vendored/safe-synthesizer/api'; -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import * as safeSynthesizerApi from '@nemo/sdk/generated/safe-synthesizer/api'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import * as useDatastoreFileContentModule from '@studio/api/datasets/useDatastoreFileContent'; import { JobDetailsPanel } from '@studio/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.tsx index 42e2983d24..a5b78fce07 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/JobDetailsPanel.tsx @@ -12,7 +12,7 @@ import { utcToLocalDate, } from '@nemo/common/src/utils/date'; import type { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Banner, Button, Divider, Flex, Panel, Stack, Text } from '@nvidia/foundations-react-core'; import { SafeSynthesizerFilesetPreview } from '@studio/components/SafeSynthesizerFilesetPreview'; import { EMPTY_FIELD_VALUE } from '@studio/constants/constants'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/ReportSummaryPanel.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/ReportSummaryPanel.tsx index 5ee4b02a85..10dbaf4cf3 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/ReportSummaryPanel.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/components/ReportSummaryPanel.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { Dial } from '@nemo/common/src/components/Dial'; -import { SafeSynthesizerSummary } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { SafeSynthesizerSummary } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Button, Flex, Panel, Stack, Text } from '@nvidia/foundations-react-core'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; import { getSafeSynthesizerJobReportRoute } from '@studio/routes/utils'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.spec.tsx index b9150328af..e8f95478b3 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.spec.tsx @@ -3,11 +3,11 @@ import { useJobLogs } from '@nemo/common/src/hooks/useJobLogs'; import { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; -import * as safeSynthesizerApi from '@nemo/sdk/vendored/safe-synthesizer/api'; +import * as safeSynthesizerApi from '@nemo/sdk/generated/safe-synthesizer/api'; import { type SafeSynthesizerJob, type SafeSynthesizerSummary, -} from '@nemo/sdk/vendored/safe-synthesizer/schema'; +} from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; import { useBreadcrumbs } from '@studio/providers/breadcrumbs/useBreadcrumbs'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.tsx index de4dad30a6..af185d47ae 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobDetailsRoute/index.tsx @@ -6,7 +6,7 @@ import { PlatformJobStatus } from '@nemo/sdk/generated/platform/schema'; import { useSafeSynthesizerDownloadJobResultSummary as useDownloadJobResultSummaryV1beta1SafeSynthesizerJobsJobIdResultsSummaryDownloadGet, useSafeSynthesizerGetJobSuspense as useGetJobV1beta1SafeSynthesizerJobsJobIdGetSuspense, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; import { Grid, Stack } from '@nvidia/foundations-react-core'; import { AccessibleTitle } from '@studio/components/AccessibleTitle'; import { SafeSynthesizerNavigation } from '@studio/components/SafeSynthesizerNavigation'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.spec.tsx index 1aeef14c5d..4cf9bb6616 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.spec.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { triggerDownload } from '@nemo/common/src/utils/file'; -import * as safeSynthesizerApi from '@nemo/sdk/vendored/safe-synthesizer/api'; -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import * as safeSynthesizerApi from '@nemo/sdk/generated/safe-synthesizer/api'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { OverviewPanel } from '@studio/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel'; import { mockUseParams } from '@studio/tests/util/mockUseParams'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.tsx index 3a8c314748..ef60c7125c 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/OverviewPanel.tsx @@ -5,7 +5,7 @@ import { triggerDownload } from '@nemo/common/src/utils/file'; import { useSafeSynthesizerDownloadJobResultEvaluationReport as useDownloadJobResultEvaluationReportV1beta1SafeSynthesizerJobsJobIdResultsEvaluationReportDownloadGet, useSafeSynthesizerGetJobSuspense as useGetJobV1beta1SafeSynthesizerJobsJobIdGetSuspense, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; import { Button, Panel } from '@nvidia/foundations-react-core'; import { SafeSynthesizerFilesetPreview } from '@studio/components/SafeSynthesizerFilesetPreview'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.spec.tsx index f28ca8ee3b..3407ce0c51 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.spec.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerSummary } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerSummary } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { DataPrivacyPanel } from '@studio/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel'; import { GRADE_VALUES } from '@studio/routes/SafeSynthesizerJobReportRoute/util'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.tsx index ffa5e9c12e..fabcc17824 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/DataPrivacyPanel.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { SafeSynthesizerSummary } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { SafeSynthesizerSummary } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Badge, Flex, diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.spec.tsx index 48b7bae93c..c67dc189c9 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.spec.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerSummary } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerSummary } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { SyntheticQualityPanel } from '@studio/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.tsx index e62c3fa685..c0ff217888 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/SyntheticQualityPanel.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { SafeSynthesizerSummary } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import { SafeSynthesizerSummary } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { Grid, Panel, Stack, Text } from '@nvidia/foundations-react-core'; import { ScoreItem } from '@studio/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/ScoreItem'; import { ScoreTable } from '@studio/routes/SafeSynthesizerJobReportRoute/components/ScorePanels/ScoreTable'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.spec.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.spec.tsx index 6d3616ac84..6e4fc103ec 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.spec.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.spec.tsx @@ -1,11 +1,11 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import * as safeSynthesizerApi from '@nemo/sdk/vendored/safe-synthesizer/api'; +import * as safeSynthesizerApi from '@nemo/sdk/generated/safe-synthesizer/api'; import type { SafeSynthesizerJob, SafeSynthesizerSummary, -} from '@nemo/sdk/vendored/safe-synthesizer/schema'; +} from '@nemo/sdk/generated/safe-synthesizer/schema'; import { ThemeProvider } from '@nvidia/foundations-react-core'; import { useWorkspaceFromPath } from '@studio/hooks/useWorkspaceFromPath'; import { useBreadcrumbs } from '@studio/providers/breadcrumbs/useBreadcrumbs'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.tsx b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.tsx index 8c6ac9fa2a..11284792f6 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerJobReportRoute/index.tsx @@ -4,7 +4,7 @@ import { useSafeSynthesizerDownloadJobResultSummary as useDownloadJobResultSummaryV1beta1SafeSynthesizerJobsJobIdResultsSummaryDownloadGet, useSafeSynthesizerGetJobSuspense as useGetJobV1beta1SafeSynthesizerJobsJobIdGetSuspense, -} from '@nemo/sdk/vendored/safe-synthesizer/api'; +} from '@nemo/sdk/generated/safe-synthesizer/api'; import { Stack } from '@nvidia/foundations-react-core'; import { AccessibleTitle } from '@studio/components/AccessibleTitle'; import { SafeSynthesizerNavigation } from '@studio/components/SafeSynthesizerNavigation'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.test.ts b/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.test.ts index c1a7646f0d..b14ea2cf61 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.test.ts +++ b/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.test.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { isCancellableJob } from '@studio/routes/SafeSynthesizerListRoute/utils'; describe('SafeSynthesizerListRoute utils', () => { diff --git a/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.ts b/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.ts index cccddbfa46..1ac7804da0 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.ts +++ b/web/packages/studio/src/routes/SafeSynthesizerListRoute/utils.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import type { SafeSynthesizerJob } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJob } from '@nemo/sdk/generated/safe-synthesizer/schema'; export const isCancellableJob = (status: SafeSynthesizerJob['status']) => { return status === 'created' || status === 'pending' || status === 'active'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.test.tsx b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.test.tsx index d78963cf07..6e05e7bb03 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.test.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.test.tsx @@ -34,7 +34,7 @@ vi.mock('@studio/providers/breadcrumbs/useBreadcrumbs', () => ({ useBreadcrumbs: mockUseBreadcrumbs, })); -vi.mock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ +vi.mock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: () => ({ mutate: mockMutate, isPending: false, @@ -251,7 +251,7 @@ describe('SafeSynthesizerNewRoute', () => { SAFE_SYNTHESIZER_ENABLED: true, })); - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: () => ({ mutate: mockMutate, isPending: true, @@ -346,7 +346,7 @@ describe('SafeSynthesizerNewRoute', () => { expect(payload.data.spec.config).toHaveProperty('privacy'); }); - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: () => ({ mutate: mockMutateLocal, isPending: false, @@ -390,7 +390,7 @@ describe('SafeSynthesizerNewRoute', () => { })); const mockMutateLocal = vi.fn(); - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: () => ({ mutate: mockMutateLocal, isPending: false, @@ -427,7 +427,7 @@ describe('SafeSynthesizerNewRoute', () => { SAFE_SYNTHESIZER_ENABLED: true, })); - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: () => ({ mutate: mockMutate, isPending: true, @@ -456,7 +456,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onSuccessCallback: ((data: { name?: string }) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onSuccess?: (data: { name?: string }) => void }; }) => { @@ -496,7 +496,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onSuccessCallback: ((data: { name?: string }) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onSuccess?: (data: { name?: string }) => void }; }) => { @@ -537,7 +537,7 @@ describe('SafeSynthesizerNewRoute', () => { let onErrorCallback: ((error: AxiosError) => void) | undefined; let onSuccessCallback: ((data: { name?: string }) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onSuccess?: (data: { name?: string }) => void; @@ -597,7 +597,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onErrorCallback: ((error: AxiosError) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onError?: (error: AxiosError) => void }; }) => { @@ -640,7 +640,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onErrorCallback: ((error: AxiosError) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onError?: (error: AxiosError) => void }; }) => { @@ -688,7 +688,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onErrorCallback: ((error: AxiosError) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onError?: (error: AxiosError) => void }; }) => { @@ -725,7 +725,7 @@ describe('SafeSynthesizerNewRoute', () => { })); let onErrorCallback: ((error: AxiosError) => void) | undefined; - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onError?: (error: AxiosError) => void }; }) => { @@ -841,7 +841,7 @@ describe('SafeSynthesizerNewRoute', () => { let onErrorCallback: ((error: AxiosError) => void) | undefined; const mockMutateLocal = vi.fn(); - vi.doMock('@nemo/sdk/vendored/safe-synthesizer/api', () => ({ + vi.doMock('@nemo/sdk/generated/safe-synthesizer/api', () => ({ useSafeSynthesizerCreateJob: (options?: { mutation?: { onError?: (error: AxiosError) => void }; }) => { diff --git a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx index 8032969d93..8a33b34104 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx +++ b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { zodResolver } from '@hookform/resolvers/zod'; -import { useSafeSynthesizerCreateJob } from '@nemo/sdk/vendored/safe-synthesizer/api'; +import { useSafeSynthesizerCreateJob } from '@nemo/sdk/generated/safe-synthesizer/api'; import { Banner, Button, Divider, Flex, Panel, Stack, Text } from '@nvidia/foundations-react-core'; import { getErrorMessage } from '@studio/api/common/utils'; import { SAFE_SYNTHESIZER_ENABLED } from '@studio/constants/environment'; diff --git a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/schema.ts b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/schema.ts index 60e721cb7f..6df5774a02 100644 --- a/web/packages/studio/src/routes/SafeSynthesizerNewRoute/schema.ts +++ b/web/packages/studio/src/routes/SafeSynthesizerNewRoute/schema.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { generateDefaultName } from '@nemo/common/src/utils/generateDefaultName'; -import type { SafeSynthesizerJobRequest } from '@nemo/sdk/vendored/safe-synthesizer/schema'; +import type { SafeSynthesizerJobRequest } from '@nemo/sdk/generated/safe-synthesizer/schema'; import { MAX_NUM_RECORDS } from '@studio/routes/SafeSynthesizerNewRoute/constants'; import { z } from 'zod';