Retrieve relevant text passages without calling the LLM. Useful for debugging which chunks would be used as context, or for building custom pipelines on top of the retrieval step. Args: query: The natural-language question. doc_id: Document identifie
(self, query: str, doc_id, context_size=4)
| 346 | return None, response, coordinates |
| 347 | |
| 348 | def query_storage(self, query: str, doc_id, context_size=4) -> tuple[List[str], list]: |
| 349 | """Retrieve relevant text passages without calling the LLM. |
| 350 | |
| 351 | Useful for debugging which chunks would be used as context, or for |
| 352 | building custom pipelines on top of the retrieval step. |
| 353 | |
| 354 | Args: |
| 355 | query: The natural-language question. |
| 356 | doc_id: Document identifier. |
| 357 | context_size: Number of chunks to retrieve (default 4). |
| 358 | |
| 359 | Returns: |
| 360 | tuple: ``(texts, coordinates)`` |
| 361 | |
| 362 | - *texts* — list of passage strings. |
| 363 | - *coordinates* — list of lists of coordinate strings. |
| 364 | """ |
| 365 | documents, coordinates = self._get_context(doc_id, query, context_size) |
| 366 | |
| 367 | context_as_text = [doc.page_content for doc in documents] |
| 368 | return context_as_text, coordinates |
| 369 | |
| 370 | def query_storage_and_embeddings(self, query: str, doc_id, context_size=4) -> List[Document]: |
| 371 | """Retrieve passages with their similarity scores and raw embeddings. |
no test coverage detected