File size: 507 Bytes
d64fd55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from typing import Protocol, Optional


class RouterHook(Protocol):
    """
    Interface for router observability.
    """

    def on_route_decision(
        self, *, route: str, provider: str, model: str, fallback: bool, reason: Optional[str] = None
    ) -> None:
        """Called whenever a routing decision is made."""
        ...


class NoOpHook:
    """Default no-op implementation of RouterHook."""

    def on_route_decision(self, *, route, provider, model, fallback, reason=None):
        pass