googleapis / langchain-google-cloud-sql-pg-python

Apache License 2.0
29 stars 11 forks source link

fix: Fix QueryOptions not applied to similarity search bug #185

Closed duwenxin99 closed 2 months ago

duwenxin99 commented 2 months ago

The index QueryOptions are set by executing SET LOCAL, whose effect only last within the same transaction. However, currently the similarity search is in a different transaction, which means the query options are never applied. I fixed this by creating a new _afetch_with_query_options(query, query_options) method that executes the query options statement before fetching similarity search result, and modify the search APIs to call this method instead of _afetch()