|
1 | | -import random |
2 | 1 | from pathlib import Path |
3 | 2 | from typing import Any, Dict, List, Optional, Type |
4 | 3 |
|
5 | | -import numpy as np |
6 | 4 | import redis.commands.search.reducers as reducers |
7 | 5 | import yaml |
8 | 6 | from pydantic import BaseModel, ConfigDict, Field, PrivateAttr |
@@ -162,7 +160,7 @@ def update_routing_config(self, routing_config: RoutingConfig): |
162 | 160 | """ |
163 | 161 | self.routing_config = routing_config |
164 | 162 |
|
165 | | - def update_route_thresholds(self, route_thresholds: Dict[str, float | None]): |
| 163 | + def update_route_thresholds(self, route_thresholds: Dict[str, Optional[float]]): |
166 | 164 | """Update the distance thresholds for each route. |
167 | 165 |
|
168 | 166 | Args: |
@@ -363,7 +361,7 @@ def __call__( |
363 | 361 | statement: Optional[str] = None, |
364 | 362 | vector: Optional[List[float]] = None, |
365 | 363 | aggregation_method: Optional[DistanceAggregationMethod] = None, |
366 | | - distance_threshold: float | None = None, |
| 364 | + distance_threshold: Optional[float] = None, |
367 | 365 | ) -> RouteMatch: |
368 | 366 | """Query the semantic router with a given statement or vector. |
369 | 367 |
|
@@ -395,7 +393,7 @@ def route_many( |
395 | 393 | statement: Optional[str] = None, |
396 | 394 | vector: Optional[List[float]] = None, |
397 | 395 | max_k: Optional[int] = None, |
398 | | - distance_threshold: float | None = None, |
| 396 | + distance_threshold: Optional[float] = None, |
399 | 397 | aggregation_method: Optional[DistanceAggregationMethod] = None, |
400 | 398 | ) -> List[RouteMatch]: |
401 | 399 | """Query the semantic router with a given statement or vector for multiple matches. |
|
0 commit comments