Skip to content

Commit

Permalink
Added retry decorator to embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-openai committed May 12, 2023
1 parent 5d9e877 commit 9f71c6b
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1084,13 +1084,14 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "ca7e7eb1",
"id": "eb5848f3",
"metadata": {},
"outputs": [],
"source": [
"## Batch Embedding Logic\n",
"\n",
"# Simple function to take in a list of text objects and return them as a list of embeddings\n",
"@retry(wait=wait_random_exponential(min=1, max=40), stop=stop_after_attempt(10))\n",
"def get_embeddings(input: List):\n",
" response = openai.Embedding.create(\n",
" input=input,\n",
Expand Down Expand Up @@ -1197,7 +1198,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "9e49c881",
"id": "e3a6fb12",
"metadata": {},
"outputs": [
{
Expand All @@ -1222,7 +1223,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "2e6ff2f4",
"id": "83f0231c",
"metadata": {},
"outputs": [
{
Expand All @@ -1248,7 +1249,7 @@
{
"cell_type": "code",
"execution_count": 16,
"id": "963170f9",
"id": "61c204c8",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -2649,7 +2650,7 @@
{
"cell_type": "code",
"execution_count": 24,
"id": "c1b5fad4",
"id": "ba73ffab",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -2953,7 +2954,7 @@
{
"cell_type": "code",
"execution_count": 34,
"id": "99072e4c",
"id": "4ee414f1",
"metadata": {},
"outputs": [
{
Expand Down

0 comments on commit 9f71c6b

Please sign in to comment.