Create Instruction

Create a new instruction. Instructions are applied to documents as they are created or updated. The results of the instruction are stored as structured data in the schema defined by the entity_schema parameter. The prompt parameter is a natural language instruction which will be applied to documents. This feature is in beta and may change in the future.

Body Params
string
required

The name of the instruction. Must be unique.

boolean
Defaults to true

Whether the instruction is active. Active instructions are applied to documents when they're created or when their file is updated.

string
enum
Defaults to chunk

The scope of the instruction. Determines whether the instruction is applied to the entire document or to each chunk of the document. Options are 'document' or 'chunk'. Generally 'document' should be used when analyzing the full document is desired, such as when generating a summary or determining sentiment, and 'chunk' should be used when a fine grained search over a document is desired.

Allowed:
string
required

A natural language instruction which will be applied to documents as they are created and updated. The results of the instruction_prompt will be stored as an entity in the schema defined by the entity_schema parameter.

string

An optional mustache style template used to prepend document context to the content sent for entity extraction. Available variables include document.name, document.type, document.source, and nested values under document.metadata.

entity_schema
object
required

The JSON schema definition of the entity generated by an instruction. The schema must define an object at its root. If the instruction is expected to generate multiple items, the root object should have a key which defines an array of the expected items. An instruction which generates multiple emails may be expressed as {"type": "object", "properties": {"emails": { "type": "array", "items": { "type": "string"}}}}. Simple values may be expressed as an object with a single key. For example, a summary instruction may generate a single string value. The schema might be {"type": "object", "properties": { "summary": { "type": "string"}}}.

filter
object

An optional metadata filter that is matched against document metadata during update and creation. The instruction will only be applied to documents with metadata matching the filter. The following filter operators are supported: $eq - Equal to (number, string, boolean), $ne - Not equal to (number, string, boolean), $gt - Greater than (number), $gte - Greater than or equal to (number), $lt - Less than (number), $lte - Less than or equal to (number), $in - In array (string or number), $nin - Not in array (string or number). The operators can be combined with AND and OR. Read Metadata & Filters guide for more details and examples.

string

An optional partition identifier. Instructions can be scoped to a partition. An instruction that defines a partition will only be executed for documents in that partition.

Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json