strands.decisions.decisions_api_decision_model
Decision model backed by decisionapi.net.
DecisionsAPIDecisionModel
Section titled “DecisionsAPIDecisionModel”class DecisionsAPIDecisionModel(DecisionModel)Defined in: src/strands/decisions/decisions_api_decision_model.py:18
Decision model backed by decisionapi.net.
ask raises ModelThrottledException on provider throttling (HTTP 429/503/529, with the
httpx.HTTPStatusError as __cause__), ContextWindowOverflowException when the request
exceeds the provider’s size limit (HTTP 413 or the pre-send body-byte check), ValueError for
request-level violations (more than eight questions, too many choices, binary content, state
that is not JSON-serializable or contains NaN/infinity), httpx.HTTPStatusError for any other
non-2xx response, and StructuredOutputException for a malformed provider response.
Transport errors from the HTTP client (e.g. httpx.TimeoutException, httpx.ConnectError)
propagate unchanged.
Example:
decisions = DecisionsAPIDecisionModel() # reads JEV_API_KEY from the environmentresult = await decisions.ask( "A customer needs a refund today.", \{"department": \{"question": "Which team should handle this?", "choices": ["billing", "support"]}},)__init__
Section titled “__init__”def __init__( *, api_key: str | None = None, model_id: str = _DECISIONS_API_DEFAULT_MODEL_ID, default_min_confidence: float = _DECISIONS_API_DEFAULT_MIN_CONFIDENCE, http_client: httpx.AsyncClient | None = None) -> NoneDefined in: src/strands/decisions/decisions_api_decision_model.py:40
Create a decisionapi.net-backed decision model.
Arguments:
api_key- Decisions API key. Defaults to theJEV_API_KEYenvironment variable.model_id- Decisions API model identifier. Defaults to~typesafe/jev-latest.default_min_confidence- Default minimum confidence in[0.0, 1.0]. Defaults to0.5.http_client-httpx.AsyncClientused for the request. The caller owns and closes it; pass one to reuse connections across decisions, set a timeout, or add headers. When omitted, a client with a 30-second timeout is created per request.
Raises:
ValueError- If the API key is missing,model_idis empty, or the confidence threshold is out of range.TypeError- Ifhttp_clientis not anhttpx.AsyncClient.