diff --git a/docs/07-ollama-local-execution.ipynb b/docs/07-ollama-local-execution.ipynb index 91a011cb51efa4ca98cb47d227f4b43fbbd9bda3..cf26b77ec5355d41efb6a69a896c52a3dd8f53f8 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 3e59347ac369b5df9148860df9c7c6a220e10755..b94d3a5615ec9b2edda91da90a481be235829bef 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", ")" ] },