Takes in a list of queries and filters and returns a list of query results with matching document chunks and scores.
(self, queries: List[Query])
| 51 | raise NotImplementedError |
| 52 | |
| 53 | async def query(self, queries: List[Query]) -> List[QueryResult]: |
| 54 | """ |
| 55 | Takes in a list of queries and filters and returns a list of query results with matching document chunks and scores. |
| 56 | """ |
| 57 | # get a list of just the queries from the Query list |
| 58 | query_texts = [query.query for query in queries] |
| 59 | query_embeddings = get_embeddings(query_texts) |
| 60 | # hydrate the queries with embeddings |
| 61 | queries_with_embeddings = [ |
| 62 | QueryWithEmbedding(**query.dict(), embedding=embedding) |
| 63 | for query, embedding in zip(queries, query_embeddings) |
| 64 | ] |
| 65 | return await self._query(queries_with_embeddings) |
| 66 | |
| 67 | @abstractmethod |
| 68 | async def _query(self, queries: List[QueryWithEmbedding]) -> List[QueryResult]: |