nemoguardrails.actions.math

View as Markdown

Module Contents

Functions

NameDescription
wolfram_alpha_requestMakes a request to the Wolfram Alpha API.

Data

API_URL_BASE

APP_ID

log

API

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:

query
Optional[str]Defaults to None

The query for Wolfram Alpha. Defaults to None.

context
Optional[dict]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.
nemoguardrails.actions.math.API_URL_BASE = f'https://api.wolframalpha.com/v2/result?appid={APP_ID}'
nemoguardrails.actions.math.APP_ID = os.environ.get('WOLFRAM_ALPHA_APP_ID')
nemoguardrails.actions.math.log = logging.getLogger(__name__)