langchain-ai / langchain-postgres

LangChain abstractions backed by Postgres Backend
MIT License
66 stars 22 forks source link

relation "langchain_pg_collection" does not exist #33

Closed joshpopelka20 closed 2 months ago

joshpopelka20 commented 2 months ago

After creating the vector store,

vectorstore = PGVector(
    embeddings=embeddings,
    collection_name=collection_name,
    connection=connection,
    use_jsonb=True
)

I try to run: vectorstore.add_documents(docs, ids=[doc.metadata['id'] for doc in docs])

I'm getting this error message: relation "langchain_pg_collection" does not exist

I'm using python3.10, psycopg3, and langchain-postgres v0.0.3

joshpopelka20 commented 2 months ago

For anyone else facing this issue, I was able to figure it out by running these two commands after vectorstore.drop_tables():

vectorstore.create_tables_if_not_exists()
vectorstore.create_collection()