OoriData / OgbujiPT

Client-side toolkit for using large language models, including where self-hosted
Apache License 2.0
101 stars 8 forks source link

PGVectorHelper methods non-reentrant. Use a connection pool. #60

Closed uogbuji closed 9 months ago

uogbuji commented 9 months ago

PGVectorHelper instances have a connection, which renders their methods non-reentrant. I ran into this last night in the form of

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

Since DB connections are stateful, this is a classic use-case for a connection pool. Furthermore, it's bad that PGVectorHelper instances hold upon a connection for an indefinite, and possibly long time.