Empty Indexο
Building the Empty Index
Empty Index.
- class llama_index.indices.empty.EmptyIndexRetriever(index: GPTEmptyIndex, input_prompt: Optional[SimpleInputPrompt] = None, **kwargs: Any)ο
GPTEmptyIndex query.
Passes the raw LLM call to the underlying LLM model.
- Parameters
input_prompt (Optional[SimpleInputPrompt]) β A Simple Input Prompt (see Prompt Templates).
- retrieve(str_or_query_bundle: Union[str, QueryBundle]) List[NodeWithScore] ο
Retrieve nodes given query.
- Parameters
str_or_query_bundle (QueryType) β Either a query string or a QueryBundle object.
- class llama_index.indices.empty.GPTEmptyIndex(index_struct: Optional[EmptyIndex] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any)ο
GPT Empty Index.
An index that doesnβt contain any documents. Used for pure LLM calls. NOTE: this exists because an empty index it allows certain properties, such as the ability to be composed with other indices + token counting + others.
- classmethod from_documents(documents: Sequence[Document], storage_context: Optional[StorageContext] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any) IndexType ο
Create index from documents.
- Parameters
documents (Optional[Sequence[BaseDocument]]) β List of documents to build the index from.
- property index_id: strο
Get the index struct.
- refresh(documents: Sequence[Document], **update_kwargs: Any) List[bool] ο
Refresh an index with documents that have changed.
This allows users to save LLM and Embedding model calls, while only updating documents that have any changes in text or extra_info. It will also insert any documents that previously were not stored.
- set_index_id(index_id: str) None ο
Set the index id.
NOTE: if you decide to set the index_id on the index_struct manually, you will need to explicitly call add_index_struct on the index_store to update the index store.
- Parameters
index_id (str) β Index id to set.
- update(document: Document, **update_kwargs: Any) None ο
Update a document.
This is equivalent to deleting the document and then inserting it again.
- Parameters
document (Union[BaseDocument, BaseGPTIndex]) β document to update
insert_kwargs (Dict) β kwargs to pass to insert
delete_kwargs (Dict) β kwargs to pass to delete