{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/emporix/main/json-schema/emporix-rag-emporix-native-tool-response-schema.json",
  "title": "RagEmporixNativeToolResponse",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-ai-service-openapi.yml#/components/schemas/RagEmporixNativeToolResponse",
  "allOf": [
    {
      "$ref": "#/$defs/BaseNativeTool"
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the tool."
        },
        "type": {
          "description": "For `RagEmporixNativeTool`, it has to be set to `rag_emporix`."
        },
        "config": {
          "$ref": "#/$defs/RagEmporixNativeToolConfigResponse"
        },
        "metadata": {
          "$ref": "#/$defs/MetadataResponse"
        }
      }
    }
  ],
  "$defs": {
    "BaseNativeTool": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/NativeToolType"
        },
        "name": {
          "type": "string",
          "description": "Name of the tool."
        },
        "enabled": {
          "type": "boolean",
          "description": "An indicator whether the tool is enabled.",
          "default": false
        }
      },
      "required": [
        "type",
        "name"
      ]
    },
    "EmporixOpenAiRagEmporixEmbeddingNativeToolConfig": {
      "type": "object",
      "properties": {
        "provider": {
          "allOf": [
            {
              "$ref": "#/$defs/RagLlmProvider"
            }
          ],
          "description": "For this type, it should be set to 'emporix_openai'."
        }
      },
      "required": [
        "provider"
      ]
    },
    "ExpandableTokenResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/IdResponse"
        },
        {
          "$ref": "#/$defs/ExpandedTokenResponse"
        }
      ],
      "description": "The full response representing token. If the `expand=token` is **not** used, then only `id` field is returned, otherwise all fields are returned."
    },
    "ExpandedTokenResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/IdResponse"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the token."
            },
            "metadata": {
              "$ref": "#/$defs/MetadataResponse"
            }
          }
        }
      ]
    },
    "IdResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Identifier of the resource."
        }
      }
    },
    "MetadataRequest": {
      "type": "object",
      "properties": {
        "version": {
          "minimum": 1,
          "type": "integer",
          "description": "Version of the object. The version is required during the update operation because of the optimistic locking mechanism."
        }
      },
      "required": [
        "version"
      ]
    },
    "MetadataResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/MetadataRequest"
        },
        {
          "type": "object",
          "properties": {
            "createdAt": {
              "description": "Date and time when the object was created. The value is approved as an ISO-8601 representation of an Instant. For example: `2022-04-30T13:18:02.379Z`",
              "type": "string"
            },
            "modifiedAt": {
              "description": "Date and time when the object was last modified. The value is approved as an ISO-8601 representation of an Instant. For example: `2022-04-30T13:18:02.379Z`",
              "type": "string"
            }
          },
          "required": [
            "version",
            "createdAt",
            "modifiedAt"
          ]
        }
      ]
    },
    "NativeToolType": {
      "type": "string",
      "enum": [
        "slack",
        "rag_custom",
        "rag_emporix",
        "teams"
      ],
      "description": "Type of the native tool. Possible values:\n* `slack`\n* `rag_custom`\n* `rag_emporix`\n* `teams`"
    },
    "OpenAiRagEmporixEmbeddingNativeToolConfig": {
      "type": "object",
      "properties": {
        "provider": {
          "allOf": [
            {
              "$ref": "#/$defs/RagLlmProvider"
            }
          ],
          "description": "For this type, it should be set to 'emporix_openai'."
        },
        "model": {
          "type": "string",
          "description": "OpenAI LLM model to be used for generating embeddings for indexed products and user's input query."
        },
        "dimensions": {
          "type": "integer",
          "description": "Number of dimensions of embedding.",
          "minimum": 128,
          "maximum": 4096
        }
      },
      "required": [
        "provider",
        "model",
        "dimensions"
      ]
    },
    "OpenAiRagEmporixEmbeddingNativeToolConfigResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/OpenAiRagEmporixEmbeddingNativeToolConfig"
        },
        {
          "type": "object",
          "properties": {
            "token": {
              "$ref": "#/$defs/ExpandableTokenResponse"
            }
          }
        }
      ]
    },
    "RagEmporixNativeToolConfig": {
      "type": "object",
      "properties": {
        "prompt": {
          "type": "string",
          "description": "The prompt for an agent. It should define when and why this tool is to be called."
        },
        "entityType": {
          "type": "string",
          "description": "Type of the entity which is stored in the given collection. Supported predefined types: [ORDER, PRODUCT] and custom entity types."
        },
        "indexedFields": {
          "type": "array",
          "description": "This field specifies the fields of the given entityType that are used for generating embeddings. The provided values are then concatenated and converted to embeddings.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "It can act as an alias for the field key. For example, if the 'name.en' key is provided then its alias could be 'English Name' and that value is used in embedding input."
              },
              "key": {
                "type": "string",
                "description": "Unique value representing the entityType key."
              }
            },
            "required": [
              "key"
            ]
          }
        },
        "filterFields": {
          "type": "array",
          "description": "This field specifies the fields of the given entityType that are used for filtering the data before performing actual search.",
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "type": "string",
                "description": "It should contain the description of the field, so LLM is able to know when to use this field in order to filter the data. For enums, possible values should be specified here."
              },
              "key": {
                "type": "string",
                "description": "Unique value representing the entityType key."
              }
            },
            "required": [
              "key"
            ]
          }
        }
      },
      "required": [
        "prompt",
        "entityType",
        "indexedFields"
      ]
    },
    "RagEmporixNativeToolConfigResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/RagEmporixNativeToolConfig"
        },
        {
          "type": "object",
          "properties": {
            "embeddingConfig": {
              "oneOf": [
                {
                  "$ref": "#/$defs/EmporixOpenAiRagEmporixEmbeddingNativeToolConfig"
                },
                {
                  "$ref": "#/$defs/OpenAiRagEmporixEmbeddingNativeToolConfigResponse"
                },
                {
                  "$ref": "#/$defs/SelfHostedOllamaRagEmporixEmbeddingNativeToolConfigResponse"
                }
              ]
            }
          }
        }
      ]
    },
    "RagLlmProvider": {
      "type": "string",
      "enum": [
        "emporix_openai",
        "openai",
        "self_hosted_ollama"
      ]
    },
    "SelfHostedOllamaRagEmporixEmbeddingNativeToolConfig": {
      "type": "object",
      "properties": {
        "provider": {
          "allOf": [
            {
              "$ref": "#/$defs/RagLlmProvider"
            }
          ],
          "description": "For this type, it should be set to 'self_hosted_ollama'."
        },
        "model": {
          "type": "string",
          "description": "Ollama LLM model to be used for generating embeddings for indexed products and user's input query."
        },
        "dimensions": {
          "type": "integer",
          "description": "Number of dimensions of embedding.",
          "minimum": 128,
          "maximum": 4096
        },
        "url": {
          "type": "string",
          "description": "Base URL where Ollama is hosted."
        }
      },
      "required": [
        "provider",
        "model",
        "dimensions",
        "url"
      ]
    },
    "SelfHostedOllamaRagEmporixEmbeddingNativeToolConfigResponse": {
      "allOf": [
        {
          "$ref": "#/$defs/SelfHostedOllamaRagEmporixEmbeddingNativeToolConfig"
        },
        {
          "type": "object",
          "properties": {
            "token": {
              "$ref": "#/$defs/ExpandableTokenResponse"
            }
          }
        }
      ]
    }
  }
}