Client Referencedecision_models
semantic_router.decision_models.gliner2
GLiNER2 decision models, run locally: fastino/GLiNER2.5-Decide by default.
GLiNER2DecisionModel Objects
class GLiNER2DecisionModel(DecisionModel)A GLiNER2 decision model run in-process with the gliner2 library.
Answers choice, noul and score questions locally, with no network calls and no
key. Requires the local extra: pip install "semantic-router[local]".
Arguments:
name: The model on the Hugging Face Hub, or a local directory.device:"cuda","mps"or"cpu". Left out, the first available.batch_size: States per forward pass when answering many at once.classifier: A loadedgliner2.classification.Classifierto use instead of loadingname, e.g. one with a fine-tuned adapter.
ask_many
def ask_many(states: Sequence[object],
questions: dict[str, Question]) -> list[dict[str, Answer]]answer the same questions about many states in batched forward passes.
ask
def ask(state: object, questions: dict[str, Question]) -> dict[str, Answer]answer every question about one state in one forward pass.