Expected behavior
The RagEngine should be able to handle the fact that there is nothing returned to get reranked.
Screenshots
| Traceback (most recent call last):
| File "/opt/webapp/api/griptapecloud/components/knowledge_bases/views.py", line 171, in post
| context = engine.process_query(query)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/griptape/engines/rag/rag_engine.py", line 37, in process_query
| return self.process(RagContext(query=query))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/griptape/engines/rag/rag_engine.py", line 44, in process
| context = self.retrieval_stage.run(context)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/griptape/engines/rag/stages/retrieval_rag_stage.py", line 62, in run
| context.text_chunks = [a for a in self.rerank_module.run(context) if isinstance(a, TextArtifact)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/griptape/engines/rag/modules/retrieval/text_chunks_rerank_rag_module.py", line 13, in run
| return self.rerank_driver.run(context.query, context.text_chunks)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/griptape/drivers/rerank/cohere_rerank_driver.py", line 28, in run
| response = self.client.rerank(
| ^^^^^^^^^^^^^^^^^^^
| File "/opt/webapp/api/.venv/lib/python3.11/site-packages/cohere/base_client.py", line 1595, in rerank
| raise BadRequestError(
| cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': 'invalid request: list of documents must not be empty'}
Desktop (please complete the following information):
OS: [e.g. iOS]
Version [e.g. 0.5.1]
Additional context
Add any other context about the problem here.
Describe the bug
CohereRerankDriver
throws a 400 if there is no documents getting sent.To Reproduce
Expected behavior The
RagEngine
should be able to handle the fact that there is nothing returned to get reranked.Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.