File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
llama_index/indices/empty Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -143,4 +143,7 @@ modules/
143143
144144# pipenv
145145Pipfile
146- Pipfile.lock
146+ Pipfile.lock
147+
148+ # pyright
149+ pyrightconfig.json
Original file line number Diff line number Diff line change 1111from llama_index .data_structs .node import Node
1212from llama_index .indices .base import BaseIndex
1313from llama_index .indices .base_retriever import BaseRetriever
14+ from llama_index .indices .query .base import BaseQueryEngine
1415from llama_index .indices .service_context import ServiceContext
1516from llama_index .storage .docstore .types import RefDocInfo
1617
@@ -48,6 +49,15 @@ def as_retriever(self, **kwargs: Any) -> BaseRetriever:
4849
4950 return EmptyIndexRetriever (self )
5051
52+ def as_query_engine (self , ** kwargs : Any ) -> BaseQueryEngine :
53+ if "response_mode" not in kwargs :
54+ kwargs ["response_mode" ] = "generation"
55+ else :
56+ if kwargs ["response_mode" ] != "generation" :
57+ raise ValueError ("EmptyIndex only supports response_mode=generation." )
58+
59+ return super ().as_query_engine (** kwargs )
60+
5161 def _build_index_from_nodes (self , nodes : Sequence [Node ]) -> EmptyIndexStruct :
5262 """Build the index from documents.
5363
You can’t perform that action at this time.
0 commit comments