Skip to content

Commit

Permalink
fix E722
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 7, 2023
1 parent b5e8156 commit fd999f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions docs/docs/expression_language/how_to/fallbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(openai_llm.invoke(\"Why did the chicken cross the road?\"))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand All @@ -114,7 +114,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(llm.invoke(\"Why did the chicken cross the road?\"))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand Down Expand Up @@ -156,7 +156,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(chain.invoke({\"animal\": \"kangaroo\"}))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand Down Expand Up @@ -190,10 +190,10 @@
")\n",
"\n",
"chain = prompt | llm\n",
"with patch(\"openai.ChatCompletion.create\", side_effect=error):\n",
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(chain.invoke({\"animal\": \"kangaroo\"}))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/fallbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(openai_llm.invoke(\"Why did the chicken cross the road?\"))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand All @@ -116,7 +116,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(llm.invoke(\"Why did the chicken cross the road?\"))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand Down Expand Up @@ -158,7 +158,7 @@
"with patch(\"openai.resources.chat.completions.Completions.create\", side_effect=error):\n",
" try:\n",
" print(chain.invoke({\"animal\": \"kangaroo\"}))\n",
" except:\n",
" except RateLimitError:\n",
" print(\"Hit error\")"
]
},
Expand Down
4 changes: 3 additions & 1 deletion docs/docs/integrations/tools/dalle_image_generator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@
"# Or you can try the options below to display the image inline in this notebook\n",
"\n",
"try:\n",
" import google.colab\n",
"\n",
" IN_COLAB = True\n",
"except:\n",
"except ImportError:\n",
" IN_COLAB = False\n",
"\n",
"if IN_COLAB:\n",
Expand Down

0 comments on commit fd999f5

Please sign in to comment.