Skip to content

Examples and guides for using the OpenAI API

Convert back to list only after all np operations

Filipe de Avila Belbute Peres2e59263390e9
diff --git a/examples/Embedding_long_inputs.ipynb b/examples/Embedding_long_inputs.ipynb
index fe6b5fab..e4460f47 100644
--- a/examples/Embedding_long_inputs.ipynb
+++ b/examples/Embedding_long_inputs.ipynb
@@ -204,8 +204,9 @@
" chunk_embeddings.append(get_embedding(chunk, model=model))\n",
"\n",
" if average:\n",
- " chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=[len(c) for c in chunk_embeddings]).tolist()\n",
+ " chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=[len(c) for c in chunk_embeddings])\n",
" chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings) # normalizes length to 1\n",
+ " chunk_embeddings = chunk_embeddings.tolist()\n",
" return chunk_embeddings"
]
},