Select one value from a fixed, unordered set of options.
from langchain_openai.decisions import Choice, OpenAIDecisions
decisions = OpenAIDecisions(model="gpt-6-luna")
response = decisions.invoke(
{
"input": "I was charged twice for my order.",
"questions": {
"department": Choice(
instructions="Which department should handle this?",
choices={
"billing": "Payments, invoices, and refunds.",
"technical": "Problems using the product.",
"other": "Requests outside these categories.",
},
),
},
}
)
department = response.choices["department"]
if department.confidence >= 0.7:
route_to(department.choice)