@databricks/sdk-aifunctions 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.js +1 -1
- package/dist/v1/model.d.ts +4 -4
- package/dist/v1/model.js.map +1 -1
- package/package.json +4 -4
package/dist/package.js
CHANGED
package/dist/v1/model.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ interface AiDecideRequest {
|
|
|
42
42
|
/** A string, JSON object, or array containing the content, related context, and examples needed to answer the provided questions. For example, provide a support message, a conversation, or records describing the current state of an application. All questions receive this same state. */
|
|
43
43
|
state?: JsonValue | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* A JSON object mapping question IDs to their definitions.
|
|
45
|
+
* A JSON object mapping question IDs to their definitions. Each ID must contain non-whitespace text; its answer is returned with the same ID in `response.answers`.
|
|
46
46
|
*
|
|
47
47
|
* Each definition is an object with the required fields `type` and `instructions`. The `criteria` field is optional for the type `noul` but is required for the types `choice` and `score`.
|
|
48
48
|
*
|
|
@@ -65,7 +65,7 @@ interface AiDecideRequest {
|
|
|
65
65
|
* }
|
|
66
66
|
* ```
|
|
67
67
|
*
|
|
68
|
-
* - `noul`: Estimates the probability that the answer to a true-or-false question is true. `criteria` can take the fields `true` or `false`, or both, with descriptions that are strings, objects, or arrays. Omit `criteria` to use the question alone. For example, both of the following are valid:
|
|
68
|
+
* - `noul`: Estimates the probability that the answer to a true-or-false question is true. `criteria` can take the fields `true` or `false`, or both, with descriptions that are strings, objects, or arrays. Omit `criteria` to use the question alone. The instructions or at least one criteria description must contain non-whitespace text, a nonempty object, or a nonempty array. For example, both of the following are valid:
|
|
69
69
|
*
|
|
70
70
|
* ```json
|
|
71
71
|
* {
|
|
@@ -91,7 +91,7 @@ interface AiDecideRequest {
|
|
|
91
91
|
* }
|
|
92
92
|
* ```
|
|
93
93
|
*
|
|
94
|
-
* - `score`: Rates the state on an ordered scale. Requires `criteria` to be an array of 2 to 10 level descriptions, ordered from low to high. Descriptions
|
|
94
|
+
* - `score`: Rates the state on an ordered scale. Requires `criteria` to be an array of 2 to 10 level descriptions, ordered from low to high. Descriptions must contain non-whitespace text, a nonempty object, or a nonempty array. Array positions define levels starting at 0. For example:
|
|
95
95
|
*
|
|
96
96
|
* ```json
|
|
97
97
|
* {
|
|
@@ -271,7 +271,7 @@ interface AiParseDocumentPageError {
|
|
|
271
271
|
pageId?: bigint | undefined;
|
|
272
272
|
}
|
|
273
273
|
interface AiParseDocumentRequest {
|
|
274
|
-
/** The document to parse
|
|
274
|
+
/** The document to parse. The REST API accepts a Unity Catalog volume path to the source file or a base64 data URL containing the file bytes (for example, data:application/pdf;base64,<encoded-file-bytes> or data:image/jpeg;base64,<encoded-file-bytes>). Supported formats: PDF, DOCX, DOC, PPTX, PPT, JPG, JPEG, PNG, TIFF. Accepts up to 100 pages and 100 MB per document. */
|
|
275
275
|
content?: string | undefined;
|
|
276
276
|
/** Function options. Omitted fields fall back to their documented defaults. */
|
|
277
277
|
options?: AiParseDocumentOptions | undefined;
|
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {JsonValue} from '@databricks/sdk-core/wkt';\nimport {z} from 'zod';\n\nconst jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.number(),\n z.string(),\n z.boolean(),\n z.record(z.string(), jsonValueSchema),\n z.array(jsonValueSchema),\n ])\n);\n\n/** ai_classify */\nexport interface AiClassifyOptions {\n /** Natural-language guidance that steers how the text is classified (up to 20,000 characters). */\n instructions?: string | undefined;\n /** The function version to invoke. Defaults to the latest version. Supported versions: [\"2.1\"]. */\n version?: string | undefined;\n /** When true, allows more than one label to be returned per input. */\n multilabel?: boolean | undefined;\n /** When true, includes a per-label confidence score in the response. */\n enableConfidenceScores?: boolean | undefined;\n /** When true, includes a rationale explaining each classification in the response. */\n enableRationales?: boolean | undefined;\n}\n\nexport interface AiClassifyRequest {\n /** The content to classify. It accepts a plain string or the response object of [ai_parse_document](:method:AiFunctions/AiParseDocument). */\n content?: JsonValue | undefined;\n /** The label set to classify as. Either a JSON array of label strings (e.g. [\"spam\", \"not_spam\"]), or a JSON object mapping each label to a description (e.g. {\"spam\": \"unsolicited bulk message\", \"not_spam\": \"a legitimate message\"}). Accepts 2 to 500 labels, each 1 to 100 characters. */\n labels?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiClassifyOptions | undefined;\n}\n\nexport interface AiClassifyResponse {\n /** The function result as a JSON value. An array of per-label objects: one element in single-label mode (the default), or multiple elements when `multilabel` is true. When `enable_confidence_scores` and `enable_rationales` are true, `confidence_score` and `rationale` are included in each response value, respectively. */\n response?: JsonValue | undefined;\n /** Additional metadata returned by AI Classify. */\n metadata?: AiClassifyResponseMetadata | undefined;\n}\n\nexport interface AiClassifyResponseMetadata {\n /** The resolved function version. */\n version?: string | undefined;\n}\n\n/** ai_decide */\nexport interface AiDecideOptions {\n /** The function API version to invoke. Defaults to \"1.0\". Supported versions: [\"1.0\"]. */\n version?: string | undefined;\n}\n\nexport interface AiDecideRequest {\n /** A string, JSON object, or array containing the content, related context, and examples needed to answer the provided questions. For example, provide a support message, a conversation, or records describing the current state of an application. All questions receive this same state. */\n state?: JsonValue | undefined;\n /**\n * A JSON object mapping question IDs to their definitions. Choose a nonempty string for each ID; its answer is returned with the same ID in `response.answers`.\n *\n * Each definition is an object with the required fields `type` and `instructions`. The `criteria` field is optional for the type `noul` but is required for the types `choice` and `score`.\n *\n * The `instructions` field describes the judgment to make and can be a string, object, or array. Use an object or array to include supporting context alongside the instructions.\n *\n * The `type` can be one of:\n *\n * - `choice`: Selects one option from a defined set. Requires `criteria` to be an object mapping 1 to 255 nonempty option names to descriptions. The criteria description can be a string, object, array, or null when the name needs no additional detail. For example:\n *\n * ```json\n * {\n * \"team\": {\n * \"type\": \"choice\",\n * \"instructions\": \"Which team should handle this ticket?\",\n * \"criteria\": {\n * \"billing\": \"Payments, charges, and refunds\",\n * \"technical_support\": null\n * }\n * }\n * }\n * ```\n *\n * - `noul`: Estimates the probability that the answer to a true-or-false question is true. `criteria` can take the fields `true` or `false`, or both, with descriptions that are strings, objects, or arrays. Omit `criteria` to use the question alone. For example, both of the following are valid:\n *\n * ```json\n * {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"instructions\": \"Does this ticket need escalation?\",\n * \"criteria\": {\n * \"true\": \"Suspected fraud or an exception to standard policy\",\n * \"false\": \"A routine issue frontline support can resolve\"\n * }\n * }\n * }\n * ```\n *\n * or\n *\n * ```json\n * {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"instructions\": \"Does this ticket need escalation?\"\n * }\n * }\n * ```\n *\n * - `score`: Rates the state on an ordered scale. Requires `criteria` to be an array of 2 to 10 level descriptions, ordered from low to high. Descriptions can be strings, objects, or arrays. Array positions define levels starting at 0. For example:\n *\n * ```json\n * {\n * \"urgency\": {\n * \"type\": \"score\",\n * \"instructions\": \"How urgent is this ticket?\",\n * \"criteria\": [\n * \"Routine: can wait a few days\",\n * \"Time-sensitive: needs attention today\",\n * \"Critical: needs immediate action\"\n * ]\n * }\n * }\n * ```\n */\n questions?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiDecideOptions | undefined;\n}\n\nexport interface AiDecideResponse {\n /**\n * A JSON object containing an `answers` map with one answer for each question, keyed by the same IDs as `questions`.\n *\n * Each answer has a `type` matching its question and the following fields:\n *\n * - `choice`: choice is the highest-probability option from `criteria`. `probabilities` maps every option name to its probability. `confidence` is a number from 0 to 1 indicating how well the state supports the assessment. The `probabilities` values sum to 1. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"team\": {\n * \"type\": \"choice\",\n * \"choice\": \"billing\",\n * \"probabilities\": {\n * \"billing\": 0.85,\n * \"technical_support\": 0.15\n * },\n * \"confidence\": 0.9\n * }\n * }\n * }\n * ```\n *\n * - `noul`: `probability` is a number from 0 to 1 estimating the probability that the answer is true. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"probability\": 0.8\n * }\n * }\n * }\n * ```\n *\n * - `score`: score is the probability-weighted mean of the zero-based level indices. It can fall between levels, from 0 to the number of levels minus 1. `probabilities` maps each level index to its probability, and `legend` maps each index to its original description. Both maps use string keys such as \"0\", \"1\", and \"2\". `confidence` is a number from 0 to 1 indicating how well the state supports the assessment. The `probabilities` values sum to 1. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"urgency\": {\n * \"type\": \"score\",\n * \"score\": 1.6,\n * \"probabilities\": {\n * \"0\": 0.1,\n * \"1\": 0.2,\n * \"2\": 0.7\n * },\n * \"legend\": {\n * \"0\": \"Routine: can wait a few days\",\n * \"1\": \"Time-sensitive: needs attention today\",\n * \"2\": \"Critical: needs immediate action\"\n * },\n * \"confidence\": 0.85\n * }\n * }\n * }\n * ```\n */\n response?: JsonValue | undefined;\n /** Metadata identifying the function API version used for this request. */\n metadata?: AiDecideResponseMetadata | undefined;\n}\n\nexport interface AiDecideResponseMetadata {\n /** The function API version used to evaluate the request. */\n version?: string | undefined;\n}\n\n/** A bounding box on a source page; used by bbox-input citations. */\nexport interface AiExtractBbox {\n /** Pixel coordinates on the page image as [x0, y0, x1, y1]. */\n coord?: bigint[] | undefined;\n /** 0-based page index the box is on. */\n pageId?: bigint | undefined;\n}\n\n/** A citation locating an extracted value in the source. start/stop are set for span (STRING input) citations, bbox for bbox (parsed-document input) citations. */\nexport interface AiExtractCitation {\n /** Integer matching a citation_ids entry on an extracted field. */\n id?: bigint | undefined;\n /** Inclusive 0-based character offset into the input string; set for span citations. */\n start?: bigint | undefined;\n /** Exclusive 0-based character offset into the input string; set for span citations. */\n stop?: bigint | undefined;\n /** Bounding boxes locating the citation on the source pages; set for bbox citations. */\n bbox?: AiExtractBbox[] | undefined;\n}\n\n/** ai_extract */\nexport interface AiExtractOptions {\n /** Natural-language guidance that steers how data is extracted (up to 20,000 characters). */\n instructions?: string | undefined;\n /** The function version to invoke. Defaults to the latest version. Supported versions: [\"2.1\"]. */\n version?: string | undefined;\n /** Extraction mode. Supported modes: \"precision\" — more powerful extraction for complex schemas, long documents, and reasoning-heavy extractions. Defaults to none (standard extraction). */\n mode?: string | undefined;\n /**\n * When true, includes citation metadata locating each extracted value in the source. Depending on the type of input, citations can be one of two types:\n *\n * For raw text (STRING) inputs, a citation is a span of text in the original input. Each object in `metadata.citations` has an `id` (integer matching a `citation_ids` entry on a field), a `start` (inclusive 0-based character offset into the input string), and a `stop` (exclusive 0-based character offset into the input string).\n *\n * For PDF documents and images (when using ai_extract downstream of ai_parse_document), a citation is a bounding box in the original input. Each object in `metadata.citations` has an `id` (integer matching a `citation_ids` entry on a field) and a `bbox` (array of {coord, page_id} objects, identical in shape to element.bbox in ai_parse_document output; coord is pixel coordinates on the page image as [x0, y0, x1, y1], and page_id is a 0-based page index).\n */\n enableCitations?: boolean | undefined;\n /** When true, includes a per-field confidence score in the response. */\n enableConfidenceScores?: boolean | undefined;\n}\n\nexport interface AiExtractRequest {\n /** The text to extract from. It accepts a plain string or the response object of [ai_parse_document](:method:AiFunctions/AiParseDocument). */\n content?: JsonValue | undefined;\n /** The extraction schema defining the fields to extract. Either a JSON array of field names, assumed to be strings (e.g. [\"company\", \"valuation\"]), or a JSON object mapping each field to its type/description/nullability (e.g. {\"company\": {\"type\": \"string\", \"description\": \"the company name\"}}). Accepts up to 256 fields, 12 levels of nesting, and 500 enum values. Supported field types are string, integer, number, boolean, and enum. */\n schema?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiExtractOptions | undefined;\n}\n\nexport interface AiExtractResponse {\n /** The function result as a JSON value. When `enable_confidence_scores` and `enable_citations` are true, `confidence` and `citation_ids` are included in each response field, respectively. */\n response?: JsonValue | undefined;\n /** Additional metadata returned by AI Extract. */\n metadata?: AiExtractResponseMetadata | undefined;\n}\n\nexport interface AiExtractResponseMetadata {\n /** The resolved function version. */\n version?: string | undefined;\n /** The resolved extraction mode; present when a non-default mode was used. */\n mode?: string | undefined;\n /** How the source was chunked for citation offsets (span for text input, bbox for parsed-document input); present when citations are enabled. */\n chunkType?: string | undefined;\n /** Citation objects locating each result in the source; present when citations are enabled. */\n citations?: AiExtractCitation[] | undefined;\n}\n\n/** Metadata about the source file; present only for file-path input. */\nexport interface AiParseDocumentFileMetadata {\n /** Unity Catalog volume path of the source file. */\n filePath?: string | undefined;\n /** Base name of the source file. */\n fileName?: string | undefined;\n /** Size of the source file in bytes. */\n fileSize?: bigint | undefined;\n /** Last-modified timestamp of the source file, as an HTTP date string. */\n fileModificationTime?: string | undefined;\n}\n\n/** ai_parse_document */\nexport interface AiParseDocumentOptions {\n /** The ai_parse_document output schema version. Supported value: \"2.0\". */\n version?: string | undefined;\n /** Element types for which an AI-generated description is produced. Use \"*\" (default) to generate descriptions for all supported element types, \"figure\" to generate them for figures only, or \"\" (empty string) to generate none. Only figure descriptions are supported for version \"2.0\", so \"*\" and \"figure\" produce the same behavior. */\n descriptionElementTypes?: string | undefined;\n /** Unity Catalog volume path where rendered page and element images are written. */\n imageOutputPath?: string | undefined;\n /** Pages to parse (1-indexed), as a comma-separated list of page numbers or ranges (e.g. \"1,3,5-10\"). */\n pageRange?: string | undefined;\n}\n\n/** A single page that failed to parse while the overall request succeeded. */\nexport interface AiParseDocumentPageError {\n /** Message describing why the page failed. */\n errorMessage?: string | undefined;\n /** 0-based index of the page that failed. */\n pageId?: bigint | undefined;\n}\n\nexport interface AiParseDocumentRequest {\n /** The document to parse, given as a Unity Catalog volume path to the source file (the REST API accepts only a UC volume path, not inline binary data). Supported formats: PDF, DOCX, DOC, PPTX, PPT, JPG, JPEG, PNG, TIFF. Accepts up to 100 pages and 100 MB per document. */\n content?: string | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiParseDocumentOptions | undefined;\n}\n\nexport interface AiParseDocumentResponse {\n /** The parsed document as a JSON value, containing the extracted pages and elements. */\n document?: JsonValue | undefined;\n /** Per-page partial-failure details; present when the request succeeds (2xx) but individual pages fail. */\n errorStatus?: AiParseDocumentPageError[] | undefined;\n /** Additional metadata returned by AI Parse Document. */\n metadata?: AiParseDocumentResponseMetadata | undefined;\n}\n\nexport interface AiParseDocumentResponseMetadata {\n /** Unique identifier for the parse request. */\n id?: string | undefined;\n /** The resolved function version. */\n version?: string | undefined;\n /** Describes the source file; present only for file-path input. */\n fileMetadata?: AiParseDocumentFileMetadata | undefined;\n}\n\nexport const unmarshalAiClassifyResponseSchema: z.ZodType<AiClassifyResponse> =\n z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z\n .lazy(() => unmarshalAiClassifyResponseMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiClassifyResponseMetadataSchema: z.ZodType<AiClassifyResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const unmarshalAiDecideResponseSchema: z.ZodType<AiDecideResponse> = z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z.lazy(() => unmarshalAiDecideResponseMetadataSchema).optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiDecideResponseMetadataSchema: z.ZodType<AiDecideResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const unmarshalAiExtractBboxSchema: z.ZodType<AiExtractBbox> = z\n .object({\n coord: z\n .array(\n z.union([z.number(), z.bigint(), z.string()]).transform(v => BigInt(v))\n )\n .optional(),\n page_id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n })\n .transform(d => ({\n coord: d.coord,\n pageId: d.page_id,\n }));\n\nexport const unmarshalAiExtractCitationSchema: z.ZodType<AiExtractCitation> = z\n .object({\n id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n start: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n stop: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n bbox: z.array(z.lazy(() => unmarshalAiExtractBboxSchema)).optional(),\n })\n .transform(d => ({\n id: d.id,\n start: d.start,\n stop: d.stop,\n bbox: d.bbox,\n }));\n\nexport const unmarshalAiExtractResponseSchema: z.ZodType<AiExtractResponse> = z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z.lazy(() => unmarshalAiExtractResponseMetadataSchema).optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiExtractResponseMetadataSchema: z.ZodType<AiExtractResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n mode: z.string().optional(),\n chunk_type: z.string().optional(),\n citations: z\n .array(z.lazy(() => unmarshalAiExtractCitationSchema))\n .optional(),\n })\n .transform(d => ({\n version: d.version,\n mode: d.mode,\n chunkType: d.chunk_type,\n citations: d.citations,\n }));\n\nexport const unmarshalAiParseDocumentFileMetadataSchema: z.ZodType<AiParseDocumentFileMetadata> =\n z\n .object({\n file_path: z.string().optional(),\n file_name: z.string().optional(),\n file_size: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n file_modification_time: z.string().optional(),\n })\n .transform(d => ({\n filePath: d.file_path,\n fileName: d.file_name,\n fileSize: d.file_size,\n fileModificationTime: d.file_modification_time,\n }));\n\nexport const unmarshalAiParseDocumentPageErrorSchema: z.ZodType<AiParseDocumentPageError> =\n z\n .object({\n error_message: z.string().optional(),\n page_id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n })\n .transform(d => ({\n errorMessage: d.error_message,\n pageId: d.page_id,\n }));\n\nexport const unmarshalAiParseDocumentResponseSchema: z.ZodType<AiParseDocumentResponse> =\n z\n .object({\n document: jsonValueSchema.optional(),\n error_status: z\n .array(z.lazy(() => unmarshalAiParseDocumentPageErrorSchema))\n .optional(),\n metadata: z\n .lazy(() => unmarshalAiParseDocumentResponseMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n document: d.document,\n errorStatus: d.error_status,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiParseDocumentResponseMetadataSchema: z.ZodType<AiParseDocumentResponseMetadata> =\n z\n .object({\n id: z.string().optional(),\n version: z.string().optional(),\n file_metadata: z\n .lazy(() => unmarshalAiParseDocumentFileMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n id: d.id,\n version: d.version,\n fileMetadata: d.file_metadata,\n }));\n\nexport const marshalAiClassifyOptionsSchema: z.ZodType = z\n .object({\n instructions: z.string().optional(),\n version: z.string().optional(),\n multilabel: z.boolean().optional(),\n enableConfidenceScores: z.boolean().optional(),\n enableRationales: z.boolean().optional(),\n })\n .transform(d => ({\n instructions: d.instructions,\n version: d.version,\n multilabel: d.multilabel,\n enable_confidence_scores: d.enableConfidenceScores,\n enable_rationales: d.enableRationales,\n }));\n\nexport const marshalAiClassifyRequestSchema: z.ZodType = z\n .object({\n content: jsonValueSchema.optional(),\n labels: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiClassifyOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n labels: d.labels,\n options: d.options,\n }));\n\nexport const marshalAiDecideOptionsSchema: z.ZodType = z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const marshalAiDecideRequestSchema: z.ZodType = z\n .object({\n state: jsonValueSchema.optional(),\n questions: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiDecideOptionsSchema).optional(),\n })\n .transform(d => ({\n state: d.state,\n questions: d.questions,\n options: d.options,\n }));\n\nexport const marshalAiExtractOptionsSchema: z.ZodType = z\n .object({\n instructions: z.string().optional(),\n version: z.string().optional(),\n mode: z.string().optional(),\n enableCitations: z.boolean().optional(),\n enableConfidenceScores: z.boolean().optional(),\n })\n .transform(d => ({\n instructions: d.instructions,\n version: d.version,\n mode: d.mode,\n enable_citations: d.enableCitations,\n enable_confidence_scores: d.enableConfidenceScores,\n }));\n\nexport const marshalAiExtractRequestSchema: z.ZodType = z\n .object({\n content: jsonValueSchema.optional(),\n schema: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiExtractOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n schema: d.schema,\n options: d.options,\n }));\n\nexport const marshalAiParseDocumentOptionsSchema: z.ZodType = z\n .object({\n version: z.string().optional(),\n descriptionElementTypes: z.string().optional(),\n imageOutputPath: z.string().optional(),\n pageRange: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n description_element_types: d.descriptionElementTypes,\n image_output_path: d.imageOutputPath,\n page_range: d.pageRange,\n }));\n\nexport const marshalAiParseDocumentRequestSchema: z.ZodType = z\n .object({\n content: z.string().optional(),\n options: z.lazy(() => marshalAiParseDocumentOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n options: d.options,\n }));\n"],"mappings":";;;AAKA,MAAM,kBAAwC,EAAE,WAC9C,EAAE,MAAM;CACN,EAAE,MAAM;CACR,EAAE,QAAQ;CACV,EAAE,QAAQ;CACV,EAAE,SAAS;CACX,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB;CACrC,EAAE,MAAM,gBAAgB;CACzB,CAAC,CACH;AAwTD,MAAa,oCACX,EACG,OAAO;CACN,UAAU,gBAAgB,UAAU;CACpC,UAAU,EACP,WAAW,0CAA0C,CACrD,UAAU;CACd,CAAC,CACD,WAAU,OAAM;CACf,UAAU,EAAE;CACZ,UAAU,EAAE;CACb,EAAE;AAEP,MAAa,4CACX,EACG,OAAO,EACN,SAAS,EAAE,QAAQ,CAAC,UAAU,EAC/B,CAAC,CACD,WAAU,OAAM,EACf,SAAS,EAAE,SACZ,EAAE;AAEP,MAAa,kCAA+D,EACzE,OAAO;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ACX,SAAS,EAAE;CACZ,EAAE"}
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {JsonValue} from '@databricks/sdk-core/wkt';\nimport {z} from 'zod';\n\nconst jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.number(),\n z.string(),\n z.boolean(),\n z.record(z.string(), jsonValueSchema),\n z.array(jsonValueSchema),\n ])\n);\n\n/** ai_classify */\nexport interface AiClassifyOptions {\n /** Natural-language guidance that steers how the text is classified (up to 20,000 characters). */\n instructions?: string | undefined;\n /** The function version to invoke. Defaults to the latest version. Supported versions: [\"2.1\"]. */\n version?: string | undefined;\n /** When true, allows more than one label to be returned per input. */\n multilabel?: boolean | undefined;\n /** When true, includes a per-label confidence score in the response. */\n enableConfidenceScores?: boolean | undefined;\n /** When true, includes a rationale explaining each classification in the response. */\n enableRationales?: boolean | undefined;\n}\n\nexport interface AiClassifyRequest {\n /** The content to classify. It accepts a plain string or the response object of [ai_parse_document](:method:AiFunctions/AiParseDocument). */\n content?: JsonValue | undefined;\n /** The label set to classify as. Either a JSON array of label strings (e.g. [\"spam\", \"not_spam\"]), or a JSON object mapping each label to a description (e.g. {\"spam\": \"unsolicited bulk message\", \"not_spam\": \"a legitimate message\"}). Accepts 2 to 500 labels, each 1 to 100 characters. */\n labels?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiClassifyOptions | undefined;\n}\n\nexport interface AiClassifyResponse {\n /** The function result as a JSON value. An array of per-label objects: one element in single-label mode (the default), or multiple elements when `multilabel` is true. When `enable_confidence_scores` and `enable_rationales` are true, `confidence_score` and `rationale` are included in each response value, respectively. */\n response?: JsonValue | undefined;\n /** Additional metadata returned by AI Classify. */\n metadata?: AiClassifyResponseMetadata | undefined;\n}\n\nexport interface AiClassifyResponseMetadata {\n /** The resolved function version. */\n version?: string | undefined;\n}\n\n/** ai_decide */\nexport interface AiDecideOptions {\n /** The function API version to invoke. Defaults to \"1.0\". Supported versions: [\"1.0\"]. */\n version?: string | undefined;\n}\n\nexport interface AiDecideRequest {\n /** A string, JSON object, or array containing the content, related context, and examples needed to answer the provided questions. For example, provide a support message, a conversation, or records describing the current state of an application. All questions receive this same state. */\n state?: JsonValue | undefined;\n /**\n * A JSON object mapping question IDs to their definitions. Each ID must contain non-whitespace text; its answer is returned with the same ID in `response.answers`.\n *\n * Each definition is an object with the required fields `type` and `instructions`. The `criteria` field is optional for the type `noul` but is required for the types `choice` and `score`.\n *\n * The `instructions` field describes the judgment to make and can be a string, object, or array. Use an object or array to include supporting context alongside the instructions.\n *\n * The `type` can be one of:\n *\n * - `choice`: Selects one option from a defined set. Requires `criteria` to be an object mapping 1 to 255 nonempty option names to descriptions. The criteria description can be a string, object, array, or null when the name needs no additional detail. For example:\n *\n * ```json\n * {\n * \"team\": {\n * \"type\": \"choice\",\n * \"instructions\": \"Which team should handle this ticket?\",\n * \"criteria\": {\n * \"billing\": \"Payments, charges, and refunds\",\n * \"technical_support\": null\n * }\n * }\n * }\n * ```\n *\n * - `noul`: Estimates the probability that the answer to a true-or-false question is true. `criteria` can take the fields `true` or `false`, or both, with descriptions that are strings, objects, or arrays. Omit `criteria` to use the question alone. The instructions or at least one criteria description must contain non-whitespace text, a nonempty object, or a nonempty array. For example, both of the following are valid:\n *\n * ```json\n * {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"instructions\": \"Does this ticket need escalation?\",\n * \"criteria\": {\n * \"true\": \"Suspected fraud or an exception to standard policy\",\n * \"false\": \"A routine issue frontline support can resolve\"\n * }\n * }\n * }\n * ```\n *\n * or\n *\n * ```json\n * {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"instructions\": \"Does this ticket need escalation?\"\n * }\n * }\n * ```\n *\n * - `score`: Rates the state on an ordered scale. Requires `criteria` to be an array of 2 to 10 level descriptions, ordered from low to high. Descriptions must contain non-whitespace text, a nonempty object, or a nonempty array. Array positions define levels starting at 0. For example:\n *\n * ```json\n * {\n * \"urgency\": {\n * \"type\": \"score\",\n * \"instructions\": \"How urgent is this ticket?\",\n * \"criteria\": [\n * \"Routine: can wait a few days\",\n * \"Time-sensitive: needs attention today\",\n * \"Critical: needs immediate action\"\n * ]\n * }\n * }\n * ```\n */\n questions?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiDecideOptions | undefined;\n}\n\nexport interface AiDecideResponse {\n /**\n * A JSON object containing an `answers` map with one answer for each question, keyed by the same IDs as `questions`.\n *\n * Each answer has a `type` matching its question and the following fields:\n *\n * - `choice`: choice is the highest-probability option from `criteria`. `probabilities` maps every option name to its probability. `confidence` is a number from 0 to 1 indicating how well the state supports the assessment. The `probabilities` values sum to 1. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"team\": {\n * \"type\": \"choice\",\n * \"choice\": \"billing\",\n * \"probabilities\": {\n * \"billing\": 0.85,\n * \"technical_support\": 0.15\n * },\n * \"confidence\": 0.9\n * }\n * }\n * }\n * ```\n *\n * - `noul`: `probability` is a number from 0 to 1 estimating the probability that the answer is true. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"escalate\": {\n * \"type\": \"noul\",\n * \"probability\": 0.8\n * }\n * }\n * }\n * ```\n *\n * - `score`: score is the probability-weighted mean of the zero-based level indices. It can fall between levels, from 0 to the number of levels minus 1. `probabilities` maps each level index to its probability, and `legend` maps each index to its original description. Both maps use string keys such as \"0\", \"1\", and \"2\". `confidence` is a number from 0 to 1 indicating how well the state supports the assessment. The `probabilities` values sum to 1. For example:\n *\n * ```json\n * {\n * \"answers\": {\n * \"urgency\": {\n * \"type\": \"score\",\n * \"score\": 1.6,\n * \"probabilities\": {\n * \"0\": 0.1,\n * \"1\": 0.2,\n * \"2\": 0.7\n * },\n * \"legend\": {\n * \"0\": \"Routine: can wait a few days\",\n * \"1\": \"Time-sensitive: needs attention today\",\n * \"2\": \"Critical: needs immediate action\"\n * },\n * \"confidence\": 0.85\n * }\n * }\n * }\n * ```\n */\n response?: JsonValue | undefined;\n /** Metadata identifying the function API version used for this request. */\n metadata?: AiDecideResponseMetadata | undefined;\n}\n\nexport interface AiDecideResponseMetadata {\n /** The function API version used to evaluate the request. */\n version?: string | undefined;\n}\n\n/** A bounding box on a source page; used by bbox-input citations. */\nexport interface AiExtractBbox {\n /** Pixel coordinates on the page image as [x0, y0, x1, y1]. */\n coord?: bigint[] | undefined;\n /** 0-based page index the box is on. */\n pageId?: bigint | undefined;\n}\n\n/** A citation locating an extracted value in the source. start/stop are set for span (STRING input) citations, bbox for bbox (parsed-document input) citations. */\nexport interface AiExtractCitation {\n /** Integer matching a citation_ids entry on an extracted field. */\n id?: bigint | undefined;\n /** Inclusive 0-based character offset into the input string; set for span citations. */\n start?: bigint | undefined;\n /** Exclusive 0-based character offset into the input string; set for span citations. */\n stop?: bigint | undefined;\n /** Bounding boxes locating the citation on the source pages; set for bbox citations. */\n bbox?: AiExtractBbox[] | undefined;\n}\n\n/** ai_extract */\nexport interface AiExtractOptions {\n /** Natural-language guidance that steers how data is extracted (up to 20,000 characters). */\n instructions?: string | undefined;\n /** The function version to invoke. Defaults to the latest version. Supported versions: [\"2.1\"]. */\n version?: string | undefined;\n /** Extraction mode. Supported modes: \"precision\" — more powerful extraction for complex schemas, long documents, and reasoning-heavy extractions. Defaults to none (standard extraction). */\n mode?: string | undefined;\n /**\n * When true, includes citation metadata locating each extracted value in the source. Depending on the type of input, citations can be one of two types:\n *\n * For raw text (STRING) inputs, a citation is a span of text in the original input. Each object in `metadata.citations` has an `id` (integer matching a `citation_ids` entry on a field), a `start` (inclusive 0-based character offset into the input string), and a `stop` (exclusive 0-based character offset into the input string).\n *\n * For PDF documents and images (when using ai_extract downstream of ai_parse_document), a citation is a bounding box in the original input. Each object in `metadata.citations` has an `id` (integer matching a `citation_ids` entry on a field) and a `bbox` (array of {coord, page_id} objects, identical in shape to element.bbox in ai_parse_document output; coord is pixel coordinates on the page image as [x0, y0, x1, y1], and page_id is a 0-based page index).\n */\n enableCitations?: boolean | undefined;\n /** When true, includes a per-field confidence score in the response. */\n enableConfidenceScores?: boolean | undefined;\n}\n\nexport interface AiExtractRequest {\n /** The text to extract from. It accepts a plain string or the response object of [ai_parse_document](:method:AiFunctions/AiParseDocument). */\n content?: JsonValue | undefined;\n /** The extraction schema defining the fields to extract. Either a JSON array of field names, assumed to be strings (e.g. [\"company\", \"valuation\"]), or a JSON object mapping each field to its type/description/nullability (e.g. {\"company\": {\"type\": \"string\", \"description\": \"the company name\"}}). Accepts up to 256 fields, 12 levels of nesting, and 500 enum values. Supported field types are string, integer, number, boolean, and enum. */\n schema?: JsonValue | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiExtractOptions | undefined;\n}\n\nexport interface AiExtractResponse {\n /** The function result as a JSON value. When `enable_confidence_scores` and `enable_citations` are true, `confidence` and `citation_ids` are included in each response field, respectively. */\n response?: JsonValue | undefined;\n /** Additional metadata returned by AI Extract. */\n metadata?: AiExtractResponseMetadata | undefined;\n}\n\nexport interface AiExtractResponseMetadata {\n /** The resolved function version. */\n version?: string | undefined;\n /** The resolved extraction mode; present when a non-default mode was used. */\n mode?: string | undefined;\n /** How the source was chunked for citation offsets (span for text input, bbox for parsed-document input); present when citations are enabled. */\n chunkType?: string | undefined;\n /** Citation objects locating each result in the source; present when citations are enabled. */\n citations?: AiExtractCitation[] | undefined;\n}\n\n/** Metadata about the source file; present only for file-path input. */\nexport interface AiParseDocumentFileMetadata {\n /** Unity Catalog volume path of the source file. */\n filePath?: string | undefined;\n /** Base name of the source file. */\n fileName?: string | undefined;\n /** Size of the source file in bytes. */\n fileSize?: bigint | undefined;\n /** Last-modified timestamp of the source file, as an HTTP date string. */\n fileModificationTime?: string | undefined;\n}\n\n/** ai_parse_document */\nexport interface AiParseDocumentOptions {\n /** The ai_parse_document output schema version. Supported value: \"2.0\". */\n version?: string | undefined;\n /** Element types for which an AI-generated description is produced. Use \"*\" (default) to generate descriptions for all supported element types, \"figure\" to generate them for figures only, or \"\" (empty string) to generate none. Only figure descriptions are supported for version \"2.0\", so \"*\" and \"figure\" produce the same behavior. */\n descriptionElementTypes?: string | undefined;\n /** Unity Catalog volume path where rendered page and element images are written. */\n imageOutputPath?: string | undefined;\n /** Pages to parse (1-indexed), as a comma-separated list of page numbers or ranges (e.g. \"1,3,5-10\"). */\n pageRange?: string | undefined;\n}\n\n/** A single page that failed to parse while the overall request succeeded. */\nexport interface AiParseDocumentPageError {\n /** Message describing why the page failed. */\n errorMessage?: string | undefined;\n /** 0-based index of the page that failed. */\n pageId?: bigint | undefined;\n}\n\nexport interface AiParseDocumentRequest {\n /** The document to parse. The REST API accepts a Unity Catalog volume path to the source file or a base64 data URL containing the file bytes (for example, data:application/pdf;base64,<encoded-file-bytes> or data:image/jpeg;base64,<encoded-file-bytes>). Supported formats: PDF, DOCX, DOC, PPTX, PPT, JPG, JPEG, PNG, TIFF. Accepts up to 100 pages and 100 MB per document. */\n content?: string | undefined;\n /** Function options. Omitted fields fall back to their documented defaults. */\n options?: AiParseDocumentOptions | undefined;\n}\n\nexport interface AiParseDocumentResponse {\n /** The parsed document as a JSON value, containing the extracted pages and elements. */\n document?: JsonValue | undefined;\n /** Per-page partial-failure details; present when the request succeeds (2xx) but individual pages fail. */\n errorStatus?: AiParseDocumentPageError[] | undefined;\n /** Additional metadata returned by AI Parse Document. */\n metadata?: AiParseDocumentResponseMetadata | undefined;\n}\n\nexport interface AiParseDocumentResponseMetadata {\n /** Unique identifier for the parse request. */\n id?: string | undefined;\n /** The resolved function version. */\n version?: string | undefined;\n /** Describes the source file; present only for file-path input. */\n fileMetadata?: AiParseDocumentFileMetadata | undefined;\n}\n\nexport const unmarshalAiClassifyResponseSchema: z.ZodType<AiClassifyResponse> =\n z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z\n .lazy(() => unmarshalAiClassifyResponseMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiClassifyResponseMetadataSchema: z.ZodType<AiClassifyResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const unmarshalAiDecideResponseSchema: z.ZodType<AiDecideResponse> = z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z.lazy(() => unmarshalAiDecideResponseMetadataSchema).optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiDecideResponseMetadataSchema: z.ZodType<AiDecideResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const unmarshalAiExtractBboxSchema: z.ZodType<AiExtractBbox> = z\n .object({\n coord: z\n .array(\n z.union([z.number(), z.bigint(), z.string()]).transform(v => BigInt(v))\n )\n .optional(),\n page_id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n })\n .transform(d => ({\n coord: d.coord,\n pageId: d.page_id,\n }));\n\nexport const unmarshalAiExtractCitationSchema: z.ZodType<AiExtractCitation> = z\n .object({\n id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n start: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n stop: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n bbox: z.array(z.lazy(() => unmarshalAiExtractBboxSchema)).optional(),\n })\n .transform(d => ({\n id: d.id,\n start: d.start,\n stop: d.stop,\n bbox: d.bbox,\n }));\n\nexport const unmarshalAiExtractResponseSchema: z.ZodType<AiExtractResponse> = z\n .object({\n response: jsonValueSchema.optional(),\n metadata: z.lazy(() => unmarshalAiExtractResponseMetadataSchema).optional(),\n })\n .transform(d => ({\n response: d.response,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiExtractResponseMetadataSchema: z.ZodType<AiExtractResponseMetadata> =\n z\n .object({\n version: z.string().optional(),\n mode: z.string().optional(),\n chunk_type: z.string().optional(),\n citations: z\n .array(z.lazy(() => unmarshalAiExtractCitationSchema))\n .optional(),\n })\n .transform(d => ({\n version: d.version,\n mode: d.mode,\n chunkType: d.chunk_type,\n citations: d.citations,\n }));\n\nexport const unmarshalAiParseDocumentFileMetadataSchema: z.ZodType<AiParseDocumentFileMetadata> =\n z\n .object({\n file_path: z.string().optional(),\n file_name: z.string().optional(),\n file_size: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n file_modification_time: z.string().optional(),\n })\n .transform(d => ({\n filePath: d.file_path,\n fileName: d.file_name,\n fileSize: d.file_size,\n fileModificationTime: d.file_modification_time,\n }));\n\nexport const unmarshalAiParseDocumentPageErrorSchema: z.ZodType<AiParseDocumentPageError> =\n z\n .object({\n error_message: z.string().optional(),\n page_id: z\n .union([z.number(), z.bigint(), z.string()])\n .transform(v => BigInt(v))\n .optional(),\n })\n .transform(d => ({\n errorMessage: d.error_message,\n pageId: d.page_id,\n }));\n\nexport const unmarshalAiParseDocumentResponseSchema: z.ZodType<AiParseDocumentResponse> =\n z\n .object({\n document: jsonValueSchema.optional(),\n error_status: z\n .array(z.lazy(() => unmarshalAiParseDocumentPageErrorSchema))\n .optional(),\n metadata: z\n .lazy(() => unmarshalAiParseDocumentResponseMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n document: d.document,\n errorStatus: d.error_status,\n metadata: d.metadata,\n }));\n\nexport const unmarshalAiParseDocumentResponseMetadataSchema: z.ZodType<AiParseDocumentResponseMetadata> =\n z\n .object({\n id: z.string().optional(),\n version: z.string().optional(),\n file_metadata: z\n .lazy(() => unmarshalAiParseDocumentFileMetadataSchema)\n .optional(),\n })\n .transform(d => ({\n id: d.id,\n version: d.version,\n fileMetadata: d.file_metadata,\n }));\n\nexport const marshalAiClassifyOptionsSchema: z.ZodType = z\n .object({\n instructions: z.string().optional(),\n version: z.string().optional(),\n multilabel: z.boolean().optional(),\n enableConfidenceScores: z.boolean().optional(),\n enableRationales: z.boolean().optional(),\n })\n .transform(d => ({\n instructions: d.instructions,\n version: d.version,\n multilabel: d.multilabel,\n enable_confidence_scores: d.enableConfidenceScores,\n enable_rationales: d.enableRationales,\n }));\n\nexport const marshalAiClassifyRequestSchema: z.ZodType = z\n .object({\n content: jsonValueSchema.optional(),\n labels: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiClassifyOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n labels: d.labels,\n options: d.options,\n }));\n\nexport const marshalAiDecideOptionsSchema: z.ZodType = z\n .object({\n version: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n }));\n\nexport const marshalAiDecideRequestSchema: z.ZodType = z\n .object({\n state: jsonValueSchema.optional(),\n questions: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiDecideOptionsSchema).optional(),\n })\n .transform(d => ({\n state: d.state,\n questions: d.questions,\n options: d.options,\n }));\n\nexport const marshalAiExtractOptionsSchema: z.ZodType = z\n .object({\n instructions: z.string().optional(),\n version: z.string().optional(),\n mode: z.string().optional(),\n enableCitations: z.boolean().optional(),\n enableConfidenceScores: z.boolean().optional(),\n })\n .transform(d => ({\n instructions: d.instructions,\n version: d.version,\n mode: d.mode,\n enable_citations: d.enableCitations,\n enable_confidence_scores: d.enableConfidenceScores,\n }));\n\nexport const marshalAiExtractRequestSchema: z.ZodType = z\n .object({\n content: jsonValueSchema.optional(),\n schema: jsonValueSchema.optional(),\n options: z.lazy(() => marshalAiExtractOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n schema: d.schema,\n options: d.options,\n }));\n\nexport const marshalAiParseDocumentOptionsSchema: z.ZodType = z\n .object({\n version: z.string().optional(),\n descriptionElementTypes: z.string().optional(),\n imageOutputPath: z.string().optional(),\n pageRange: z.string().optional(),\n })\n .transform(d => ({\n version: d.version,\n description_element_types: d.descriptionElementTypes,\n image_output_path: d.imageOutputPath,\n page_range: d.pageRange,\n }));\n\nexport const marshalAiParseDocumentRequestSchema: z.ZodType = z\n .object({\n content: z.string().optional(),\n options: z.lazy(() => marshalAiParseDocumentOptionsSchema).optional(),\n })\n .transform(d => ({\n content: d.content,\n options: d.options,\n }));\n"],"mappings":";;;AAKA,MAAM,kBAAwC,EAAE,WAC9C,EAAE,MAAM;CACN,EAAE,MAAM;CACR,EAAE,QAAQ;CACV,EAAE,QAAQ;CACV,EAAE,SAAS;CACX,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB;CACrC,EAAE,MAAM,gBAAgB;CACzB,CAAC,CACH;AAwTD,MAAa,oCACX,EACG,OAAO;CACN,UAAU,gBAAgB,UAAU;CACpC,UAAU,EACP,WAAW,0CAA0C,CACrD,UAAU;CACd,CAAC,CACD,WAAU,OAAM;CACf,UAAU,EAAE;CACZ,UAAU,EAAE;CACb,EAAE;AAEP,MAAa,4CACX,EACG,OAAO,EACN,SAAS,EAAE,QAAQ,CAAC,UAAU,EAC/B,CAAC,CACD,WAAU,OAAM,EACf,SAAS,EAAE,SACZ,EAAE;AAEP,MAAa,kCAA+D,EACzE,OAAO;CACN,UAAU,gBAAgB,UAAU;CACpC,UAAU,EAAE,WAAW,wCAAwC,CAAC,UAAU;CAC3E,CAAC,CACD,WAAU,OAAM;CACf,UAAU,EAAE;CACZ,UAAU,EAAE;CACb,EAAE;AAEL,MAAa,0CACX,EACG,OAAO,EACN,SAAS,EAAE,QAAQ,CAAC,UAAU,EAC/B,CAAC,CACD,WAAU,OAAM,EACf,SAAS,EAAE,SACZ,EAAE;AAEP,MAAa,+BAAyD,EACnE,OAAO;CACN,OAAO,EACJ,MACC,EAAE,MAAM;EAAC,EAAE,QAAQ;EAAE,EAAE,QAAQ;EAAE,EAAE,QAAQ;EAAC,CAAC,CAAC,WAAU,MAAK,OAAO,EAAE,CAAC,CACxE,CACA,UAAU;CACb,SAAS,EACN,MAAM;EAAC,EAAE,QAAQ;EAAE,EAAE,QAAQ;EAAE,EAAE,QAAQ;EAAC,C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EL,MAAa,gCAA2C,EACrD,OAAO;CACN,SAAS,gBAAgB,UAAU;CACnC,QAAQ,gBAAgB,UAAU;CAClC,SAAS,EAAE,WAAW,8BAA8B,CAAC,UAAU;CAChE,CAAC,CACD,WAAU,OAAM;CACf,SAAS,EAAE;CACX,QAAQ,EAAE;CACV,SAAS,EAAE;CACZ,EAAE;AAEL,MAAa,sCAAiD,EAC3D,OAAO;CACN,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC9B,yBAAyB,EAAE,QAAQ,CAAC,UAAU;CAC9C,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC,CACD,WAAU,OAAM;CACf,SAAS,EAAE;CACX,2BAA2B,EAAE;CAC7B,mBAAmB,EAAE;CACrB,YAAY,EAAE;CACf,EAAE;AAEL,MAAa,sCAAiD,EAC3D,OAAO;CACN,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC9B,SAAS,EAAE,WAAW,oCAAoC,CAAC,UAAU;CACtE,CAAC,CACD,WAAU,OAAM;CACf,SAAS,EAAE;CACX,SAAS,EAAE;CACZ,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-aifunctions",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"directory": "packages/aifunctions"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@databricks/sdk-auth": ">=0.
|
|
37
|
-
"@databricks/sdk-core": ">=0.51.
|
|
38
|
-
"@databricks/sdk-options": ">=0.51.
|
|
36
|
+
"@databricks/sdk-auth": ">=0.52.0 <1.0.0",
|
|
37
|
+
"@databricks/sdk-core": ">=0.51.1 <1.0.0",
|
|
38
|
+
"@databricks/sdk-options": ">=0.51.1 <1.0.0",
|
|
39
39
|
"@js-temporal/polyfill": "^0.5.0",
|
|
40
40
|
"json-bigint": "^1.0.0",
|
|
41
41
|
"zod": "^4.3.6"
|