mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
Added notes where users can consider adding thread pool to speed up upsert operation
This commit is contained in:
parent
21ca5a9555
commit
fb18b7f6c2
@ -476,6 +476,7 @@
|
||||
],
|
||||
"source": [
|
||||
"# Upsert content vectors in content namespace\n",
|
||||
"# NOTE: Using a thread pool here can accelerate this upsert operation\n",
|
||||
"print(\"Uploading vectors to content namespace..\")\n",
|
||||
"for batch_df in df_batcher(article_df):\n",
|
||||
" index.upsert(vectors=zip(batch_df.vector_id, batch_df.content_vector), namespace='content')"
|
||||
@ -497,6 +498,7 @@
|
||||
],
|
||||
"source": [
|
||||
"# Upsert title vectors in title namespace\n",
|
||||
"# NOTE: Using a thread pool here can accelerate this upsert operation\n",
|
||||
"print(\"Uploading vectors to title namespace..\")\n",
|
||||
"for batch_df in df_batcher(article_df):\n",
|
||||
" index.upsert(vectors=zip(batch_df.vector_id, batch_df.title_vector), namespace='title')"
|
||||
@ -841,13 +843,14 @@
|
||||
" data_objects.append((v['title'],v['text'],v['title_vector'],v['vector_id']))\n",
|
||||
"\n",
|
||||
"# Upsert into article schema\n",
|
||||
"# NOTE: Using a thread pool here can accelerate this upsert operation\n",
|
||||
"print(\"Uploading vectors to article schema..\")\n",
|
||||
"uuids = []\n",
|
||||
"for articles in data_objects:\n",
|
||||
" uuid = client.data_object.create(\n",
|
||||
" {\n",
|
||||
" \"title\": articles[0],\n",
|
||||
" \"content\": articles[1]\n",
|
||||
" \"title\": articles[0],\n",
|
||||
" \"content\": articles[1]\n",
|
||||
" },\n",
|
||||
" \"Article\",\n",
|
||||
" vector=articles[2]\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user