Examples and guides for using the OpenAI API
Added retry decorator to embeddings
Colin Jarvis9f71c6b9a013
diff --git a/apps/enterprise-knowledge-retrieval/enterprise_knowledge_retrieval.ipynb b/apps/enterprise-knowledge-retrieval/enterprise_knowledge_retrieval.ipynbindex 6662407b..3626b065 100644--- a/apps/enterprise-knowledge-retrieval/enterprise_knowledge_retrieval.ipynb+++ b/apps/enterprise-knowledge-retrieval/enterprise_knowledge_retrieval.ipynb@@ -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",@@ -1197,7 +1198,7 @@{"cell_type": "code","execution_count": 14,- "id": "9e49c881",+ "id": "e3a6fb12","metadata": {},"outputs": [{@@ -1222,7 +1223,7 @@{"cell_type": "code","execution_count": 15,- "id": "2e6ff2f4",+ "id": "83f0231c","metadata": {},"outputs": [{@@ -1248,7 +1249,7 @@{"cell_type": "code","execution_count": 16,- "id": "963170f9",+ "id": "61c204c8","metadata": {},"outputs": [{@@ -2649,7 +2650,7 @@{"cell_type": "code","execution_count": 24,- "id": "c1b5fad4",+ "id": "ba73ffab","metadata": {},"outputs": [],"source": [@@ -2953,7 +2954,7 @@{"cell_type": "code","execution_count": 34,- "id": "99072e4c",+ "id": "4ee414f1","metadata": {},"outputs": [{