----------------------
Sure, I can help with that.
To manage documents that are ingested into the index, you can use the
VectorStoreIndex
class from the
llama_index.core
module. This class allows you to create a vector index using your vector store and quickly ask which documents are seen. Here's an example of how you can do this:
from llama_index.core import VectorStoreIndex
index = VectorStoreIndex.from_vector_store(
pipeline.vector_store, embed_model=embed_model
)
print(
index.as_query_engine(similarity_top_k=10).query(
"What documents do you see?"
)
)
(Source:
Github ())
To avoid document duplication and save embedding tokens, you can manage documents from a source that is constantly updating. For example, if you're using Discord as your source, you can manage the documents in such a way that you always have the latest data without duplicating any messages. You can learn more about this from the
Discover LlamaIndex Video Series () on Discord Document Management.
To update or delete an existing document in an index, you can use the
doc_id
. You can also add a new document to an existing index. More details can be found in the
Document Management () section of the LlamaIndex documentation.
As for managing telemetry/evaluation for multiple users, one way to handle this is by using the
BaseManager
python package to provide sequential access to the index using a separate server and locks. This can help handle concurrent uploads and ensure sequential inserts into the index. Here's a basic example of what your
index_server.py
might look like: