Rate the input against ordered levels.
Levels are indexed from 0 in the order supplied. The returned score is the
probability-weighted average of those indices, so it may fall between levels.
from langchain_openai.decisions import Level, OpenAIDecisions, Score
decisions = OpenAIDecisions(model="gpt-6-luna")
response = decisions.invoke(
{
"input": "Export fails in Safari but works in Chrome.",
"questions": {
"severity": Score(
instructions="How severe is this issue?",
levels=[
Level(label="Cosmetic", description="No lost function."),
Level(label="Workaround", description="Another way works."),
Level(label="Blocked", description="No workaround."),
],
),
},
}
)
print(response.scores["severity"].score) # May be fractional, e.g. 1.1