> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.actions.math

## Module Contents

### Functions

| Name                                                                          | Description                               |
| ----------------------------------------------------------------------------- | ----------------------------------------- |
| [`wolfram_alpha_request`](#nemoguardrails-actions-math-wolfram_alpha_request) | Makes a request to the Wolfram Alpha API. |

### Data

[`API_URL_BASE`](#nemoguardrails-actions-math-API_URL_BASE)

[`APP_ID`](#nemoguardrails-actions-math-APP_ID)

[`log`](#nemoguardrails-actions-math-log)

### API

```python
nemoguardrails.actions.math.wolfram_alpha_request(
    query: typing.Optional[str] = None,
    context: typing.Optional[dict] = None
)
```

async

Makes a request to the Wolfram Alpha API.

**Parameters:**

The query for Wolfram Alpha. Defaults to None.

The context for the execution of the action. Defaults to None.

**Returns:**

ActionResult or str: The result of the Wolfram Alpha request.

**Raises:**

* `Exception`: If no query is provided to Wolfram Alpha.

```python
nemoguardrails.actions.math.API_URL_BASE = f'https://api.wolframalpha.com/v2/result?appid={APP_ID}'
```

```python
nemoguardrails.actions.math.APP_ID = os.environ.get('WOLFRAM_ALPHA_APP_ID')
```

```python
nemoguardrails.actions.math.log = logging.getLogger(__name__)
```