Skip to content

'PGVector' has no attribute 'acreate' #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bfigueir opened this issue Jan 21, 2025 · 0 comments
Open

'PGVector' has no attribute 'acreate' #153

bfigueir opened this issue Jan 21, 2025 · 0 comments

Comments

@bfigueir
Copy link

Hi all,

im running a simple FastAPI endpoint with the code:

from langchain_postgres import PGVector
from langchain_postgres.vectorstores import PGVector

connection = "postgresql+psycopg://*****:******@localhost:5432/db"

@router.get(
    "/test_pgvector_2",
)
async def test_pgvector_2():
    vector_store = await PGVector.acreate(
        embeddings=get_embeddings(),
        collection_name="vector_store",
        connection=connection,
        use_jsonb=True,
    )

    retriever = vector_store.as_retriever()
    docs = retriever.invoke("prompt engineering")
    return docs

Based on the documentation that states "Initialize the PGVector store. For an async version, use PGVector.acreate() instead." it should work, but I'm getting the error AttributeError: type object 'PGVector' has no attribute 'acreate'

This is what I have on the pyproject.toml for the dependencies:

[tool.poetry.dependencies]
python = "^3.12.3"
uvicorn = "^0.34.0"
fastapi = "^0.115.6"
dapr = "^1.14.0"
python-dotenv = "^1.0.1"
structlog = "^24.4.0"
pydantic = "^2.0.0"
pydantic-settings = "^2.7.1"
sqlalchemy = "^2.0.36"
psycopg2-binary = "^2.9.10"
alembic = "^1.14.0"
langchain = "^0.3.7"
langchain-openai = "^0.2.8"
langchain-core = "^0.3.19"
onnxruntime = "1.19.2"
langchain-chroma = "^0.1.4"
bs4 = "^0.0.2"
langchain-community = "^0.3.7"
langgraph = "^0.2.50"
langchain-groq = "^0.2.1"
numexpr = "^2.10.1"
pyowm = "^3.3.0"
python-multipart = "^0.0.17"
setuptools = "^75.8.0"
cachetools = "^5.5.0"
async-lru = "^2.0.4"
langchain-postgres = "^0.0.12"

Any thoughts? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant