Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faisal-fida/seerat-e-nabi-model-with-llama-index
This project is a web application that uses a FastAPI backend to provide responses to questions about the Seerat-e-Nabi model using the Llama Index for vector storage and querying.
https://github.com/faisal-fida/seerat-e-nabi-model-with-llama-index
fastapi islamic-app llama-index querying vector-database webapp
Last synced: about 1 month ago
JSON representation
This project is a web application that uses a FastAPI backend to provide responses to questions about the Seerat-e-Nabi model using the Llama Index for vector storage and querying.
- Host: GitHub
- URL: https://github.com/faisal-fida/seerat-e-nabi-model-with-llama-index
- Owner: faisal-fida
- Created: 2023-12-07T19:48:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-06T08:23:13.000Z (3 months ago)
- Last Synced: 2024-11-10T21:16:27.504Z (about 1 month ago)
- Topics: fastapi, islamic-app, llama-index, querying, vector-database, webapp
- Language: Python
- Homepage:
- Size: 5.63 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Seerat-e-Nabi Model with Llama Index
This project is a web application that uses a FastAPI backend to provide responses to questions about the Seerat-e-Nabi model using the Llama Index for vector storage and querying.
## Features
- **FastAPI Integration**: A lightweight web framework to handle API requests.
- **Llama Index**: Utilizes Llama Index for storing and querying document vectors.
- **Dynamic Model Loading**: Automatically loads and persists the index, ensuring efficient querying.## File Structure
- `main.py`: Main application file using FastAPI to set up endpoints.
- `llama_model.py`: Script to load data, create an index, and query it using Llama Index.
- `clean.py`: Preprocesses raw data for creating a clean dataset suitable for indexing.## Key Components
### FastAPI Application (`main.py`)
- **Endpoints**:
- `GET /`: Simple health check returning "OK".
- `GET /response/{question}`: Accepts a question and returns the model's response.
- **Server Configuration**: Runs the server on `port 8000` with reload enabled.### Llama Model (`llama_model.py`)
- **Data Loading and Indexing**:
- Loads documents from a specified directory.
- Creates and persists a vector store index.
- **Query Handling**:
- Provides a function to query the index and fetch responses.### Data Preprocessing (`clean.py`)
- **Data Cleaning**:
- Removes non-alphanumeric characters and empty lines.
- Filters out lines with fewer than three words.
- **Save Clean Data**: Saves the preprocessed data to a new file.## Challenges and Solutions
- **Model Integration**: Ensuring seamless integration of the Llama Index with FastAPI required careful handling of data loading and indexing.
- **Data Preprocessing**: Cleaning and preparing the data to create a meaningful index involved multiple preprocessing steps.
- **Efficient Querying**: Implementing a system to efficiently query the index and provide responses demanded robust indexing and query handling mechanisms.## Getting Started
1. Clone the repository.
2. Install the required dependencies.
3. Run the FastAPI app.```bash
git clone https://github.com/faisal-fida/seerat-e-nabi-model-llama-index.git
cd seerat-e-nabi-model-llama-index
pip install -r requirements.txt
uvicorn main:app --reload
```## Conclusion
This project demonstrates the integration of FastAPI with Llama Index for creating a responsive web application capable of answering questions based on indexed data. It highlights the complexities of model integration, data preprocessing, and efficient querying.
Feel free to contribute or raise issues if you encounter any problems!