SemanticRouter
considers when making a classification. This can be useful if we want to restrict the scope of possible routes based on some context.
For example, we may have a router with several routes, politics
, weather
, chitchat
, etc. We may want to restrict the scope of the classification to only consider the chitchat
route. We can do this by passing a route_filter
argument to our SemanticRouter
calls like so:
SemanticRouter
will only consider the chitchat
route for the classification.
SemanticRouter
. When called, the router will consume text (a query) and output the category (Route
) it belongs to — to initialize a SemanticRouter
we need our encoder
model and a list of routes
.
Route
objects?
None
because no matches were identified.
None
because the query doesn’t match the “politics” route well enough to pass the threshold.