Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescalam committed Feb 23, 2024
1 parent 57f024c commit a75c2ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
23 changes: 12 additions & 11 deletions docs/07-ollama-local-execution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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\")"
Expand Down Expand Up @@ -449,7 +451,6 @@
}
],
"source": [
"\n",
"get_time(**out.function_call)"
]
},
Expand Down
12 changes: 7 additions & 5 deletions docs/examples/rolling-window-splitter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
"'''"
"\"\"\""
]
},
{
Expand All @@ -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",
")"
]
},
Expand Down

0 comments on commit a75c2ce

Please sign in to comment.