---
title: Text Classification
slug: EOql-text-classification
docTags: 
createdAt: 2023-07-24T22:10:54.052Z
---

The below parameters are for text classification attack types. To know more about the different attack input parameters see [Text Classification](docId\:SmR1eb77SAocrYZljw07J)

:::hint{type="info"}
The values presented below are examples  used in the reference implementation. It is important to customize these values to achieve the best performance for your particular model.
:::

:::CodeblockTabs
Extraction

```json
{
"use_model_api": "no",
"model_api_details": "no",
"number_of_classes": "2",
"attack_type": "blackbox",
"input_dimensions": "100",
"number_of_attack_queries": "20000",
"model_framework": "tensorflow",
"vulnerability_threshold": "0",
"defense_best_only": "no",
"encryption_strategy": = "1"
}
```
:::

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_analyse",
  "name": "Model anaylsis",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "name": "model id",
        "kind": "required",
        "type": "string",
        "description": "Enter your model",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Org_id",
        "type": "string",
        "children": [],
        "description": "Enter your organization id"
      },
      {
        "kind": "required",
        "name": "x-api-key",
        "type": "string",
        "children": [],
        "description": "Enter your API key"
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "DL4HDcclTH6dUtOu-opbD",
        "code": "// 200 OK: Returns a JSON object containing unique model ID and urls to upload required files.",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "z5dS_OPIMHsxFEwrtKnkw",
        "language": "401",
        "code": "// 401 Unauthorized: Returns an error message if the provided API key or Org-ID is invalid or expired.",
        "customLabel": ""
      },
      {
        "id": "xJHL9zR5wAZ30f4gu2BUz",
        "language": "400",
        "code": "// 400 Bad request Error: Returns an error message if the application cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, etc.)",
        "customLabel": ""
      },
      {
        "id": "eXy7xHvpQ-HT16gZp2CNA",
        "language": "412",
        "code": "// 412 precondition failed: Returns an error message if access to the target resource has been denied. (For example- if any of the parameter value is incorrect or license has expired)",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "eXy7xHvpQ-HT16gZp2CNA"
  },
  "examples": {
    "languages": [
      {
        "id": "uvpR8QRnC1HHhN9QUoXG7",
        "language": "python",
        "code": "import requests\n\nmodelID=\"<< Enter Model ID >>\"\nurl = \"https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_analyse/\"+modelID+\"\"\n\n# please select proper payload for your usecase for extraction, evasion or poisoning.\npayload={\n    # <<Enter Payload Data>>\n}\nheaders = {\n   'Accept': 'application/json',\n   'x-api-key': '########################################',\n   'Org-Id': '####################################################################################################'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)",
        "customLabel": ""
      },
      {
        "id": "vCV7cMMWnkOdXcZnZkdAz",
        "language": "curl",
        "code": "modelID=\"<< Enter Model ID >>\"\ncurl --location 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_analyse/${modelID}' \\\n--header 'x-api-key: ########################################' \\\n--header 'Org-Id: ####################################################################################################' \\\n--header 'Content-Type: application/json' \\\n--data '{\n        <<Enter Payload Data>>\n}'",
        "customLabel": ""
      },
      {
        "id": "eXSnYGLUlaNuxX2kBNo0C",
        "language": "nodejs",
        "code": "var request = require('request');\n\nmodelID = '<<Enter Model ID >>'\nvar options = {\n  'method': 'POST',\n  'url': 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_analyse/'+modelID+'',\n  'headers': {\n    'x-api-key': '########################################',\n    'Org-Id': '####################################################################################################',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n        // <<Enter Task Pair based Payload>>\n  })\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "z1GlBsBw28gqg4d6hM6ST",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"x-api-key\", \"########################################\");\nmyHeaders.append(\"Org-Id\", \"####################################################################################################\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n    // << Enter Payload Details based on Task pair >>\n});\n\nvar modelID = \"<< Enter Model ID >>\"\n\nvar requestOptions = {\n  method: 'POST',\n  headers: myHeaders,\n  body: raw,\n  redirect: 'follow'\n};\n\nfetch(\"https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_analyse/\"+modelID+\"\", requestOptions)\n  .then(response => response.text())\n  .then(result => console.log(result))\n  .catch(error => console.log('error', error));",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "z1GlBsBw28gqg4d6hM6ST"
  },
  "description": "",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::

:::hint{type="info"}
Note: In the response, copy job\_id. This value is required to trigger the GET APIs. See [\<GET> Job Metadata](docId\:S-mZ7r0HNzicDQy6Q-6Hq).

The "job\_id" is used to retrieve model analysis metadata and check the processing status of the request. It is also used for generating reports for the analyzed model. Copy the dashboard link from the response and open it in a new tab. This allows users to monitor the job progress and download reports.
:::



:::hint{type="info"}
For using Nodejs sample code, install npm package request

Given ample code for python is tested for Python version 3.7

Given Sample code for nodejs and javascript is tested for Node V20LTS 
:::







