ai.SWAIG.functions.data_map defines how a [SWAIG function](/swml/methods/ai/swaig/functions) should process and respond to the users input data. | Name | Type | Default | Description | |:|:|:--|:| | data_mapOptional | object | - | An object that contains the [data_map Parameters](#data_map-parameters). | ## **data_map Parameters** :::important Processing Order The components are processed in the following sequence: 1. expressions - Processes data using pattern matching (includes its own output) 2. webhooks - Makes external API calls (includes its own output and expressions) 3. output - Returns a direct response and actions to perform ::: Similar to a return statement in conventional programming languages, when a valid [output][output] is encountered within any component, it immediately terminates function execution. The output provides: 1. A response object: Contains static text for the AI agents context 2. An optional action object: Defines executable actions to be triggered If no component produces a valid output, the system continues processing in sequence: - First attempts expressions - If unsuccessful, tries webhooks - If still unsuccessful, attempts top-level output - If all fail, returns a generic fallback error message | Name | Type | Default | Description | | :- | : | : | :-- | | [expressions](./data_map.expressions.mdx)Required | object[] | - | An array of objects that have pattern matching logic to process the users input data. A user can define multiple expressions to match against the users input data. | | [webhooks](./data_map.webhooks/index.mdx)Required | object[] | - | An array of objects that define external API webhooks that can be used to make external API calls. | | [output][output]Required | object | - | An object that defines the output of the SWAIG function. Behaves like a return statement in traditional programming. | ## **Examples:** 1. [Executing SWML from a SWAIG function](../../../../../guides/AI/executing_swml.mdx) [output]: /swml/methods/ai/swaig/functions/data_map/output