A production-grade semantic search microservice for healthcare diagnostics data, powered by FastAPI, OpenAI embeddings, and Pinecone vector database.
- Semantic search for lab tests and diagnostics data
- Real-time filtering by location, price, and rating
- Redis caching for high-performance queries
- Fully async API endpoints with FastAPI
- Production-ready with monitoring, logging, and security
- Framework: FastAPI + Pydantic
- Databases: MySQL, Redis, Pinecone Vector DB
- ML/AI: OpenAI Embeddings API
- Infrastructure: Docker, Terraform
- Monitoring: Prometheus + Grafana
- Testing: Pytest
ai-search-service/
├── app/
│ ├── api/ # API routes and endpoints
│ ├── core/ # Core functionality, config
│ ├── db/ # Database models and connections
│ ├── models/ # Pydantic models/schemas
│ ├── services/ # Business logic
│ └── utils/ # Utility functions
├── tests/ # Test suite
├── scripts/ # Utility scripts
└── infrastructure/ # IaC and deployment configs
-
Clone the repository:
git clone https://github.com/labbuddy/ai-search-service.git cd ai-search-service -
Set up virtual environment:
python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate pip install -r requirements.txt
-
Configure environment:
cp .env.example .env # Edit .env with your configuration -
Start the development server:
uvicorn app.main:app --reload
-
Visit the API documentation:
http://localhost:8000/docs
pytestflake8 app tests
mypy appalembic upgrade headGET /api/v1/search
Query Parameters:
q(string): Search querylocation(string, optional): Filter by locationmin_price(float, optional): Minimum pricemax_price(float, optional): Maximum pricemin_rating(float, optional): Minimum ratingpage(int, optional): Page numberpage_size(int, optional): Results per page
- Prometheus metrics available at
/metrics - Grafana dashboards for monitoring system health
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
Copyright © 2024 LabBuddy. All rights reserved.