mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
Rows returned from similarity_search with filter less than expected #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @CrazyShipOne on GitHub (Jul 25, 2024).
Hi, thanks in advance for this amazing project!
The problem I'm facing is rows returned from function similarity_search always less than expected.
For example, I have 100 rows match filter's condition in table langchain_pg_embedding, by executing
I expected length of docs should be 100. However, per different query_context, length of docs are various but less than 100 all the time, like 43 or 67.
So I enabled log for sqlchemy.engine, and got SQL it generated here:
After replace parameters into sql and execute it in pgAdmin, 100 rows are returned.
Then I dig into code, tried to comment filter in sqlalchemy query
vectorstores.py
All 100 rows are returned.
I'm not familiar with sqlalchemy so no clues at all. Could you please take a look on what's happening here? Am I using the search function in wrong way?
Thanks!
@eyurtsev commented on GitHub (Jul 26, 2024):
Could you share which query you executed in SQL?