Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,24 +1,97 @@
|
|
| 1 |
-
|
| 2 |
-
title: LlamaIndex Cloud Chat
|
| 3 |
-
emoji: π¬
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
# LlamaIndex Cloud Chat
|
| 11 |
-
|
| 12 |
-
This Space hosts a simple Streamlit interface that connects to a LlamaIndex Cloud pipeline
|
| 13 |
-
so you can chat with your indexed documents.
|
| 14 |
-
|
| 15 |
-
## How it works
|
| 16 |
-
- **Streamlit** runs inside the container to provide the UI.
|
| 17 |
-
- **LlamaIndex Cloud API** is called using your secrets (`LLAMA_CLOUD_API_KEY`, `PIPELINE_ID`).
|
| 18 |
-
|
| 19 |
-
## Setup notes
|
| 20 |
-
- Secrets are set in **Settings β Secrets**.
|
| 21 |
-
- The app itself is in `app.py`.
|
| 22 |
-
- Dependencies are listed in `requirements.txt`.
|
| 23 |
-
- The container is built from `Dockerfile`.
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Chat with Your Documents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
A Gradio-based web interface that connects to your LlamaCloud index, allowing users to chat with their documents using natural language.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
- π **Semantic Search**: Powered by your LlamaCloud index
|
| 8 |
+
- π¬ **Chat Interface**: Natural conversation with your documents
|
| 9 |
+
- π **Source Attribution**: Shows which documents answers come from
|
| 10 |
+
- π¨ **Clean UI**: Professional Gradio interface
|
| 11 |
+
- βοΈ **Cloud Ready**: Deployed on Hugging Face Spaces
|
| 12 |
+
|
| 13 |
+
## Setup Instructions
|
| 14 |
+
|
| 15 |
+
### 1. Get Your LlamaCloud Information
|
| 16 |
+
|
| 17 |
+
From your LlamaCloud dashboard:
|
| 18 |
+
- Copy your API key
|
| 19 |
+
- Copy your index/pipeline ID (from the URL or dashboard)
|
| 20 |
+
|
| 21 |
+
### 2. Configure Environment Variables
|
| 22 |
+
|
| 23 |
+
In your Hugging Face Space, go to Settings β Variables and Secrets, and add:
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
LLAMA_CLOUD_API_KEY=your_api_key_here
|
| 27 |
+
LLAMA_CLOUD_INDEX_ID=your_index_id_here
|
| 28 |
+
OPENAI_API_KEY=your_openai_key_here
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### 3. Deploy to Hugging Face Spaces
|
| 32 |
+
|
| 33 |
+
1. Create a new Space with **Docker SDK**
|
| 34 |
+
2. Upload all the files from this repository
|
| 35 |
+
3. The Space will automatically build and deploy
|
| 36 |
+
|
| 37 |
+
### 4. Local Development (Optional)
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
# Clone the repository
|
| 41 |
+
git clone <your-repo>
|
| 42 |
+
cd <your-repo>
|
| 43 |
+
|
| 44 |
+
# Install dependencies
|
| 45 |
+
pip install -r requirements.txt
|
| 46 |
+
|
| 47 |
+
# Copy environment variables
|
| 48 |
+
cp .env.example .env
|
| 49 |
+
# Edit .env with your actual keys
|
| 50 |
+
|
| 51 |
+
# Run locally
|
| 52 |
+
python app.py
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Usage
|
| 56 |
+
|
| 57 |
+
1. Open the deployed Hugging Face Space
|
| 58 |
+
2. Type questions about your documents in natural language
|
| 59 |
+
3. Get AI-powered answers with source attribution
|
| 60 |
+
4. Use example questions to get started
|
| 61 |
+
|
| 62 |
+
## Example Questions
|
| 63 |
+
|
| 64 |
+
- "What are the main topics covered in the documents?"
|
| 65 |
+
- "Summarize the key findings"
|
| 66 |
+
- "What does the document say about [specific topic]?"
|
| 67 |
+
- "Can you provide details about the methodology?"
|
| 68 |
+
|
| 69 |
+
## Troubleshooting
|
| 70 |
+
|
| 71 |
+
### Common Issues
|
| 72 |
+
|
| 73 |
+
1. **"Could not connect to document index"**
|
| 74 |
+
- Check your `LLAMA_CLOUD_API_KEY` and `LLAMA_CLOUD_INDEX_ID`
|
| 75 |
+
- Ensure your LlamaCloud index is active and accessible
|
| 76 |
+
|
| 77 |
+
2. **OpenAI API errors**
|
| 78 |
+
- Verify your `OPENAI_API_KEY` is valid and has credits
|
| 79 |
+
- Check if you have access to GPT-5
|
| 80 |
+
|
| 81 |
+
3. **Build failures**
|
| 82 |
+
- Check that all files are uploaded correctly
|
| 83 |
+
- Verify requirements.txt has correct versions
|
| 84 |
+
|
| 85 |
+
### Getting Help
|
| 86 |
+
|
| 87 |
+
- Check Hugging Face Spaces logs for detailed error messages
|
| 88 |
+
- Ensure your LlamaCloud index is working in the playground first
|
| 89 |
+
- Verify all environment variables are set correctly
|
| 90 |
+
|
| 91 |
+
## Architecture
|
| 92 |
+
|
| 93 |
+
```
|
| 94 |
+
User Question β Gradio Interface β LlamaIndex β LlamaCloud Index β OpenAI LLM β Response with Sources
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
The app connects to your existing LlamaCloud index and uses OpenAI's GPT-5 for generating responses based on retrieved document chunks.
|