[PR #177] [CLOSED] Handle index initialization with both indexStruct and indexStore #596

Closed
opened 2026-02-15 20:17:58 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/LlamaIndexTS/pull/177
Author: @sweep-ai-deprecated[bot]
Created: 11/8/2023
Status: Closed

Base: mainHead: sweep/fix-index-initialization


📝 Commits (10+)

  • 49574cb feat: Updated packages/core/src/indices/vectorStor
  • d51cc6f Merge main into sweep/fix-index-initialization
  • f01bf00 Merge main into sweep/fix-index-initialization
  • db72c4a Merge main into sweep/fix-index-initialization
  • 6789cad Merge main into sweep/fix-index-initialization
  • 601a339 Merge main into sweep/fix-index-initialization
  • 884b951 Merge main into sweep/fix-index-initialization
  • 324b886 Merge main into sweep/fix-index-initialization
  • 3ea2f54 Merge main into sweep/fix-index-initialization
  • d86cd5d Merge main into sweep/fix-index-initialization

📊 Changes

1 file changed (+1 additions, -7 deletions)

View changed files

📝 packages/core/src/indices/vectorStore/VectorStoreIndex.ts (+1 -7)

📄 Description

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

Description

This PR addresses the issue where initializing a VectorStoreIndex from a persisted store that contains both an indexStruct and an indexStore would throw an error. The VectorStoreIndex.init() method has been modified to handle this case more gracefully. Instead of throwing an error, the method now prioritizes the indexStore over the indexStruct. This means if both are present, the indexStore is used and the indexStruct is ignored.

Summary of Changes

  • Modified the VectorStoreIndex.init() method in packages/core/src/indices/vectorStore/VectorStoreIndex.ts to handle the case when both indexStruct and indexStore are present in the persisted store.
  • Updated the condition that previously threw the error Cannot initialize index with both indexStruct and indexStore to prioritize the indexStore over the indexStruct.
  • Tested the change with a persisted store that contains both an indexStruct and an indexStore to ensure the error is no longer thrown and the index is initialized correctly.

Fixes #173.


🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/LlamaIndexTS/pull/177 **Author:** [@sweep-ai-deprecated[bot]](https://github.com/apps/sweep-ai-deprecated) **Created:** 11/8/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `sweep/fix-index-initialization` --- ### 📝 Commits (10+) - [`49574cb`](https://github.com/run-llama/LlamaIndexTS/commit/49574cb4937228a5dda4854941cae842f387129f) feat: Updated packages/core/src/indices/vectorStor - [`d51cc6f`](https://github.com/run-llama/LlamaIndexTS/commit/d51cc6f869964342e02548f361ceeacf9b10c2b7) Merge main into sweep/fix-index-initialization - [`f01bf00`](https://github.com/run-llama/LlamaIndexTS/commit/f01bf001237cedd6ffaaf621023d3241d97c477c) Merge main into sweep/fix-index-initialization - [`db72c4a`](https://github.com/run-llama/LlamaIndexTS/commit/db72c4a2c3de0f571cb37243e242d55dcbbc989d) Merge main into sweep/fix-index-initialization - [`6789cad`](https://github.com/run-llama/LlamaIndexTS/commit/6789cadf2a81d5ae9ce7e03441144c59d7b4305f) Merge main into sweep/fix-index-initialization - [`601a339`](https://github.com/run-llama/LlamaIndexTS/commit/601a3390c84a1ea5577b715836d80fd8e8cc4628) Merge main into sweep/fix-index-initialization - [`884b951`](https://github.com/run-llama/LlamaIndexTS/commit/884b951c03a21fa4c2727ad9562b69808d8b6d66) Merge main into sweep/fix-index-initialization - [`324b886`](https://github.com/run-llama/LlamaIndexTS/commit/324b88622553f143b73df186b4385e4a1531be67) Merge main into sweep/fix-index-initialization - [`3ea2f54`](https://github.com/run-llama/LlamaIndexTS/commit/3ea2f544f8f5e6e245a7a230ad545bc1ce34e2cf) Merge main into sweep/fix-index-initialization - [`d86cd5d`](https://github.com/run-llama/LlamaIndexTS/commit/d86cd5d178b1bea5883e3d68583d87817daf4779) Merge main into sweep/fix-index-initialization ### 📊 Changes **1 file changed** (+1 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/indices/vectorStore/VectorStoreIndex.ts` (+1 -7) </details> ### 📄 Description ### PR Feedback (click) - [ ] 👍 Sweep Did Well - [ ] 👎 Sweep Needs Improvement ## Description This PR addresses the issue where initializing a `VectorStoreIndex` from a persisted store that contains both an `indexStruct` and an `indexStore` would throw an error. The `VectorStoreIndex.init()` method has been modified to handle this case more gracefully. Instead of throwing an error, the method now prioritizes the `indexStore` over the `indexStruct`. This means if both are present, the `indexStore` is used and the `indexStruct` is ignored. ## Summary of Changes - Modified the `VectorStoreIndex.init()` method in `packages/core/src/indices/vectorStore/VectorStoreIndex.ts` to handle the case when both `indexStruct` and `indexStore` are present in the persisted store. - Updated the condition that previously threw the error `Cannot initialize index with both indexStruct and indexStore` to prioritize the `indexStore` over the `indexStruct`. - Tested the change with a persisted store that contains both an `indexStruct` and an `indexStore` to ensure the error is no longer thrown and the index is initialized correctly. Fixes #173. --- ### 🎉 Latest improvements to Sweep: * Sweep now uses the `rope` library to refactor Python! Check out [Large Language Models are Bad at Refactoring Code](https://docs.sweep.dev/blogs/refactor-python). To have Sweep refactor your code, try `sweep: Refactor <your_file>.py to be more modular`! * Sweep finds and fixes bugs in your code by writing unit tests! Check out [Having GPT-4 Iterate on Unit Tests like a Human](https://docs.sweep.dev/blogs/ai-unit-tests). --- ### 💡 To get Sweep to edit this pull request, you can: * Comment below, and Sweep can edit the entire PR * Comment on a file, Sweep will only modify the commented file * Edit the original issue to get Sweep to recreate the PR from scratch --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 20:17:58 -05:00
yindo closed this issue 2026-02-15 20:17:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/LlamaIndexTS#596