AttributeError: 'tuple' object has no attribute 'node' Traceback: File "~/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script exec(code, module.__dict__) File "~/main_production.py", line 225, in <module> response = get_response(prompt) File "~/main_production.py", line 169, in get_response nodes = hybrid_retriever.retrieve(prompt.lower()) File "~/llama_index/legacy/core/base_retriever.py", line 230, in retrieve nodes = self._handle_recursive_retrieval(query_bundle, nodes) File "~/llama_index/legacy/core/base_retriever.py", line 149, in _handle_recursive_retrieval node = n.node
class HybridRetriever(BaseRetriever): def __init__(self,vector_retriever_2000, bm25_retriever_2000): self.vector_retriever_2000 = vector_retriever_2000 self.bm25_retriever_2000 = bm25_retriever_2000 super().__init__() def _retrieve(self, query, **kwargs): bm25_nodes_2000 = self.bm25_retriever_2000.retrieve(query, **kwargs) vector_nodes_2000 = self.vector_retriever_2000.retrieve(query, **kwargs) all_nodes = bm25_nodes_2000 + vector_nodes_2000 encoding = tiktoken.encoding_for_model("gpt-3.5-turbo") context_str = "\n\n".join([n.node.get_content(metadata_mode=MetadataMode.LLM).strip() for n in bm25_nodes_2000+vector_nodes_2000]) num_token = len(encoding.encode(context_str)) print(num_token) if num_token > 3900: all_nodes = postprocessor.postprocess_nodes(nodes=all_nodes,query_bundle=QueryBundle(query_str=prompt.lower())) all_nodes = all_nodes[0:1] else: all_nodes = bm25_nodes_2000+vector_nodes_2000 return all_nodes