Fixed bug7445 where a duplicate restuld_id is added to the vectorstore. (#7573)

- Description: updated BabyAGI examples to append the iteration to the
result id to fix error storing data to vectorstore.
  - Issue: 7445
  - Dependencies: no
  - Tag maintainer: @eyurtsev
- Twitter handle: we announce bigger features on Twitter. If your PR
gets announced and you'd like a mention, we'll gladly shout you out!

This fix worked for me locally. Happy to take some feedback and iterate
on a better solution. I was considering appending a uuid instead but
didnt want to over complicate the example.
This commit is contained in:
DJ Atha 2023-07-31 19:00:01 -06:00 committed by GitHub
parent ff5024634e
commit ec40ead980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -343,7 +343,7 @@
" self.print_task_result(result)\n", " self.print_task_result(result)\n",
"\n", "\n",
" # Step 3: Store the result in Pinecone\n", " # Step 3: Store the result in Pinecone\n",
" result_id = f\"result_{task['task_id']}\"\n", " result_id = f\"result_{task['task_id']}_{num_iters}\"\n",
" self.vectorstore.add_texts(\n", " self.vectorstore.add_texts(\n",
" texts=[result],\n", " texts=[result],\n",
" metadatas=[{\"task\": task[\"task_name\"]}],\n", " metadatas=[{\"task\": task[\"task_name\"]}],\n",

View File

@ -358,7 +358,7 @@
" self.print_task_result(result)\n", " self.print_task_result(result)\n",
"\n", "\n",
" # Step 3: Store the result in Pinecone\n", " # Step 3: Store the result in Pinecone\n",
" result_id = f\"result_{task['task_id']}\"\n", " result_id = f\"result_{task['task_id']}_{num_iters}\"\n",
" self.vectorstore.add_texts(\n", " self.vectorstore.add_texts(\n",
" texts=[result],\n", " texts=[result],\n",
" metadatas=[{\"task\": task[\"task_name\"]}],\n", " metadatas=[{\"task\": task[\"task_name\"]}],\n",