Find answers from the community

Updated 9 months ago

llama-index 0.10.19+ has the following

llama-index 0.10.19+ has the following errors (I haven't checked prior versions)
Plain Text
def get_pg_storage_context():
    from llama_index.storage.docstore.postgres import PostgresDocumentStore
    from llama_index.storage.index_store.postgres import PostgresIndexStore
    from llama_index.vector_stores.postgres import PGVectorStore

    storage_context = StorageContext.from_defaults(
        docstore=PostgresDocumentStore.from_uri(uri="postgres://....."),
        index_store=PostgresIndexStore.from_uri="postgres://..."),
        vector_store=PGVectorStore.from_uri="postgres://...",
    )
    return storage_context

this raises the following exceptions for docstore and indexstore:
Plain Text
File ~/.virtualenvs/grizzly_3.10/lib/python3.10/site-packages/llama_index/storage/docstore/postgres/base.py:5
      3 from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore
      4 from llama_index.core.storage.docstore.types import DEFAULT_BATCH_SIZE
----> 5 from llama_index.storage.kvstore.postgres import PostgresKVStore

ModuleNotFoundError: No module named 'llama_index.storage.kvstore'

same issue with: llama_index/storage/index_store/postgres/base.py:4

the location of PostgresKVStore is at from llama_index.core.storage.kvstore.postgres_kvstore import PostgresKVStore
Fixing the bad imports allows the function above to run, but I don't know if there is anything else wrong w PostgresDocumentStore and PostgresIndexStore. Should I submit a PR for this?
L
h
4 comments
Its just missing a dep
pip install llama-index-storage-kvstore-postgres
@Logan M thanks for merging my PR quickly, I needed it
Add a reply
Sign up and join the conversation on Discord