1. Classifier steps
  2. Questions

A question has a name, a type, instructions and criteria. One call can ask several questions about the same data.

TypeAnswersYou read
choiceWhich one of these options?The option and each option’s probability
noulHow likely is this to be true?A probability from 0 to 1
scoreWhere on this scale?A number on the scale

​
Choice

Picks one option. Describe each option, and include an “other” when none may fit.

"category": {
    "type": "choice",
    "instructions": "Which expense category fits this invoice?",
    "criteria": {
        "software": "Licenses, SaaS and cloud hosting.",
        "travel": "Flights, hotels and ground transport.",
        "other": "Anything else.",
    },
}
answer = result.choices["category"]
answer.choice          # "software"
answer.probabilities   # {"software": 0.91, "travel": 0.03, "other": 0.06}
answer.confidence      # how decided the answer is, from 0 to 1

​
Noul

Estimates the probability that something is true. It is not a yes or a no: you choose the threshold.

"urgent": {
    "type": "noul",
    "instructions": "Is payment due within 7 days?",
}
result.nouls["urgent"].noul   # 0.12

​
Score

Rates one thing on a scale you describe, from the lowest level to the highest.

"severity": {
    "type": "score",
    "instructions": "How severe is the customer impact?",
    "criteria": ["Minor inconvenience", "Degraded service", "Blocked customer"],
}
answer = result.scores["severity"]
answer.score           # 1.7, on a scale from 0 to 2
answer.probabilities   # {"0": 0.05, "1": 0.2, "2": 0.75}

​
Pass questions at run time

Questions on the decorator are defaults. Pass questions= on the call when they depend on the data, for example when the options come from a database.

@ava.classifier_step()
async def route(ticket: str, teams: dict[str, str], *, classifier: ava.Classifier) -> str:
    result = await classifier(
        state=ticket,
        questions={
            "team": {
                "type": "choice",
                "instructions": "Which team should handle this ticket?",
                "criteria": teams,
            }
        },
    )
    return result.choices["team"].choice

Questions passed on a call replace the defaults for that call.

​
Providers

The provider is the service that answers. All three take the same questions.

@ava.classifier_step(questions=QUESTIONS, classifier=ava.classifiers.OpenAIDecisions())
ProviderDefault modelKeyInstall
ava.classifiers.TypeSafe() (default)jev-latestTYPESAFE_API_KEYavalanche-ai[typesafe]
ava.classifiers.OpenAIDecisions()gpt-6-lunaOPENAI_API_KEYavalanche-ai[openai]
ava.classifiers.GeminiDecision() (beta)gemini-decision-1GEMINI_API_KEYavalanche-ai[gemini]

Set one provider for every classifier step of a workflow:

@ava.workflow(classifier_defaults={"classifier": ava.classifiers.TypeSafe(), "timeout": 20.0})
def triage(): ...