Skip to content

Instantly share code, notes, and snippets.

@idontcalculate
Created December 13, 2023 04:16
Show Gist options
  • Save idontcalculate/a63584c3d91e08bc12fcdf85c039f876 to your computer and use it in GitHub Desktop.
Save idontcalculate/a63584c3d91e08bc12fcdf85c039f876 to your computer and use it in GitHub Desktop.
import llama_index
from llama_index.tools import QueryEngineTool, ToolMetadata
from llama_index import (
SimpleDirectoryReader,
VectorStoreIndex,
StorageContext,
load_index_from_storage,
)
try:
storage_context = StorageContext.from_defaults(
persist_dir="/content/storage/tesla"
)
tesla_index = load_index_from_storage(storage_context)
storage_context = StorageContext.from_defaults(
persist_dir="/content/storage/webtext"
)
webtext_index = load_index_from_storage(storage_context)
index_loaded = True
except:
index_loaded = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment