# OpenAIDecisions

> **Class** in `langchain_openai`

📖 [View in docs](https://reference.langchain.com/python/langchain-openai/decisions/base/OpenAIDecisions)

Ask typed questions about text or images with the OpenAI Decisions API.

A single request can combine `Predicate` probabilities, `Choice` selections, and
`Score` ratings over shared input. The response preserves probabilities,
confidence, and token usage so application code can decide whether to act,
route, or request human review.

Sync and async OpenAI clients are created on first use of `invoke` or `ainvoke`
respectively.

## Signature

```python
OpenAIDecisions()
```

## Description

??? example "Ask several questions about the same input"

```python
from langchain_openai.decisions import (
    Choice,
    OpenAIDecisions,
    Predicate,
    Score,
)

decisions = OpenAIDecisions(model="gpt-6-luna")
response = decisions.invoke(
    {
        "input": "Stripe has failed to connect for three days. Help ASAP.",
        "questions": {
            "department": Choice(
                instructions="Which team should handle this request?",
                choices={
                    "billing": "Payment or subscription issues.",
                    "technical": "Product bugs or integration failures.",
                },
            ),
            "urgent": Predicate(instructions="Is this request urgent?"),
            "frustration": Score(
                instructions="How frustrated does the customer appear?",
                levels=["Calm", "Concerned", "Angry"],
            ),
        },
    }
)
print(response.choices["department"].choice)
print(response.predicates["urgent"].probability)
print(response.scores["frustration"].score)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model` | `unknown` | Yes | Decisions model used to answer questions. |
| `api_key` | `unknown` | Yes | OpenAI API key. If omitted, reads `OPENAI_API_KEY`, or the LangSmith gateway key when routing through the gateway. |
| `base_url` | `unknown` | Yes | Base URL for API requests. If omitted, reads `OPENAI_API_BASE`, then the LangSmith gateway when `LANGSMITH_GATEWAY` is set, then `OPENAI_BASE_URL`. |
| `organization` | `unknown` | Yes | OpenAI organization ID. If omitted, reads `OPENAI_ORG_ID`. |
| `timeout` | `unknown` | Yes | Request timeout passed to the OpenAI client. |
| `max_retries` | `unknown` | Yes | Maximum number of retries passed to the OpenAI client. |
| `default_headers` | `unknown` | Yes | Headers sent with every request. |
| `default_query` | `unknown` | Yes | Query parameters sent with every request. |
| `http_client` | `unknown` | Yes | Optional `httpx.Client` used by sync invocations. |
| `http_async_client` | `unknown` | Yes | Optional `httpx.AsyncClient` used by async invocations. |

## Extends

- `RunnableSerializable[DecisionRequest, DecisionResponse]`

## Properties

- `model`
- `api_key`
- `base_url`
- `openai_organization`
- `timeout`
- `max_retries`
- `default_headers`
- `default_query`
- `http_client`
- `http_async_client`
- `model_config`
- `lc_secrets`

## Methods

- [`is_lc_serializable()`](https://reference.langchain.com/python/langchain-openai/decisions/base/OpenAIDecisions/is_lc_serializable)
- [`get_lc_namespace()`](https://reference.langchain.com/python/langchain-openai/decisions/base/OpenAIDecisions/get_lc_namespace)
- [`invoke()`](https://reference.langchain.com/python/langchain-openai/decisions/base/OpenAIDecisions/invoke)
- [`ainvoke()`](https://reference.langchain.com/python/langchain-openai/decisions/base/OpenAIDecisions/ainvoke)

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/16a08bda1247010c23fcfa887e421259a5fced5e/libs/partners/openai/langchain_openai/decisions/base.py#L37)