Aurelio Docs
Client Referencedecision_models

semantic_router.decision_models.base

the decision-model contract: answer typed questions about a state, with probabilities.

a decision model is to DecisionRouter what an encoder is to IndexedRouter. the router turns its routes into one choice question; the model answers it.

choice

def choice(instructions: str, options: dict[str, str]) -> Question

which one of several named options applies. options maps a name to its meaning.

noul

def noul(instructions: str, yes: str = "yes", no: str = "no") -> Question

a yes/no question, answered with the probability of yes.

score

def score(instructions: str, levels: Sequence[str]) -> Question

where the state sits on an ordered scale. levels go lowest first.

DecisionModel Objects

class DecisionModel(BaseModel)

answers typed questions (choice, noul, score) about a state.

questions and answers use the /v1/systemone shapes, whatever runs the model: a model over HTTP sends them as they are, a local model maps them onto its own API.

aask

async def aask(state: object, questions: dict[str,
                                              Question]) -> dict[str, Answer]

answer every question about one state, keyed by the question names.

aask_many

async def aask_many(states: Sequence[object],
                    questions: dict[str, Question]) -> list[dict[str, Answer]]

answer the same questions about many states, one result per state.

aclose

async def aclose() -> None

release sessions or weights. a no-op unless the model holds any.

close

def close() -> None

release sessions or weights from sync code.

On this page