Find answers from the community

Updated 3 months ago

Hey people

Hey people,

I am struggling to load an index that uses a PGVector store. The loaded index array is []

Plain Text
def setup_storage_context():
    from dotenv import load_dotenv
    from sqlalchemy import make_url
    from llama_index import StorageContext
    from llama_index.vector_stores import PGVectorStore
    from llama_index.storage.docstore import SimpleDocumentStore
    from llama_index.storage.index_store import SimpleIndexStore

    load_dotenv()
    url = make_url(os.getenv("DATABASE_URL"))
    storage_context = StorageContext.from_defaults(
        docstore=SimpleDocumentStore(),
        index_store=SimpleIndexStore(),
        vector_store=PGVectorStore.from_params(
            database="test",
            host=url.host,
            port=url.port,
            user=url.username,
            password=url.password,
            embed_dim=768,
            hybrid_search=True,
            debug=True
        )
    )
    return storage_context

storage_context = setup_storage_context()
indices = load_indices_from_storage(storage_context)
print(indices)


Storage persisted with index.storage_context.persist()

Not much data is being saved in the storage files.
d
1 comment
if you are using an external vectorDB, most likely you can just directly do

VectorStoreIndex.from_vector_store(pinecone_vector_store)
Add a reply
Sign up and join the conversation on Discord