AI Functions¶
These dataclasses are used in the SDK to represent API requests and responses for services in the databricks.sdk.service.aifunctions module.
- class databricks.sdk.service.aifunctions.AiClassifyOptions(enable_confidence_scores: bool | None = None, enable_rationales: bool | None = None, instructions: str | None = None, multilabel: bool | None = None, version: str | None = None)¶
ai_classify
- enable_confidence_scores: bool | None = None¶
When true, includes a per-label confidence score in the response.
- enable_rationales: bool | None = None¶
When true, includes a rationale explaining each classification in the response.
- instructions: str | None = None¶
Natural-language guidance that steers how the text is classified (up to 20,000 characters).
- multilabel: bool | None = None¶
When true, allows more than one label to be returned per input.
- version: str | None = None¶
The function version to invoke. Defaults to the latest version. Supported versions: [“2.1”].
- as_dict() dict¶
Serializes the AiClassifyOptions into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiClassifyOptions into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiClassifyOptions¶
Deserializes the AiClassifyOptions from a dictionary.
- class databricks.sdk.service.aifunctions.AiClassifyResponse(metadata: 'Optional[AiClassifyResponseMetadata]' = None, response: 'Optional[any]' = None)¶
- metadata: AiClassifyResponseMetadata | None = None¶
Additional metadata returned by AI Classify.
- response: any | None = None¶
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
multilabelis true. Whenenable_confidence_scoresandenable_rationalesare true,confidence_scoreandrationaleare included in each response value, respectively.
- as_dict() dict¶
Serializes the AiClassifyResponse into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiClassifyResponse into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiClassifyResponse¶
Deserializes the AiClassifyResponse from a dictionary.
- class databricks.sdk.service.aifunctions.AiClassifyResponseMetadata(version: 'Optional[str]' = None)¶
- version: str | None = None¶
The resolved function version.
- as_dict() dict¶
Serializes the AiClassifyResponseMetadata into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiClassifyResponseMetadata into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiClassifyResponseMetadata¶
Deserializes the AiClassifyResponseMetadata from a dictionary.
- class databricks.sdk.service.aifunctions.AiExtractBbox(coord: List[int] | None = None, page_id: int | None = None)¶
A bounding box on a source page; used by bbox-input citations.
- coord: List[int] | None = None¶
Pixel coordinates on the page image as [x0, y0, x1, y1].
- page_id: int | None = None¶
0-based page index the box is on.
- as_dict() dict¶
Serializes the AiExtractBbox into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiExtractBbox into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiExtractBbox¶
Deserializes the AiExtractBbox from a dictionary.
- class databricks.sdk.service.aifunctions.AiExtractCitation(bbox: List[AiExtractBbox] | None = None, id: int | None = None, start: int | None = None, stop: int | None = None)¶
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.
- bbox: List[AiExtractBbox] | None = None¶
Bounding boxes locating the citation on the source pages; set for bbox citations.
- id: int | None = None¶
Integer matching a citation_ids entry on an extracted field.
- start: int | None = None¶
Inclusive 0-based character offset into the input string; set for span citations.
- stop: int | None = None¶
Exclusive 0-based character offset into the input string; set for span citations.
- as_dict() dict¶
Serializes the AiExtractCitation into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiExtractCitation into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiExtractCitation¶
Deserializes the AiExtractCitation from a dictionary.
- class databricks.sdk.service.aifunctions.AiExtractOptions(enable_citations: bool | None = None, enable_confidence_scores: bool | None = None, instructions: str | None = None, mode: str | None = None, version: str | None = None)¶
ai_extract
- enable_citations: bool | None = None¶
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:
For raw text (STRING) inputs, a citation is a span of text in the original input. Each object in
metadata.citationshas anid(integer matching acitation_idsentry on a field), astart(inclusive 0-based character offset into the input string), and astop(exclusive 0-based character offset into the input string).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.citationshas anid(integer matching acitation_idsentry on a field) and abbox(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).
- enable_confidence_scores: bool | None = None¶
When true, includes a per-field confidence score in the response.
- instructions: str | None = None¶
Natural-language guidance that steers how data is extracted (up to 20,000 characters).
- mode: str | None = None¶
Extraction mode. Supported modes: “precision” — more powerful extraction for complex schemas, long documents, and reasoning-heavy extractions. Defaults to none (standard extraction).
- version: str | None = None¶
The function version to invoke. Defaults to the latest version. Supported versions: [“2.1”].
- as_dict() dict¶
Serializes the AiExtractOptions into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiExtractOptions into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiExtractOptions¶
Deserializes the AiExtractOptions from a dictionary.
- class databricks.sdk.service.aifunctions.AiExtractResponse(metadata: 'Optional[AiExtractResponseMetadata]' = None, response: 'Optional[any]' = None)¶
- metadata: AiExtractResponseMetadata | None = None¶
Additional metadata returned by AI Extract.
- response: any | None = None¶
The function result as a JSON value. When
enable_confidence_scoresandenable_citationsare true,confidenceandcitation_idsare included in each response field, respectively.
- as_dict() dict¶
Serializes the AiExtractResponse into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiExtractResponse into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiExtractResponse¶
Deserializes the AiExtractResponse from a dictionary.
- class databricks.sdk.service.aifunctions.AiExtractResponseMetadata(chunk_type: 'Optional[str]' = None, citations: 'Optional[List[AiExtractCitation]]' = None, mode: 'Optional[str]' = None, version: 'Optional[str]' = None)¶
- chunk_type: str | None = None¶
How the source was chunked for citation offsets (span for text input, bbox for parsed-document input); present when citations are enabled.
- citations: List[AiExtractCitation] | None = None¶
Citation objects locating each result in the source; present when citations are enabled.
- mode: str | None = None¶
The resolved extraction mode; present when a non-default mode was used.
- version: str | None = None¶
The resolved function version.
- as_dict() dict¶
Serializes the AiExtractResponseMetadata into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiExtractResponseMetadata into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiExtractResponseMetadata¶
Deserializes the AiExtractResponseMetadata from a dictionary.
- class databricks.sdk.service.aifunctions.AiParseDocumentFileMetadata(file_modification_time: str | None = None, file_name: str | None = None, file_path: str | None = None, file_size: int | None = None)¶
Metadata about the source file; present only for file-path input.
- file_modification_time: str | None = None¶
Last-modified timestamp of the source file, as an HTTP date string.
- file_name: str | None = None¶
Base name of the source file.
- file_path: str | None = None¶
Unity Catalog volume path of the source file.
- file_size: int | None = None¶
Size of the source file in bytes.
- as_dict() dict¶
Serializes the AiParseDocumentFileMetadata into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiParseDocumentFileMetadata into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiParseDocumentFileMetadata¶
Deserializes the AiParseDocumentFileMetadata from a dictionary.
- class databricks.sdk.service.aifunctions.AiParseDocumentOptions(description_element_types: str | None = None, image_output_path: str | None = None, page_range: str | None = None, version: str | None = None)¶
ai_parse_document
- description_element_types: str | None = None¶
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.
- image_output_path: str | None = None¶
Unity Catalog volume path where rendered page and element images are written.
- page_range: str | None = None¶
Pages to parse (1-indexed), as a comma-separated list of page numbers or ranges (e.g. “1,3,5-10”).
- version: str | None = None¶
The ai_parse_document output schema version. Supported value: “2.0”.
- as_dict() dict¶
Serializes the AiParseDocumentOptions into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiParseDocumentOptions into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiParseDocumentOptions¶
Deserializes the AiParseDocumentOptions from a dictionary.
- class databricks.sdk.service.aifunctions.AiParseDocumentPageError(error_message: str | None = None, page_id: int | None = None)¶
A single page that failed to parse while the overall request succeeded.
- error_message: str | None = None¶
Message describing why the page failed.
- page_id: int | None = None¶
0-based index of the page that failed.
- as_dict() dict¶
Serializes the AiParseDocumentPageError into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiParseDocumentPageError into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiParseDocumentPageError¶
Deserializes the AiParseDocumentPageError from a dictionary.
- class databricks.sdk.service.aifunctions.AiParseDocumentResponse(document: 'Optional[any]' = None, error_status: 'Optional[List[AiParseDocumentPageError]]' = None, metadata: 'Optional[AiParseDocumentResponseMetadata]' = None)¶
- document: any | None = None¶
The parsed document as a JSON value, containing the extracted pages and elements.
- error_status: List[AiParseDocumentPageError] | None = None¶
Per-page partial-failure details; present when the request succeeds (2xx) but individual pages fail.
- metadata: AiParseDocumentResponseMetadata | None = None¶
Additional metadata returned by AI Parse Document.
- as_dict() dict¶
Serializes the AiParseDocumentResponse into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiParseDocumentResponse into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiParseDocumentResponse¶
Deserializes the AiParseDocumentResponse from a dictionary.
- class databricks.sdk.service.aifunctions.AiParseDocumentResponseMetadata(file_metadata: 'Optional[AiParseDocumentFileMetadata]' = None, id: 'Optional[str]' = None, version: 'Optional[str]' = None)¶
- file_metadata: AiParseDocumentFileMetadata | None = None¶
Describes the source file; present only for file-path input.
- id: str | None = None¶
Unique identifier for the parse request.
- version: str | None = None¶
The resolved function version.
- as_dict() dict¶
Serializes the AiParseDocumentResponseMetadata into a dictionary suitable for use as a JSON request body.
- as_shallow_dict() dict¶
Serializes the AiParseDocumentResponseMetadata into a shallow dictionary of its immediate attributes.
- classmethod from_dict(d: Dict[str, Any]) AiParseDocumentResponseMetadata¶
Deserializes the AiParseDocumentResponseMetadata from a dictionary.