Skip to content

Validate Extraction Schema

extract.validate_schema(ExtractValidateSchemaParams**kwargs) -> ExtractV2SchemaValidateResponse
POST/api/v2/extract/schema/validation

Validate a JSON schema for extraction.

ParametersExpand Collapse
data_schema: Union[Dict[str, Union[Dict[str, object], Iterable[object], str, 3 more]], str]

Schema to validate

Accepts one of the following:
Dict[str, Union[Dict[str, object], Iterable[object], str, 3 more]]
Accepts one of the following:
Dict[str, object]
Iterable[object]
str
float
bool
str
ReturnsExpand Collapse
class ExtractV2SchemaValidateResponse:

Response schema for schema validation.

data_schema: Dict[str, Union[Dict[str, object], List[object], str, 3 more]]

Validated JSON schema

Accepts one of the following:
Dict[str, object]
List[object]
str
float
bool

Validate Extraction Schema

import os
from llama_cloud import LlamaCloud

client = LlamaCloud(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
extract_v2_schema_validate_response = client.extract.validate_schema(
    data_schema={
        "foo": {
            "foo": "bar"
        }
    },
)
print(extract_v2_schema_validate_response.data_schema)
{
  "data_schema": {
    "foo": {
      "foo": "bar"
    }
  }
}
Returns Examples
{
  "data_schema": {
    "foo": {
      "foo": "bar"
    }
  }
}