A semantic search system that lets you query your documents using natural language. Built with Ollama, FAISS, and FastAPI.
- Document ingestion from
.txt
files - Vector-based semantic search using FAISS
- AI-powered responses with context from your documents
- FastAPI web service for easy integration
- Install Ollama from ollama.ai
- Pull required models:
ollama pull nomic-embed-text ollama pull llama3
-
Install dependencies:
pip install -r requirements.txt
-
Create docs folder and add your
.txt
files:mkdir docs # Add your .txt files to the docs/ folder
-
Start the server:
uvicorn main:app --reload
Server runs at
http://localhost:8000
-
Ingest documents:
curl -X POST "http://localhost:8000/ingest/"
-
Query documents:
curl -X POST "http://localhost:8000/query/" \ -H "Content-Type: application/json" \ -d '{"question": "Your question here"}'
-
Interactive API docs: Visit
http://localhost:8000/docs
-
Ingest documents:
python ingest.py
-
Query documents:
python query.py
Processes all .txt
files in the docs/
folder and creates vector embeddings.
Response:
{
"status": "success",
"message": "5 documents ingested and indexed"
}
Search documents and get AI-generated answers.
Request:
{
"question": "What are the main topics discussed?"
}
Response:
{
"question": "What are the main topics discussed?",
"answer": "Based on the documents, the main topics include..."
}
├── requirements.txt # Dependencies
├── ingest.py # Document processing
├── query.py # CLI interface
├── main.py # FastAPI service
├── docs/ # Your .txt files
├── vector.index # Generated FAISS index
└── metadata.json # Generated metadata