This project demonstrates a routing agent setup using LlamaIndex, Groq's LLaMA3-70B model, and HuggingFace Embeddings for answering queries from multiple domain-specific documents.
- ✅ Uses
Groq
to access LLaMA 3-70B via LlamaIndex - ✅ HuggingFace
bge-small-en-v1.5
model for text embeddings - ✅ Indexes and queries PDF documents (
AeroFlow
andEcoSprint
) - ✅ Routes questions automatically to the correct index using
RouterQueryEngine
- ✅ Built in Google Colab with interactive Q&A support
├── AeroFlow_Specification_Document.pdf
├── EcoSprint_Specification_Document.pdf
├── routing_agent_llamaindex.ipynb
├── README.md
└── LICENSE.txt
- Python ≥ 3.8
llama-index
nest_asyncio
huggingface_hub
groq
API Key- Google Colab or local Jupyter environment
-
Upload PDF documents: Place AeroFlow_Specification_Document.pdf and EcoSprint_Specification_Document.pdf in the working directory or Colab file manager.
-
Set up API Keys:
from google.colab import userdata
Settings.llm = Groq(model="llama3-70b-8192", api_key=userdata.get('GROQ_API_KEY'))
- Configure Embedding & LLM:
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
- Create Document Indexes:
-
Read, chunk, and index each document (AeroFlow and EcoSprint)
-
Create individual query engines
- Route Queries Using Router Agent:
-
Automatically select the appropriate document source using RouterQueryEngine
-
Example queries:
response = router_agent.query("What colors are available for AeroFlow?")
print(response)
response = router_agent.query("What colors are available for EcoSprint?")
print(response)
-
LlamaIndex
-
Groq (LLaMA3-70B)
-
HuggingFace Transformers
-
Google Colab
-
Python
🔍 Ask: "What colors are available for AeroFlow?" ✅ The agent routes the query to the AeroFlow specification index and provides a relevant, grounded answer.
This project is licensed under the MIT License - see the LICENSE file for details.