Find answers from the community

Updated 3 months ago

Hi team Llama, when using the ```

Hi team Llama, when using the
Plain Text
vector_store = WeaviateVectorStore(
    weaviate_client=client, index_name="LlamaIndex"
)
index = VectorStoreIndex.from_vector_store(store)

Is it possible to then check if said index has any documents loaded?
W
P
8 comments
I think the documents basically docstore is not available when using a third party vector store. As they store the text plus embedding together in the vector space.
Yep that is true docstore is not set since weaviate has the stores_text property set to true.
However is it possible to check if there are any nodes/embeddings stored in weaviate for said index_name?
The problem I'm having is for a simple prototype, which we start and stop during development. On boot we create the index and store it. But on subsequent boots I would like to retrieve it instead of recreating it and calling OpenAI again
If you have created the embedding once, I think you'll only need to pass the index name that you set in the first run.

It should then start using the embeddings that you generated in the first run.
The problem is that the application does not know when it is their first start, so it doesnt know if it should embed documents and add it to the index.
I'd like to do something like:
Plain Text
vector_store = WeaviateVectorStore(
    weaviate_client=client, index_name="LlamaIndex"
)
index = VectorStoreIndex.from_vector_store(store)
if not index.has_docs_with_embeddings:
  docs = simpleDirectoryLoader(...)
  index = VectorStoreIndex.from_documents(docs)


Do you get what I mean? I might not be clear enough with the problem definition
Yeah got it.

Just chekced the weaviate docs: https://weaviate.io/developers/weaviate/manage-data/read-all-objects#read-object-properties-and-ids

Since you'll have the client object of weaviate with you that you passed in the Weaviate Vector store.
You can use to query the weaviate to check if there is any content there or not using the above link. If there's no data you can add it else continue
ahhh greaat exactly what I needed! Thought I'd check before writing custom queries if it was implemented in Llamaindex.
Add a reply
Sign up and join the conversation on Discord