Ask a binary question and receive the probability that its answer is yes.
Use Noul when the probability itself is useful to application code, such as
deciding whether a message reports a bug or requests a refund. A value near 1
indicates strong support for yes, a value near 0 indicates strong support for no,
and a value near 0.5 indicates uncertainty. Noul answers do not include a separate
confidence value.
from langchain_core.decisions import Noul
response = classifier.invoke(
{
"state": "Production is down. Please help immediately.",
"questions": {
"urgent": Noul(
instructions="Does this message require an urgent response?"
)
},
}
)
urgency = response.nouls["urgent"].noul
if urgency >= 0.8:
page_on_call_engineer()Wire discriminator for a binary question.
Complete yes/no judgment to make about the input state.
Instructions may be text or structured JSON. Write the full question here even when
its ID in ClassifierRequest.questions appears self-explanatory.
Optional descriptions that define what the yes and no outcomes mean.