mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
Added retry decorator to embeddings
This commit is contained in:
parent
5d9e877909
commit
9f71c6b9a0
@ -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": [
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user