> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.ai.openai.VariableExtractor

- Component: `appmixer.ai.openai.VariableExtractor`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.ai.openai 2.1.3](https://connectors.appmixer.com/connector/appmixer.ai.openai/2.1.3.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.ai.openai/2.1.3/component/appmixer.ai.openai.VariableExtractor>

Extract values for given variables from inputs using AI.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Text (`text`) | textarea | The text from which to extract structured data. |
| File (`file`) | filepicker | File to extract data from. Text based files are supported for example .txt, .csv, .json. |
| Model (`model`) | text | ID of the model to use. |
| Output Variables (`outputVariables`) | expression | Define the output variables to extract and their data types |

## Output ports

### Port `out`

Variables are loaded dynamically from `/component/appmixer/ai/openai/VariableExtractor?outPort=out&ignoreAuth=true`.

## Full metadata (component.json)

```json
{
  "name": "appmixer.ai.openai.VariableExtractor",
  "author": "Appmixer <info@appmixer.com>",
  "description": "Extract values for given variables from inputs using AI.",
  "auth": {
    "service": "appmixer:ai:openai"
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "outputVariables": {}
        },
        "required": [
          "outputVariables"
        ],
        "anyOf": [
          {
            "required": [
              "text"
            ]
          },
          {
            "required": [
              "file"
            ]
          }
        ]
      },
      "inspector": {
        "inputs": {
          "text": {
            "label": "Text",
            "type": "textarea",
            "index": 1,
            "tooltip": "The text from which to extract structured data."
          },
          "file": {
            "label": "File",
            "type": "filepicker",
            "index": 2,
            "tooltip": "File to extract data from. Text based files are supported for example .txt, .csv, .json."
          },
          "model": {
            "type": "text",
            "index": 3,
            "label": "Model",
            "tooltip": "ID of the model to use.",
            "defaultValue": "gpt-4o",
            "source": {
              "url": "/component/appmixer/ai/openai/ListModels?outPort=out",
              "data": {
                "transform": "./ListModels#toSelectOptions"
              }
            }
          },
          "outputVariables": {
            "type": "expression",
            "label": "Output Variables",
            "tooltip": "Define the output variables to extract and their data types",
            "index": 4,
            "levels": [
              "ADD"
            ],
            "fields": {
              "name": {
                "type": "text",
                "label": "Variable Name",
                "tooltip": "Name of the variable to extract (e.g., 'age', 'name', 'isActive')"
              },
              "dataType": {
                "type": "select",
                "label": "Data Type",
                "options": [
                  {
                    "content": "Text",
                    "value": "string"
                  },
                  {
                    "content": "Number",
                    "value": "number"
                  },
                  {
                    "content": "Boolean",
                    "value": "boolean"
                  }
                ]
              }
            }
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "source": {
        "url": "/component/appmixer/ai/openai/VariableExtractor?outPort=out&ignoreAuth=true",
        "data": {
          "properties": {
            "generateOutputPortOptions": true
          },
          "messages": {
            "in/text": "dummy",
            "in/outputVariables": "inputs/in/outputVariables"
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
