Many vector databases can find the top k
most similar results to a query but are unable to sort by other document metadata. This is a pretty severe limitation for building LLM applications, especially for ones where time is dimension (meetings, calendars, task lists, etc.). For example, retrieving the 10 most similar results to the phrase “team meeting notes” but not being able to retrieve the team meeting notes from the last month.
To work around the limitation of sorting vector query results, the most common suggestion is to pre-process a query or run multiple queries with different strategies at once and then combine the results. For example, first query for documents with a string similar to “meeting notes” (maybe using fuzzy, full-text search) filtered by date, then constrain a vector query search based on the collection of filtered records, and then pass the results to an LLM to synthesize the results and respond.
See also:
- LLMs have difficulty with dates and time
- Chatbots lack affordances so the ability to gracefully handle filtering and sorting is even more important