Skip to content

Commit b50c7d6

Browse files
authored
Merge pull request #569 from aurelio-labs/james/migration-doc2
feat: add note on top_k to migration doc
2 parents 199603c + 68acf6c commit b50c7d6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/user-guide/guides/migration-to-v1.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The v0.1 release of semantic router introduces several breaking changes to impro
4444
query_results = semantic_router._query(query_text)
4545
multiple_routes = semantic_router._semantic_classify_multiple_routes(query_results)
4646

47-
# After (v0.1.4+)
47+
# After (v0.1.3+)
4848
semantic_router = SemanticRouter(encoder=encoder, routes=routes, auto_sync="local")
4949
# Return all routes that pass their score thresholds
5050
all_routes = semantic_router(query_text, limit=None)
@@ -59,6 +59,14 @@ The v0.1 release of semantic router introduces several breaking changes to impro
5959
When `limit=1` (the default), a single `RouteChoice` object is returned.
6060
When `limit=None` or `limit > 1`, a list of `RouteChoice` objects is returned.
6161

62+
> **Important Note About `top_k`**: The `top_k` parameter (default: 5) can still limit the number of routes returned, regardless of the `limit` parameter. When using `limit > 1`, we recommend setting `top_k` to a higher value such as 100 or more. If you're using `limit=None` to get all possible results, make sure to set `top_k` to be equal to or greater than the total number of utterances shared across all of your routes.
63+
>
64+
> ```python
65+
> # Example: Setting top_k higher when retrieving multiple routes
66+
> semantic_router = SemanticRouter(encoder=encoder, routes=routes, top_k=100)
67+
> all_routes = semantic_router(query_text, limit=None)
68+
> ```
69+
6270
### Synchronization Strategy
6371
6472
- If expecting routes to sync between local and remote on initialization, use `SemanticRouter(..., auto_sync="local")`.

0 commit comments

Comments
 (0)