From 47bce511ccaf13d1d63e0aa90a478662218874ed Mon Sep 17 00:00:00 2001
From: jamescalam <james.briggs@hotmail.com>
Date: Sun, 1 Dec 2024 17:49:43 +0100
Subject: [PATCH] chore: lint

---
 semantic_router/schema.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/semantic_router/schema.py b/semantic_router/schema.py
index 9c37ef72..678cd747 100644
--- a/semantic_router/schema.py
+++ b/semantic_router/schema.py
@@ -129,10 +129,11 @@ class Utterance(BaseModel):
         if include_metadata:
             # we sort the dicts to ensure consistent order as we need this to compare
             # stringified function schemas accurately
-            function_schemas_sorted = [
-                json.dumps(schema, sort_keys=True)
-                for schema in self.function_schemas
-            ]
+            if self.function_schemas is not None:
+                function_schemas_sorted = [
+                    json.dumps(schema, sort_keys=True)
+                    for schema in self.function_schemas
+                ]
             # we must do the same for metadata
             metadata_sorted = json.dumps(self.metadata, sort_keys=True)
             return f"{self.route}: {self.utterance} | {function_schemas_sorted} | {metadata_sorted}"
-- 
GitLab