semantic_router.layer.RouteLayer#
- class semantic_router.layer.RouteLayer(encoder: BaseEncoder | None = None, llm: BaseLLM | None = None, routes: List[Route] | None = None, index: BaseIndex | None = None, top_k: int = 5, aggregation: str = 'sum')#
Bases:
object- __init__(encoder: BaseEncoder | None = None, llm: BaseLLM | None = None, routes: List[Route] | None = None, index: BaseIndex | None = None, top_k: int = 5, aggregation: str = 'sum')#
Methods
__init__([encoder, llm, routes, index, ...])acall([text, vector, simulate_static, ...])add(route)async_group_scores_by_class(query_results)check_for_matching_routes(top_class)delete(route_name)Deletes a route given a specific route name.
evaluate(X, y[, batch_size])Evaluate the accuracy of the route selection.
fit(X, y[, batch_size, max_iter, ...])from_config(config[, index])from_json(file_path)from_yaml(file_path)get(name)get_thresholds()group_scores_by_class(query_results)list_route_names()retrieve_multiple_routes([text, vector])to_config()to_json(file_path)to_yaml(file_path)update(route_name, utterances)Attributes
score_thresholdencoderindex- delete(route_name: str)#
Deletes a route given a specific route name.
- Parameters:
route_name – the name of the route to be deleted
- evaluate(X: List[str], y: List[str], batch_size: int = 500) float#
Evaluate the accuracy of the route selection.