Zack Saadioui
8/26/2024
1
pip
1
2
bash
pip install llama-index
1
data
1
gpt-3.5-turbo
1
2
bash
export OPENAI_API_KEY=YOUR_API_KEY_HERE
1
2
bash
set OPENAI_API_KEY=YOUR_API_KEY_HERE
1
YOUR_API_KEY_HERE
1
starter.py
1
2
``
This simple snippet loads the document from the
1
2
3
├── starter.py
└── data
└── paul_graham_essay.txt
1
starter.py
1
2
3
4
python
query_engine = index.as_query_engine()
response = query_engine.query("What did the author focus on growing up?")
print(response)
1
starter.py
1
2
``
This will give you a more verbose output! You can set the level to
1
2
python
index.storage_context.persist()
1
storage
1
2
3
4
python
query_engine = index.as_query_engine()
response = query_engine.query("What did the author focus on growing up?")
print(response)
Copyright © Arsturn 2025