v1

latestOpenAPI 3.1.02026-07-1255227258.8 KB
entities

Update Instruction

put/instructions/{instruction_id}

Path parameters

instruction_idstring uuid required

The ID of the instruction.

Example:00000000-0000-0000-0000-000000000000

The ID of the instruction.

Request body

activeboolean required

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

Example request

{
  "active": true
}

Response

Successful Response

idstring uuid required
created_atstring date-time required
updated_atstring date-time required
namestring required

The name of the instruction. Must be unique.

activeboolean

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

scope'document' | '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.

promptstring 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.

context_templatestring

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_schemaEntitySchema required
filterobject

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.

partitionstring

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.

Example response

{
  "name": "Find all pizzas",
  "active": true,
  "scope": "document",
  "prompt": "Find all pizzas described in the text.",
  "context_template": "Document: {{document.name}} {{document.metadata.key_foo}}",
  "filter": {
    "toppings": {
      "$in": [
        "pizza",
        "mushrooms"
      ]
    }
  }
}