INNER CODE UNIT · Python
load_data
dusty-nv/jetson-containers · packages/rag/jetson-copilot/app.py:48
def load_data():
with st.spinner(text="Loading and indexing the Jetson docs – hang tight! This should take 1-2 minutes."):
reader = SimpleDirectoryReader(input_dir="/data/documents/jetson", recursive=True)
docs = reader.load_data()
index = VectorStoreIndex.from_documents(docs)
return index
index = load_data()
# init models
if "chat_engine" not in st.session_state.keys(): # Initialize the chat engine
st.session_state.chat_engine = index.as_chat_engine(
chat_mode="context",
streaming=True,
memory=ChatMemoryBuffer.from_defaults(token_limit=3900),
llm=Settings.llm,
context_prompt=("""
You are a chatbot, able to have normal interactions, as well as talk about NVIDIA Jetson embedded AI computer.