AbstractRAGBackend

Bases: BaseBackend, ABC

load(storage_dir)

Load the index from the storage directory.

@param storage_dir: The path to the base storage directory.

read_directory(storage_dir, use_existing_index=True)

Read a directory of documents and create an index.

@param storage_dir: The path to the base storage directory. @param use_existing_index: [optional] If True, try to load an existing index from the storage directory first.

Side effects: - If use_existing_index is True, the index will be automatically saved (for future use)

read_gdrive(folder_id, storage_dir, use_existing_index=True)

Read a directory of documents from a Google Drive folder and create an index. Internally, the documents will first be downloaded to a local directory.

@param folder_id: The ID of the Google Drive folder. @param storage_dir: The path to the base storage directory. @param use_existing_index: [optional] If True, try to load an existing index from the storage directory first.

Side effects: - If use_existing_index is True, the index will be automatically saved (for future use)

read_website(urls, storage_dir, use_existing_index=True)

Read a directory of documents from a website and create an index. Internally, no documents are downloaded to a local directory.

@param url: The URL of the website. @param storage_dir: The path to the base storage directory. @param use_existing_index: [optional] If True, try to load an existing index from the storage directory first.

Side effects: - If use_existing_index is True, the index will be automatically saved (for future use)

save(storage_dir)

Save the index to the storage directory.

@param storage_dir: The path to the base storage directory.