From a83c38036dfd5bcf27a02d731e60bb2296c2812f Mon Sep 17 00:00:00 2001 From: Luca Mannini <48441989+italianconcerto@users.noreply.github.com> Date: Fri, 31 Jan 2025 18:23:44 +0100 Subject: [PATCH] fix: handle empty function_schemas in route processing --- semantic_router/routers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semantic_router/routers/base.py b/semantic_router/routers/base.py index a9ff6eba..f73f3cfc 100644 --- a/semantic_router/routers/base.py +++ b/semantic_router/routers/base.py @@ -1086,7 +1086,7 @@ class BaseRouter(BaseModel): route_names = [route.name for route in routes for _ in route.utterances] utterances = [utterance for route in routes for utterance in route.utterances] function_schemas = [ - route.function_schemas[0] if route.function_schemas is not None else {} + route.function_schemas[0] if route.function_schemas and len(route.function_schemas) > 0 else {} for route in routes for _ in route.utterances ] -- GitLab