Query the table and return the results
(
self,
query_text: str,
collection: str = None,
n_results: int = 5
)
| 54 | print(f"Batch {i+1}/{num_batches} added") |
| 55 | |
| 56 | def query_text_content( |
| 57 | self, |
| 58 | query_text: str, |
| 59 | collection: str = None, |
| 60 | n_results: int = 5 |
| 61 | ) -> List[str]: |
| 62 | """ |
| 63 | Query the table and return the results |
| 64 | """ |
| 65 | assert collection is not None, "Collection is required. Should be the path of the paper." |
| 66 | results = self.query([query_text], collection=collection, n_results=n_results) |
| 67 | |
| 68 | metadata_results = results['metadatas'][0] |
| 69 | |
| 70 | results = [item['response'] for item in metadata_results] |
| 71 | return results |
| 72 | |
| 73 | def peek_table(self, collection: str = None, n_results: int = 20) -> pd.DataFrame: |
| 74 | """ |