DataShapeElement

Represents a single variable to be extracted from a document.

type DataShapeElement = {
  name: string;
  type: 'string' | 'number' | 'boolean';
  description?: string;
  isArray?: boolean;
} | {
  name: string;
  type: 'object';
  description?: string;
  isArray?: boolean;
  elements: DataShapeElement[];
};
  • name (string): The name of the variable you want to extract.

  • type ('string' | 'number' | 'boolean' | 'object'): The data type of the variable.

  • description (string, optional): A brief description of the variable.

  • isArray (boolean, optional): Indicates if the variable should be treated as an array.

  • elements (DataShapeElement[], required if type is 'object'): An array of elements describing the shape of the object.

Notes on the description

We want to note that the description is optional but can greatly improve the result. It is used to give our AI a hint as to what you mean by the field that you want to extract.

Example

Let's say you name your field first_name within an E-Mail conversation. Without any further explanation, it might not be clear whether the recipient's or the sender's first name should be returned.

Last updated