-
Couldn't load subscription status.
- Fork 102
Open
Description
langchain-postgres/langchain_postgres/vectorstores.py
Lines 1419 to 1432 in 18b1bcd
| results: List[Any] = ( | |
| session.query( | |
| self.EmbeddingStore, | |
| self.distance_strategy(embedding).label("distance"), | |
| ) | |
| .filter(*filter_by) | |
| .order_by(sqlalchemy.asc("distance")) | |
| .join( | |
| self.CollectionStore, | |
| self.EmbeddingStore.collection_id == self.CollectionStore.uuid, | |
| ) | |
| .limit(k) | |
| .all() | |
| ) |
This query returns the embedding column which is expensive to deserialize into a python object and AFAICT is not used downstream. From my observations benchmarking against an equivalent query without the embedding column, this costs ~150ms (1024 dimension vector, k=30).
Metadata
Metadata
Assignees
Labels
No labels