Zack Saadioui
8/26/2024
1
2
bash
pip install llama-index
1
2
bash
export OPENAI_API_KEY='your-api-key-here'
1
data
1
.txt
1
.pdf
1
2
python
index = VectorStoreIndex.from_documents(documents)
1
2
python
query_engine = index.as_query_engine()
1
2
3
python
response = query_engine.query("What is the author growing up?")
print(response)
1
SubQuestionQueryEngine
1
RouterQueryEngine
1
2
3
4
5
python
index = SummaryIndex.from_documents(documents)
query_engine = index.as_query_engine(response_mode="tree_summarize")
response = query_engine.query("What is the summary of the collection?")
print(response)
Copyright © Arsturn 2024