faiss_rag_enterprise/llama_index/indices/empty/retrievers.py

39 lines
1.2 KiB
Python

"""Default query for EmptyIndex."""
from typing import Any, List, Optional
from llama_index.callbacks.base import CallbackManager
from llama_index.core.base_retriever import BaseRetriever
from llama_index.indices.empty.base import EmptyIndex
from llama_index.prompts import BasePromptTemplate
from llama_index.prompts.default_prompts import DEFAULT_SIMPLE_INPUT_PROMPT
from llama_index.schema import NodeWithScore, QueryBundle
class EmptyIndexRetriever(BaseRetriever):
"""EmptyIndex query.
Passes the raw LLM call to the underlying LLM model.
Args:
input_prompt (Optional[BasePromptTemplate]): A Simple Input Prompt
(see :ref:`Prompt-Templates`).
"""
def __init__(
self,
index: EmptyIndex,
input_prompt: Optional[BasePromptTemplate] = None,
callback_manager: Optional[CallbackManager] = None,
**kwargs: Any,
) -> None:
"""Initialize params."""
self._index = index
self._input_prompt = input_prompt or DEFAULT_SIMPLE_INPUT_PROMPT
super().__init__(callback_manager)
def _retrieve(self, query_bundle: QueryBundle) -> List[NodeWithScore]:
"""Retrieve relevant nodes."""
del query_bundle # Unused
return []