Spaces:
Sleeping
Sleeping
Ralitza Mondal commited on
Commit ·
04ca737
1
Parent(s): e4d2119
Document FAISS as optional with upload instructions
Browse files- .gitignore +0 -1
- FAISS_SETUP.md +70 -0
- README.md +5 -1
.gitignore
CHANGED
|
@@ -51,4 +51,3 @@ htmlcov/
|
|
| 51 |
# Temporary files
|
| 52 |
*.tmp
|
| 53 |
*.bak
|
| 54 |
-
knowledge_base/faiss_index/*.faiss
|
|
|
|
| 51 |
# Temporary files
|
| 52 |
*.tmp
|
| 53 |
*.bak
|
|
|
FAISS_SETUP.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FAISS Knowledge Base Setup for Hugging Face Space
|
| 2 |
+
|
| 3 |
+
## Why FAISS Files Can't Be in Git
|
| 4 |
+
|
| 5 |
+
The FAISS index file (`index.faiss`, ~200KB) is a binary file that cannot be pushed via git to Hugging Face Spaces without Git LFS. Since Git LFS setup requires additional configuration, we provide alternative methods.
|
| 6 |
+
|
| 7 |
+
## Option 1: Upload via Hugging Face Web Interface (Recommended)
|
| 8 |
+
|
| 9 |
+
1. Go to your Space: https://huggingface.co/spaces/Ralitza1/LolMultiAgent/tree/main
|
| 10 |
+
2. Click "Files and versions"
|
| 11 |
+
3. Click "+ Add file" > "Upload files"
|
| 12 |
+
4. Navigate to and upload:
|
| 13 |
+
- `knowledge_base/faiss_index/index.faiss` (202KB)
|
| 14 |
+
- `knowledge_base/faiss_index/index.pkl` (already uploaded)
|
| 15 |
+
5. Commit the changes
|
| 16 |
+
6. The Space will automatically rebuild
|
| 17 |
+
|
| 18 |
+
## Option 2: Upload via Python API
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from huggingface_hub import HfApi
|
| 22 |
+
|
| 23 |
+
# Your HF token (keep this secret!)
|
| 24 |
+
token = "YOUR_HUGGINGFACE_TOKEN"
|
| 25 |
+
|
| 26 |
+
# Initialize API
|
| 27 |
+
api = HfApi()
|
| 28 |
+
|
| 29 |
+
# Upload FAISS file
|
| 30 |
+
api.upload_file(
|
| 31 |
+
path_or_fileobj="./knowledge_base/faiss_index/index.faiss",
|
| 32 |
+
path_in_repo="knowledge_base/faiss_index/index.faiss",
|
| 33 |
+
repo_id="Ralitza1/LolMultiAgent",
|
| 34 |
+
repo_type="space",
|
| 35 |
+
token=token
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
print("✅ FAISS file uploaded successfully!")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Option 3: Use Without FAISS
|
| 42 |
+
|
| 43 |
+
The system is designed to work without FAISS. If the FAISS knowledge base is not available:
|
| 44 |
+
- The Knowledge Base Agent will still work using Tavily web search
|
| 45 |
+
- You'll see a warning: "⚠️ FAISS knowledge base not available"
|
| 46 |
+
- All other agents (Build Advisor, Match Analyzer, etc.) will function normally
|
| 47 |
+
|
| 48 |
+
## Verify FAISS is Working
|
| 49 |
+
|
| 50 |
+
After uploading, check the Space logs for:
|
| 51 |
+
```
|
| 52 |
+
✅ FAISS knowledge base loaded successfully
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
If you see this error:
|
| 56 |
+
```
|
| 57 |
+
❌ Error loading FAISS knowledge base: Error: 'f' failed: could not open knowledge_base/faiss_index/index.faiss
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Then the file needs to be uploaded using one of the methods above.
|
| 61 |
+
|
| 62 |
+
## What is FAISS?
|
| 63 |
+
|
| 64 |
+
FAISS (Facebook AI Similarity Search) is a vector database containing League of Legends knowledge:
|
| 65 |
+
- Champion abilities and stats
|
| 66 |
+
- Game mechanics
|
| 67 |
+
- Meta information
|
| 68 |
+
- Strategy tips
|
| 69 |
+
|
| 70 |
+
It enables the Knowledge Base Agent to answer LoL-specific questions without making external API calls.
|
README.md
CHANGED
|
@@ -54,6 +54,10 @@ Simply type your questions in the chat interface:
|
|
| 54 |
- **LangChain/LangGraph** - Multi-agent framework
|
| 55 |
- **OpenAI GPT-4** - Language model
|
| 56 |
- **Gradio 6.2.0** - Web interface
|
| 57 |
-
- **FAISS** - Vector database
|
| 58 |
- **Riot API** - Live game data
|
| 59 |
- **Tavily** - Real-time web search
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
- **LangChain/LangGraph** - Multi-agent framework
|
| 55 |
- **OpenAI GPT-4** - Language model
|
| 56 |
- **Gradio 6.2.0** - Web interface
|
| 57 |
+
- **FAISS** - Vector database (optional, see FAISS_SETUP.md)
|
| 58 |
- **Riot API** - Live game data
|
| 59 |
- **Tavily** - Real-time web search
|
| 60 |
+
|
| 61 |
+
## Note: FAISS Knowledge Base
|
| 62 |
+
|
| 63 |
+
The FAISS knowledge base is **optional** and provides enhanced LoL knowledge retrieval. If not available, the system will work perfectly using Tavily web search instead. See [FAISS_SETUP.md](./FAISS_SETUP.md) for upload instructions if you want to enable it.
|