Skip to content

issues while running quickstart for pgvector #180

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

Closed
eyurtsev opened this issue Apr 7, 2025 · 4 comments · Fixed by #183
Closed

issues while running quickstart for pgvector #180

eyurtsev opened this issue Apr 7, 2025 · 4 comments · Fixed by #183

Comments

@eyurtsev
Copy link
Collaborator

eyurtsev commented Apr 7, 2025

  1. initialization

the line that initializes the table uses the wrong variable (engine instead of pg_engine) and uses a public method, but the method is actually private

await pg_engine._ainit_vectorstore_table(
    table_name=TABLE_NAME,
    vector_size=VECTOR_SIZE,
)
  1. initializing twice raises an exception (should we have create if not exists semantics as well?) Users may want to have the code live in their app lifespan for simplicity (instead of doing some logic on server deployment)

  2. cohere embeddings fails due to cohere model not being specified.

  3. using pgvectorstore create fails w/ an exception (
    AttributeError: 'AsyncEngine' object has no attribute '_run_as_async')

store = await PGVectorStore.create(
    engine=engine,
    table_name=TABLE_NAME,
    # schema_name=SCHEMA_NAME,
    embedding_service=embedding,
)

got stuck at this stage

@averikitsch
Copy link
Collaborator

  1. Use the public method, see here
    async def ainit_vectorstore_table(
    . We can use the double underscore to remove access to the semi private method. The semi private should only be used by Async experts.
  2. This is a bad practice to keep this in application code. Users can wrap the error if they want to ignore the best practice. Users can also use overwrite in the init call. We want this to be enterprise quality by enforcing this.
  3. We will fix this.
  4. What engine did you pass in? I’ll need to reproduce.

@eyurtsev
Copy link
Collaborator Author

eyurtsev commented Apr 7, 2025

  1. ainit_vectorstore_table

yep confirmed was an issue just b/c of engine vs. pg_engine

  1. This is a bad practice to keep this in application code. Users can wrap the error if they want to ignore the best practice. Users can also use overwrite in the init call. We want this to be enterprise quality by enforcing this.

OK skipping

  1. What engine did you pass in? I’ll need to reproduce.

not sure can try again, i running through the cells one by one

@dishaprakash
Copy link
Collaborator

  1. & 4. Are being caused by the use of variable engine instead of pg_engine.

  2. The PGVector example notebook mentioned this way of initializing the cohere embedding so I left that in. I'll update it to mention the model name.

Sorry about the oversight. I'll make the changes

@dishaprakash
Copy link
Collaborator

The above changes are being made in #183

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

Successfully merging a pull request may close this issue.

3 participants