"""Optional Decision Index integration.""" try: from decision_index.engines.base import Engine, NativeAbstention, Unsupported except ModuleNotFoundError as exc: if exc.name not in ("decision_index", "decision_index.engines", "decision_index.engines.base"): raise class Unsupported(ValueError): pass class NativeAbstention(Exception): def __init__(self, raw): self.raw = raw super().__init__("Native model selected its additional abstention outcome") class Engine: name = "engine" provenance = {} latency = "In-process request wall time including prompt construction; excludes model loading." def __init__(self, **options): self.options = options def __call__(self, state, questions): raise NotImplementedError def warmup(self): warm = {"warmup": {"type": "choice", "instructions": "Which color is named?", "criteria": {"red": "red", "blue": "blue"}}} for _ in range(2): try: self("The color is red.", warm) except NativeAbstention: pass def runtime(self): return {} def synchronize(self): pass def close(self): pass