From 573519ccd875074e50c85f1d01876472c508e6d1 Mon Sep 17 00:00:00 2001
From: Simonas <20096648+simjak@users.noreply.github.com>
Date: Fri, 15 Dec 2023 11:52:22 +0200
Subject: [PATCH] linting

---
 coverage.xml                         |  2 +-
 docs/examples/function_calling.ipynb | 24 +++++++++++-------------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/coverage.xml b/coverage.xml
index 52f00b34..9bdbfa37 100644
--- a/coverage.xml
+++ b/coverage.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<coverage version="7.3.2" timestamp="1702538160019" lines-valid="344" lines-covered="344" line-rate="1" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
+<coverage version="7.3.2" timestamp="1702633916069" lines-valid="344" lines-covered="344" line-rate="1" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
 	<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.3.2 -->
 	<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
 	<sources>
diff --git a/docs/examples/function_calling.ipynb b/docs/examples/function_calling.ipynb
index e05686b3..650b5b94 100644
--- a/docs/examples/function_calling.ipynb
+++ b/docs/examples/function_calling.ipynb
@@ -17,6 +17,7 @@
     "import openai\n",
     "from semantic_router.utils.logger import logger\n",
     "\n",
+    "\n",
     "# Docs # https://platform.openai.com/docs/guides/function-calling\n",
     "def llm_openai(prompt: str, model: str = \"gpt-4\") -> str:\n",
     "    try:\n",
@@ -49,6 +50,7 @@
     "# Docs https://huggingface.co/docs/transformers/main_classes/text_generation\n",
     "HF_API_TOKEN = os.environ[\"HF_API_TOKEN\"]\n",
     "\n",
+    "\n",
     "def llm_mistral(prompt: str) -> str:\n",
     "    api_url = \"https://z5t4cuhg21uxfmc3.us-east-1.aws.endpoints.huggingface.cloud/\"\n",
     "    headers = {\n",
@@ -71,9 +73,9 @@
     "    if response.status_code != 200:\n",
     "        raise Exception(\"Failed to call HuggingFace API\", response.text)\n",
     "\n",
-    "    ai_message = response.json()[0]['generated_text']\n",
+    "    ai_message = response.json()[0][\"generated_text\"]\n",
     "    if not ai_message:\n",
-    "            raise Exception(\"AI message is empty\", ai_message)\n",
+    "        raise Exception(\"AI message is empty\", ai_message)\n",
     "    logger.info(f\"AI message: {ai_message}\")\n",
     "    return ai_message"
    ]
@@ -94,6 +96,7 @@
     "import inspect\n",
     "from typing import Any\n",
     "\n",
+    "\n",
     "def get_function_schema(function) -> dict[str, Any]:\n",
     "    schema = {\n",
     "        \"name\": function.__name__,\n",
@@ -116,6 +119,7 @@
     "\n",
     "from semantic_router.utils.logger import logger\n",
     "\n",
+    "\n",
     "def generate_route(function) -> dict:\n",
     "    logger.info(\"Generating config...\")\n",
     "    example_schema = {\n",
@@ -249,6 +253,7 @@
     "from semantic_router.layer import RouteLayer\n",
     "from semantic_router.utils.logger import logger\n",
     "\n",
+    "\n",
     "def create_router(routes: list[dict]) -> RouteLayer:\n",
     "    logger.info(\"Creating route layer...\")\n",
     "    encoder = CohereEncoder()\n",
@@ -279,6 +284,7 @@
    "source": [
     "from typing import Callable\n",
     "\n",
+    "\n",
     "def call_function(function: Callable, parameters: dict[str, str]):\n",
     "    try:\n",
     "        return function(**parameters)\n",
@@ -410,17 +416,9 @@
     }
    ],
    "source": [
-    "call(query=\"What is the time in Stockholm?\",\n",
-    "    functions=tools,\n",
-    "    router=router)\n",
-    "call(\n",
-    "    query=\"What is the tech news in the Lithuania?\",\n",
-    "    functions=tools,\n",
-    "    router=router)\n",
-    "call(\n",
-    "    query=\"Hi!\",\n",
-    "    functions=tools,\n",
-    "    router=router)\n"
+    "call(query=\"What is the time in Stockholm?\", functions=tools, router=router)\n",
+    "call(query=\"What is the tech news in the Lithuania?\", functions=tools, router=router)\n",
+    "call(query=\"Hi!\", functions=tools, router=router)"
    ]
   }
  ],
-- 
GitLab