From a75c2ce895b180039653aed6021f66be2edcc166 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:51:04 -0500 Subject: [PATCH] lint --- docs/07-ollama-local-execution.ipynb | 23 +++++++++++---------- docs/examples/rolling-window-splitter.ipynb | 12 ++++++----- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/07-ollama-local-execution.ipynb b/docs/07-ollama-local-execution.ipynb index 91a011cb..cf26b77e 100644 --- a/docs/07-ollama-local-execution.ipynb +++ b/docs/07-ollama-local-execution.ipynb @@ -211,8 +211,10 @@ "from semantic_router.llms.ollama import OllamaLLM\n", "\n", "\n", - "llm = OllamaLLM(llm_name=\"openhermes\") # Change llm_name if you want to use a different LLM with dynamic routes.\n", - "rl = RouteLayer(encoder = encoder, routes=routes, llm=llm)" + "llm = OllamaLLM(\n", + " llm_name=\"openhermes\"\n", + ") # Change llm_name if you want to use a different LLM with dynamic routes.\n", + "rl = RouteLayer(encoder=encoder, routes=routes, llm=llm)" ] }, { @@ -303,15 +305,15 @@ "\n", "def get_time(timezone: str) -> str:\n", " \"\"\"\n", - "Finds the current time in a specific timezone.\n", + " Finds the current time in a specific timezone.\n", "\n", - ":param timezone: The timezone to find the current time in, should\n", - " be a valid timezone from the IANA Time Zone Database like\n", - " \"America/New_York\" or \"Europe/London\". Do NOT put the place\n", - " name itself like \"rome\", or \"new york\", you must provide\n", - " the IANA format.\n", - ":type timezone: str\n", - ":return: The current time in the specified timezone.\n", + " :param timezone: The timezone to find the current time in, should\n", + " be a valid timezone from the IANA Time Zone Database like\n", + " \"America/New_York\" or \"Europe/London\". Do NOT put the place\n", + " name itself like \"rome\", or \"new york\", you must provide\n", + " the IANA format.\n", + " :type timezone: str\n", + " :return: The current time in the specified timezone.\n", " \"\"\"\n", " now = datetime.now(ZoneInfo(timezone))\n", " return now.strftime(\"%H:%M\")" @@ -449,7 +451,6 @@ } ], "source": [ - "\n", "get_time(**out.function_call)" ] }, diff --git a/docs/examples/rolling-window-splitter.ipynb b/docs/examples/rolling-window-splitter.ipynb index 3e59347a..b94d3a56 100644 --- a/docs/examples/rolling-window-splitter.ipynb +++ b/docs/examples/rolling-window-splitter.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "outputs": [], "source": [ - "text = '''\n", + "text = \"\"\"\n", "In a recent surge of social media discussions on Weibo, Chinese netizens have been engaging in conversations about the struggles and challenges of earning money. The online debate sparked a wave of opinions and perspectives on the relationship between hard work, high pay, and finding contentment. Among the tweets, several users pontificated that one should avoid earning \"too much hard-earned money.\"\n", "The tweets and discussions revolve around the idea that working too hard for one's income can have a detrimental effect on one's life, both physically and mentally. Some users advocate for finding opportunities that align with one's strengths and passions, rather than simply focusing on high-paying jobs that may require excessive hours and intense labor.\n", "One Weibo user pontificates, \"Don't earn that much hard-earned money,\" a sentiment echoed by others with tweets such as, \"Why is it that when earning money, that process always has to be so tough?\" This question is followed by a comparison between two types of people - those who are used to earning money the hard way and those who seem to effortlessly obtain wealth. While the former group is depicted as having been taught to suffer from a young age, the latter is shown as being able to focus solely on their natural talents and thriving in their niche advantageously.\n", @@ -27,7 +27,7 @@ "Heart count: 0/2\n", "Note: The author did not include any Chinese characters in the final response.\n", "Collapse\n", - "'''" + "\"\"\"" ] }, { @@ -50,14 +50,16 @@ "from semantic_router.splitters import RollingWindowSplitter\n", "from semantic_router.encoders import OpenAIEncoder\n", "\n", - "os.environ[\"OPENAI_API_KEY\"] = os.getenv(\"OPENAI_API_KEY\") or getpass(\"Enter your OpenAI API key: \")\n", + "os.environ[\"OPENAI_API_KEY\"] = os.getenv(\"OPENAI_API_KEY\") or getpass(\n", + " \"Enter your OpenAI API key: \"\n", + ")\n", "\n", "splitter = RollingWindowSplitter(\n", " encoder=OpenAIEncoder(),\n", " min_split_tokens=50,\n", " max_split_tokens=300,\n", - " window_size=5, # sentences\n", - " plot_splits=True\n", + " window_size=5, # sentences\n", + " plot_splits=True,\n", ")" ] }, -- GitLab