Find answers from the community

Updated 3 months ago

if I have an index like```cur_index = VectorStoreIndex.from_documents( r

if I have an index like
Plain Text
cur_index = VectorStoreIndex.from_documents(
                report,
                service_context=service_context,
                storage_context=storage_context,
            )

how can I add another document to this index?
k
2 comments
Please stand by @Rouzbeh as I search the knowledge base. We are experiencing especially high traffic right now and might take longer than usual. :wave:
----------------------
To add another document to an existing index, you can use the insert method. Here's an example based on the information provided in the extracts:

Plain Text
cur_index.insert(new_document)


Replace new_document with the actual document you want to add to the index. Note that the document should be an instance of the Document class.

Keep in mind that the code snippet you provided uses VectorStoreIndex, but the extracts mention GPTVectorStoreIndex. Make sure you're using the correct index class for your use case.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord