routes
(List[Route]
): A list of routes.encoder_type
(str
): The type of encoder to use.encoder_name
(Optional[str]
): The name of the encoder to use.path
(str
): The path to the file to load the RouterConfig from.route_tuples
(List[Tuple[str, str]]
): A list of tuples, each containing a route name and an
associated utterance.encoder_type
(str, optional
): The type of encoder to use, defaults to “openai”.encoder_name
(Optional[str], optional
): The name of the encoder to use, defaults to None.index
(BaseIndex
): The index to initialize the RouterConfig from.encoder_type
(str, optional
): The type of encoder to use, defaults to “openai”.encoder_name
(Optional[str], optional
): The name of the encoder to use, defaults to None.Dict[str, Any]
: A dictionary representation of the RouterConfig.
path
(str
): The path to save the RouterConfig to.List[Utterance]
: A list of Utterance objects.
route
(Route
): The route to add.name
(str
): The name of the route to get.Optional[Route]
: The route if found, otherwise None.
name
(str
): The name of the route to remove.ConfigParameter
: The hash of the RouterConfig.
xq
(List[float] | np.ndarray
): The query vector.np.ndarray
: The reshaped query vector.
encoder
(Optional[DenseEncoder]
): The encoder to use.sparse_encoder
(Optional[SparseEncoder]
): The sparse encoder to use.llm
(Optional[BaseLLM]
): The LLM to use.routes
(Optional[List[Route]]
): The routes to use.index
(Optional[BaseIndex]
): The index to use.Optional[DenseEncoder]
0 (Optional[DenseEncoder]
1): The number of routes to return.Optional[DenseEncoder]
2 (Optional[DenseEncoder]
3): The aggregation method to use.Optional[DenseEncoder]
4 (Optional[DenseEncoder]
5): The auto sync mode to use.top_class
(str
): The top class to check for.Optional[Route]
: The matching route if found, otherwise None.
text
(Optional[str]
): The text to route.vector
(Optional[List[float] | np.ndarray]
): The vector to route.simulate_static
(bool
): Whether to simulate a static route.route_filter
(Optional[List[str]]
): The route filter to use.limit
(int | None
): The number of routes to return, defaults to 1. If set to None, no
limit is applied and all routes are returned.Optional[str]
0: The route choice.
text
(Optional[str]
): The text to route.vector
(Optional[List[float] | np.ndarray]
): The vector to route.simulate_static
(bool
): Whether to simulate a static route (ie avoid dynamic route
LLM calls during fit or evaluate).route_filter
(Optional[List[str]]
): The route filter to use.RouteChoice
: The route choice.
sync_mode
(str
): The mode to sync the routes with the remote index.force
(bool, optional
): Whether to force the sync even if the local and remote
hashes already match. Defaults to False.wait
(int
): The number of seconds to wait for the index to be unlocked
before proceeding with the sync. If set to 0, will raise an error if
index is already locked/unlocked.List[str]
: A list of diffs describing the addressed differences between
the local and remote route layers.
sync_mode
(str
): The mode to sync the routes with the remote index.force
(bool, optional
): Whether to force the sync even if the local and remote
hashes already match. Defaults to False.wait
(int
): The number of seconds to wait for the index to be unlocked
before proceeding with the sync. If set to 0, will raise an error if
index is already locked/unlocked.List[str]
: A list of diffs describing the addressed differences between
the local and remote route layers.
file_path
(str
): The path to the JSON file.RouterConfig
: The RouterConfig object.
file_path
(str
): The path to the YAML file.RouterConfig
: The RouterConfig object.
config
(RouterConfig
): The RouterConfig object.index
(Optional[BaseIndex]
): The index to use.route
(Route
): The route to add.route
(Route
): The route to add.name
(str
): The name of the route to update.threshold
(Optional[float]
): The threshold to update.utterances
(Optional[List[str]]
): The utterances to update.route_name
: the name of the route to be deletedroute_name
: the name of the route to be deletedbool
: True if the local and remote route layers are synchronized,
False otherwise.
bool
: True if the local and remote route layers are synchronized,
False otherwise.
include_metadata
(bool
): Whether to include metadata in the diff.List[str]
: A list of strings showing the difference between the local and remote
utterances.
include_metadata
(bool
): Whether to include metadata in the diff.List[str]
: A list of strings showing the difference between the local and remote
utterances.
name
(str
): The name of the route to get.Optional[Route]
: The route.
query_results
(List[Dict]
): The query results to group. Expected format is a list of
dictionaries with “route” and “score” keys.Dict[str, List[float]]
: A dictionary of route names and their associated scores.
threshold
of 0.0
will mean that the route will be returned no matter how low it scores whereas
a threshold of 1.0 will mean that a route must contain an exact utterance match
to be returned.
Arguments:
threshold
(float
): The threshold to set.route_name
(str | None
): The name of the route to set the threshold for. If None, the
threshold will be set for all routes.RouterConfig
: The RouterConfig object.
file_path
(str
): The path to the JSON file.file_path
(str
): The path to the YAML file.Dict[str, float]
: A dictionary of route names and their associated thresholds.
None
utterances.
Arguments:
X
(List[str]
): The input data.y
(List[str]
): The output data.batch_size
(int
): The batch size to use for fitting.max_iter
(int
): The maximum number of iterations to use for fitting.local_execution
(X
0): Whether to execute the fitting locally.X
(List[str]
): The input data.y
(List[str]
): The output data.batch_size
(int
): The batch size to use for evaluation.float
: The accuracy of the route selection.
route_layer
(BaseRouter
): The route layer to search.search_range
(Union[int, float]
): The search range to use.Dict[str, float]
: A dictionary of route names and their associated thresholds.