OpenAIDecisions()| Name | Type | Description |
|---|---|---|
model* | unknown | Decisions model used to answer questions. |
api_key* | unknown | OpenAI API key. If omitted, reads |
base_url* | unknown | Base URL for API requests. If omitted, reads |
organization* | unknown | OpenAI organization ID. If omitted, reads |
timeout* | unknown | Request timeout passed to the OpenAI client. |
max_retries* | unknown | Maximum number of retries passed to the OpenAI client. |
default_headers* | unknown | |
default_query* | unknown | |
http_client* | unknown | |
http_async_client* | unknown |
Base URL for API requests.
Resolution order (first match wins):
base_url kwarg.OPENAI_API_BASE (read by LangChain at init).LANGSMITH_GATEWAY is set.OPENAI_BASE_URL (read by the underlying openai SDK client).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.
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)Headers sent with every request.
Query parameters sent with every request.
Optional httpx.Client used by sync invocations.
Optional httpx.AsyncClient used by async invocations.