{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/zia-ai/platform/pkg/playbooks/etl/json/workspace",
  "$ref": "#/$defs/Workspace",
  "$defs": {
    "AnnotationSpan": {
      "properties": {
        "from_character": {
          "type": "integer",
          "description": "Inclusive start index of the span in characters."
        },
        "to_character": {
          "type": "integer",
          "description": "Exclusive end index of the span in characters."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "from_character",
        "to_character"
      ]
    },
    "Entity": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the entity.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this entity will also be translated.\nUse `source.source_id` to store the original id."
        },
        "name": {
          "type": "string",
          "description": "Name of the entity.\nEx: city"
        },
        "values": {
          "items": {
            "$ref": "#/$defs/EntityValue"
          },
          "type": "array",
          "description": "Values of the entity. They represent the different instances of the entity.\nEx: new york, montreal, etc.\n\nFor regex entities, each value represent a different regular expression.\n\nFor system entities, values can be used to extend the potential values of the\nentity, but only if the extension is possible for the type of system entity."
        },
        "is_regex": {
          "type": "boolean",
          "description": "Indicates that the entity of type regex. Values of the entity are regular expressions."
        },
        "system_type": {
          "type": "string",
          "description": "(Optional) If specified, indicates that the is a pre-trained system entity (ex: time, date, etc.)\nThis field will contain the type of the system entity, as defined in HumanFirst."
        },
        "tags": {
          "items": {
            "$ref": "#/$defs/TagReference"
          },
          "type": "array",
          "description": "(Optional) List of tags for the entity."
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "(Optional) Key-value metadata of the entity."
        },
        "source": {
          "$ref": "#/$defs/EntitySource",
          "description": "(Optional) Information about the source of the entity."
        },
        "settings": {
          "$ref": "#/$defs/EntitySettings",
          "description": "(Optional) Settings of the entity."
        },
        "created_at": {
          "type": "string",
          "description": "(Optional) Creation timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "updated_at": {
          "type": "string",
          "description": "(Optional) Update timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "deleted_at": {
          "type": "string",
          "description": "(Optional) Deletion timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name"
      ]
    },
    "EntityReference": {
      "properties": {
        "entity_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the entity.\nIf not specified, the entity key needs to be specified."
        },
        "name": {
          "type": "string",
          "description": "(Optional) Name of the entity.\nIf not specified, entity_id needs to be specified.\nEx: `I'd like to visit [New York City](city)` where `city` is the name."
        },
        "text": {
          "type": "string",
          "description": "Text used to reference the entity in the example.\nEx: `I'd like to visit [New York City](city)` where `New York City` is the text."
        },
        "span": {
          "$ref": "#/$defs/AnnotationSpan",
          "description": "(Optional) Span of the entity in the example.\nIf the reference is provided through a `TextPart`, the span is not required\nsince parts are presenting the text and entities."
        },
        "value": {
          "type": "string",
          "description": "(Optional) Entity value `key_value` that this entity points to. This\ncorresponds to the entity value's `key_value` field.\n\n Ex: `I went to [NYC]{\"entity\": \"city\", \"value\": \"New York City\"}`\n     where 'New York City' is the value, 'city' is the key.\n\nIf unspecified, the text will be used."
        },
        "value_id": {
          "type": "string",
          "description": "(Optional) Entity value unique identifier.\nIf not specified, the value will be used if it's specified."
        },
        "role": {
          "type": "string",
          "description": "(Optional) Role of the entity in the example if there are more than one present.\nEx: `I'm flying from new york city to montreal` could have a `from` and a `to` role."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "text"
      ]
    },
    "EntitySettings": {
      "properties": {
        "allowed_intent_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "(Optional) List of intents that are allowed to use this entity for annotations."
        },
        "denied_intent_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "(Optional) List of intents that are not allowed to use this entity for annotations."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "EntitySource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the entity in the source system."
        },
        "metadata": {
          "type": "object",
          "description": "(Optional) Extra metadata about the entity in the source system."
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of entity from HumanFirst or\nexternal integrations that got merged into this entity\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "EntityValue": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the entity value.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this intent will also be translated.\nUse `source.source_id` to store the original id."
        },
        "key_value": {
          "type": "string",
          "description": "(Optional) Key value of the entity. This corresponds to the main disambiguated\nvalue of the entity value.\nEx: New York City"
        },
        "entities": {
          "items": {
            "$ref": "#/$defs/EntityReference"
          },
          "type": "array",
          "description": "(Optional) If supported by the NLU engine, entities referenced in `key_value`.\nEx: DialogFlow composite entities are referenced here.\n\nIf the `key_value_parts` field is provided at import, this field is ignored and\nbuilt from `key_value_parts`."
        },
        "key_value_parts": {
          "items": {
            "$ref": "#/$defs/TextPart"
          },
          "type": "array",
          "description": "(Optional) If supported by the NLU engine and that `key_value` contains entity references,\nthis field contains the parts of the text and the entities. The parts are concatenated\nto form the final text.\n\nParts are provided to ease entity annotations. If provided at import, this will take\nprecedence over the `entities` field."
        },
        "language": {
          "type": "string",
          "description": "(Optional) Language of the entity value.\nThis is in two-letter ISO 639-1 format."
        },
        "synonyms": {
          "items": {
            "$ref": "#/$defs/EntityValueSynonym"
          },
          "type": "array",
          "description": "(Optional) Synonyms of the entity value.\nEx: New York, NYC, The Big Apple"
        },
        "source": {
          "$ref": "#/$defs/EntityValueSource",
          "description": "(Optional) Information about the source of the entity value."
        },
        "created_at": {
          "type": "string",
          "description": "(Optional) Creation, update and deletion timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "updated_at": {
          "type": "string"
        },
        "deleted_at": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "EntityValueSource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the entity in the source system."
        },
        "metadata": {
          "type": "object",
          "description": "(Optional) Extra metadata about the entity value in the source system."
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of entity values from HumanFirst or\nexternal integrations that got merged into this entity values\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "EntityValueSynonym": {
      "properties": {
        "value": {
          "type": "string",
          "description": "Value / text of the synonym."
        },
        "entities": {
          "items": {
            "$ref": "#/$defs/EntityReference"
          },
          "type": "array",
          "description": "(Optional) Entities annotated in the `value`. This is used\nwhen the entity is a composed entity that references other\nentities.\n\nIf the `parts` field is provided at import, this field is ignored and\nbuilt from `parts`."
        },
        "parts": {
          "items": {
            "$ref": "#/$defs/TextPart"
          },
          "type": "array",
          "description": "(Optional) Parts of the text and the entities constituting `value`.\nThis is used when the entity is a composed entity that references other\nentities (composite entities).\n\nThe parts are concatenated to form the final `value`. Parts are provided\nto ease entity annotations. If provided at import, this will take precedence\nover the `entities` field."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "value"
      ]
    },
    "Example": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the example.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this example will also be translated.\nUse `source.source_id` to store the original id."
        },
        "text": {
          "type": "string",
          "description": "Text of the example."
        },
        "intents": {
          "items": {
            "$ref": "#/$defs/ExampleIntent"
          },
          "type": "array",
          "description": "(Optional) Intents into which the example is classified."
        },
        "matching_intents": {
          "items": {
            "$ref": "#/$defs/ExampleMatchingIntent"
          },
          "type": "array",
          "description": "(Optional) Intents that the example is matched against.\nThis field is only populated when downloading examples,\nand is not used for importing purposes."
        },
        "entities": {
          "items": {
            "$ref": "#/$defs/EntityReference"
          },
          "type": "array",
          "description": "(Optional) Entities annotated in the example.\nIf the `parts` field is provided at import, this field is ignored and built from `parts`."
        },
        "parts": {
          "items": {
            "$ref": "#/$defs/TextPart"
          },
          "type": "array",
          "description": "(Optional) If the example contains entities, this field contains parts of the\ntext and the entities. The parts are concatenated to form the final text.\n\nParts are provided to ease entity annotations. If provided at import, this\nwill take precedence over the `entities` field."
        },
        "context": {
          "$ref": "#/$defs/ExampleContext",
          "description": "(Optional) Information on the context of the example."
        },
        "source": {
          "$ref": "#/$defs/ExampleSource",
          "description": "(Optional) Information on the source of the example."
        },
        "tags": {
          "items": {
            "$ref": "#/$defs/TagReference"
          },
          "type": "array",
          "description": "(Optional) List of tags for the example."
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "(Optional) Key-value metadata of the example."
        },
        "created_at": {
          "type": "string",
          "description": "(Optional) Creation timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "updated_at": {
          "type": "string",
          "description": "(Optional) Update timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "deleted_at": {
          "type": "string",
          "description": "(Optional) Deletion timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "text"
      ]
    },
    "ExampleContext": {
      "properties": {
        "context_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the context in which the example is used.\nEx: conversation id in which the example was seen."
        },
        "type": {
          "type": "string",
          "description": "(Optional) Type of context in which the example is used.\nEx: conversation, utterance, training_phrase"
        },
        "role": {
          "type": "string",
          "description": "(Optional) In the case of an utterance / conversation input, role of the person who did the\nutterance. Ex: \"client\" \"expert\""
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "ExampleIntent": {
      "properties": {
        "intent_id": {
          "type": "string",
          "description": "Unique identifier of the intent."
        },
        "negative": {
          "type": "boolean",
          "description": "Indicates if the example is in the negative examples of the intent.\nA negative example is only used to train the intent and is created by rejecting\nsuggestions in HumanFirst studio."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "intent_id"
      ]
    },
    "ExampleMatchingIntent": {
      "properties": {
        "nlu_engine_id": {
          "type": "string",
          "description": "Unique identifier of the NLU engine that matched the intent."
        },
        "nlu_engine_name": {
          "type": "string",
          "description": "Name of the NLU engine that matched the intent."
        },
        "intent_id": {
          "type": "string",
          "description": "Unique identifier of the intent."
        },
        "intent_score": {
          "type": "number",
          "description": "Score of the intent."
        },
        "is_explicit": {
          "type": "boolean",
          "description": "Indicates if the match was human curated and didn't involve any inference."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "nlu_engine_id",
        "nlu_engine_name",
        "intent_id",
        "intent_score",
        "is_explicit"
      ]
    },
    "ExampleSource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the example in the source system."
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of phrase from HumanFirst or\nexternal integrations that got merged into this phrase\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        },
        "metadata": {
          "type": "object"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "Intent": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the intent.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this intent will also be translated.\nUse `source.source_id` to store the original id."
        },
        "name": {
          "type": "string",
          "description": "Name of the intent."
        },
        "parent_intent_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the intent in the hierarchy."
        },
        "source": {
          "$ref": "#/$defs/IntentSource",
          "description": "(Optional) Information on the source of the intent."
        },
        "description": {
          "type": "string",
          "description": "(Optional) Description of the intent."
        },
        "tags": {
          "items": {
            "$ref": "#/$defs/TagReference"
          },
          "type": "array",
          "description": "(Optional) List of tags for the intent."
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "(Optional) Key-value metadata of the intent."
        },
        "created_at": {
          "type": "string",
          "description": "(Optional) Creation timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "updated_at": {
          "type": "string",
          "description": "(Optional) Update timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "deleted_at": {
          "type": "string",
          "description": "(Optional) Deletion timestamps.\nThe timestamps are in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name"
      ]
    },
    "IntentSource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the intent in the source system."
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of intents from HumanFirst or\nexternal integrations that got merged into this intent\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        },
        "metadata": {
          "type": "object",
          "description": "(Optional) Extra metadata about the intent in the source system."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "NlgModelParameters": {
      "properties": {
        "model_name": {
          "type": "string",
          "description": "The LLM model to use for completions.\nDeprecated in favour of `models`"
        },
        "models": {
          "items": {
            "$ref": "#/$defs/NlgModelRef"
          },
          "type": "array",
          "description": "The LLM model to use, in order of priority.\nLater models will be used as a fallback, should the earlier model have an\ninsufficient context window."
        },
        "temperature": {
          "type": "number",
          "description": "Temperature setting for prompt completions."
        },
        "max_tokens": {
          "type": "integer",
          "description": "Max number of tokens allowed between the prompt and completion."
        },
        "top_p": {
          "type": "number",
          "description": "Top p setting for prompt completions. Should be a value between 0 and 1."
        },
        "frequency_penalty": {
          "type": "number",
          "description": "Frequency penalty setting for prompt completions."
        },
        "presence_penalty": {
          "type": "number",
          "description": "Presence penalty setting for prompt completions."
        },
        "stop_sequences": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Configured stop sequences to tell the LLM when to stop generating text in the completion.\nFor OpenAI, only up to the first 4 stop sequences will be used."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "NlgModelRef": {
      "properties": {
        "integration_id": {
          "type": "string",
          "description": "(Optional) Integration hosting this model.\nIf unset, the namespace's only  LLM integration will be used.\nIf multiple integrations are present, this field must be set."
        },
        "model_name": {
          "type": "string",
          "description": "Model name to use for generations"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "model_name"
      ]
    },
    "Prompt": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the prompt.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this prompt will also be translated.\nUse `source.source_id` to store the original id."
        },
        "name": {
          "type": "string",
          "description": "Name of the prompt."
        },
        "contents": {
          "type": "string",
          "description": "Contents of the prompt, represented as a Go template string."
        },
        "parent_id": {
          "type": "string",
          "description": "The prompt's parent id."
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "(Optional) Key-value metadata of the prompt."
        },
        "source": {
          "$ref": "#/$defs/PromptSource",
          "description": "(Optional) Information about the source of the entity."
        },
        "nlg_model_parameters": {
          "$ref": "#/$defs/NlgModelParameters",
          "description": "Parameters for the LLM model used to generate text."
        },
        "post_processing": {
          "type": "string",
          "description": "Parameters for the LLM model used to generate text."
        },
        "run_mode": {
          "type": "string",
          "description": "Run mode.\nIf not specified when creating a prompt (RUN_UNKNOWN), the value\nwill be set to RUN_EACH_ITEM."
        },
        "post_processing_delimiter": {
          "type": "string",
          "description": "Delimiter to use when post_processing is POSTPROCESSING_DELIMITER"
        },
        "created_at": {
          "type": "string",
          "description": "(Optional) Creation timestamp.\nThe timestamp is in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "updated_at": {
          "type": "string",
          "description": "(Optional) Update timestamp.\nThe timestamp is in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        },
        "deleted_at": {
          "type": "string",
          "description": "(Optional) Deletion timestamp.\nThe timestamp is in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "contents",
        "parent_id"
      ]
    },
    "PromptSource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the prompt in the source system."
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of prompts from HumanFirst or\nexternal integrations that got merged into this prompt\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "Tag": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the tag.\nThe identifier will be translated into a deterministic internal id\nat import time. Any references to this tag will also be translated."
        },
        "name": {
          "type": "string",
          "description": "Name of the tag."
        },
        "description": {
          "type": "string",
          "description": "(Optional) Description of the tag."
        },
        "color": {
          "type": "string",
          "description": "(Optional) Color of the tag, that can be of any valid css color format.\nEx: red, blue, #133337, etc."
        },
        "protected": {
          "type": "boolean",
          "description": "Indicates that any object with this tag cannot be modified without\nexplicit confirmation."
        },
        "source": {
          "$ref": "#/$defs/TagSource",
          "description": "(Optional) Information on the source of the tag."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name"
      ]
    },
    "TagReference": {
      "properties": {
        "id": {
          "type": "string",
          "description": "(Optional) Unique identifier of the tag.\nIf not specified, `name` needs to be specified."
        },
        "name": {
          "type": "string",
          "description": "(Optional) Name of the tag.\nIf not specified, `id` needs to be specified."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "TagSource": {
      "properties": {
        "source_id": {
          "type": "string",
          "description": "ID of the tag at its source if it has been imported (if applicable)"
        },
        "merged_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of unique identifiers of tags from HumanFirst or\nexternal integrations that got merged into this tag\nat some point and that can be reused to ease further\nmerges.\n\nThis list may not be exhaustive and could be truncated."
        },
        "metadata": {
          "type": "object"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "TextPart": {
      "properties": {
        "text": {
          "type": "string",
          "description": "(Optional) Text of the part if not an entity. If not defined, `entity` needs to be defined."
        },
        "entity": {
          "$ref": "#/$defs/EntityReference",
          "description": "(Optional) If the part is an entity reference, reference to the entity.\nIf not defined, `text` needs to be defined."
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "Workspace": {
      "properties": {
        "$schema": {
          "type": "string",
          "description": "(Optional) JSON Schema for the workspace"
        },
        "name": {
          "type": "string",
          "description": "(Optional) Name of the workspace"
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "(Optional) Metadata of the workspace"
        },
        "description": {
          "type": "string",
          "description": "(Optional) Description of the workspace"
        },
        "color": {
          "type": "string",
          "description": "(Optional) Color of the workspace as shown in HumanFirst Studio, that can\nbe of any valid css color format.\nEx: red, blue, #133337, etc."
        },
        "examples": {
          "items": {
            "$ref": "#/$defs/Example"
          },
          "type": "array",
          "description": "(Optional) Examples (labelled or unlabelled) of the workspace"
        },
        "intents": {
          "items": {
            "$ref": "#/$defs/Intent"
          },
          "type": "array",
          "description": "(Optional) Intents of the workspace"
        },
        "entities": {
          "items": {
            "$ref": "#/$defs/Entity"
          },
          "type": "array",
          "description": "(Optional) Entities of the workspace"
        },
        "prompts": {
          "items": {
            "$ref": "#/$defs/Prompt"
          },
          "type": "array",
          "description": "(Optional) Prompts of the workspace"
        },
        "tags": {
          "items": {
            "$ref": "#/$defs/Tag"
          },
          "type": "array",
          "description": "(Optional) Tags of the workspace"
        },
        "exported_at": {
          "type": "string",
          "description": "(Optional) Timestamp of when the export occurred.\nThe timestamp is in RFC3339 format (\"2006-01-02T15:04:05Z07:00\")"
        }
      },
      "additionalProperties": false,
      "type": "object"
    }
  }
}
