README / README.md
jerryjliu's picture
Update README.md
a3b7a80
|
raw
history blame
1.26 kB
---
title: README
emoji: πŸ¦™
colorFrom: yellow
colorTo: purple
sdk: static
pinned: false
---
# πŸ—‚οΈ LlamaIndex πŸ¦™ (GPT Index)
LlamaIndex (GPT Index) is a project that provides a central interface to connect your LLM's with external data.
PyPi:
- LlamaIndex: https://pypi.org/project/llama-index/.
- GPT Index (duplicate): https://pypi.org/project/gpt-index/.
Documentation: https://gpt-index.readthedocs.io/en/latest/.
Twitter: https://twitter.com/gpt_index.
Discord: https://discord.gg/dGcwcsnxhU.
LlamaHub (community library of data loaders): https://llamahub.ai
## πŸ’» Example Usage
```
pip install llama-index
```
Examples are in the `examples` folder. Indices are in the `indices` folder (see list of indices below).
To build a simple vector store index:
```python
import os
os.environ["OPENAI_API_KEY"] = 'YOUR_OPENAI_API_KEY'
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader('data').load_data()
index = GPTSimpleVectorIndex.from_documents(documents)
```
To save to and load from disk:
```python
# save to disk
index.save_to_disk('index.json')
# load from disk
index = GPTSimpleVectorIndex.load_from_disk('index.json')
```
To query:
```python
index.query("<question_text>?")
```