Owlynn is a full-stack AI assistant project featuring a Next.js frontend and FastAPI backend with RAG (Retrieval-Augmented Generation) capabilities. The system integrates multiple AI technologies including ChromaDB for vector storage, sentence transformers for embeddings, and LLM integration for intelligent conversations.
- API Framework: FastAPI with async/await support
- Vector Database: ChromaDB for document embeddings and similarity search
- Embeddings: HuggingFace Transformers with
intfloat/multilingual-e5-largemodel - LLM Integration: Configured for streaming responses with
Qwen3-14bmodel - Caching: Redis for performance optimization
- Database: PostgreSQL for persistent storage
- GPU Support: MPS (Metal Performance Shaders) acceleration on Apple Silicon
- Framework: Next.js with TypeScript
- UI Components: Modern React components
- Real-time Communication: Chat interface with streaming support
- Containerization: Docker Compose for service orchestration
- Services: Frontend, Backend, PostgreSQL, Redis, ChromaDB
- Development: Local development with hot-reload support
- Docker Compose setup for all services
- PostgreSQL database with initialization scripts
- Redis caching service
- ChromaDB vector database integration
- RAG search service with document processing
- Content processor with multiple NLP capabilities
- File processor supporting multiple formats (PDF, DOCX, TXT, etc.)
- MPS GPU acceleration for Apple Silicon
- Sentence transformers for multilingual embeddings
- Chat API with streaming support
- Frontend build system and Docker integration
- ChromaDB connection stabilization
- Backend service health checks
- LLM endpoint integration testing
- Frontend-backend API integration
- Docker and Docker Compose
- Python 3.11+ (for local backend development)
- Node.js 18+ (for local frontend development)
# Clone the repository
git clone <repository-url>
cd Owlynn
# Start all services
docker-compose up --build
# Services will be available at:
# Frontend: http://localhost:3000
# ChromaDB: http://localhost:8000
# PostgreSQL: localhost:5432
# Redis: localhost:6379cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the backend (on port 8001 to avoid ChromaDB conflict)
uvicorn main:app --reload --port 8001cd frontend
# Install dependencies
npm install
# Build the application
npm run build
# Start the frontend
npm startCreate a .env file in the backend directory:
OPENAI_API_KEY=your-openai-api-key-here
REDIS_URL=redis://localhost:6379
DATABASE_URL=postgresql://owlynn:owlynnpass@localhost:5432/owlynnThe system is configured to use ChromaDB with:
- REST API implementation
- Persistent storage in Docker volumes
- Multilingual embedding support
- Document collection management
GET /api/ping- Health checkPOST /api/chat- Chat with streaming supportPOST /api/rag/search- RAG search functionalityPOST /api/rag/upload- Document upload and processing
- Web search integration
- Document similarity search
- Content summarization
- Entity extraction
- Keyword extraction
- Multi-format file support
The system automatically detects and uses MPS (Metal Performance Shaders) on Apple Silicon Macs for faster model inference:
device = torch.device("mps" if torch.backends.mps.is_available() else "cpu")Key dependencies include:
fastapi,uvicornfor API frameworkchromadb[httpx]for vector databaselangchain-chroma,langchain-huggingfacefor RAGsentence-transformersfor embeddingstorchwith MPS supporttransformersfor AI models
- PostgreSQL: Database with custom initialization
- Redis: Caching and session management
- ChromaDB: Vector storage with REST API
- Frontend: Next.js application
- Backend: FastAPI application (run locally for development)
- Port Conflicts: ChromaDB uses port 8000, run backend on 8001
- ChromaDB Connection: Ensure Docker container is healthy
- GPU Memory: MPS acceleration requires sufficient GPU memory
- Dependencies: Use
pip install "chromadb[httpx]"with quotes
Check service status:
docker ps # View running containers
docker logs owlynn-chroma # Check ChromaDB logs
docker logs owlynn-postgres # Check database logs- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
[Add your license information here]
Owlynn/
├── backend/ # Backend application
│ ├── api/ # API endpoints and routes
│ │ ├── rag.py # RAG-specific endpoints
│ │ ├── conversation.py # Conversation endpoints
│ │ └── ...
│ ├── core/ # Core application components
│ │ ├── models/ # Data models
│ │ ├── schemas/ # Pydantic schemas
│ │ └── config/ # Configuration
│ ├── services/ # Business logic services
│ │ ├── rag/ # RAG-related services
│ │ │ ├── search.py # RAG search service
│ │ │ ├── processor.py # Content processor
│ │ │ └── cache.py # Cache service
│ │ ├── chat/ # Chat-related services
│ │ │ ├── conversation.py # Conversation service
│ │ │ ├── memory.py # Memory service
│ │ │ └── enhancer.py # Chat enhancer
│ │ ├── processing/ # Content processing services
│ │ │ ├── file.py # File processor
│ │ │ ├── image.py # Image processor
│ │ │ └── code.py # Code processor
│ │ └── search/ # Search-related services
│ │ ├── web.py # Web search service
│ │ └── history.py # Search history service
│ ├── db/ # Database related code
│ │ ├── migrations/ # Database migrations
│ │ └── models/ # Database models
│ ├── vectorstore/ # Vector store implementation
│ ├── utils/ # Utility functions
│ └── tests/ # Backend tests
├── frontend/ # Frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── services/ # Frontend services
│ │ └── utils/ # Frontend utilities
│ └── public/ # Static assets
├── docs/ # Documentation
│ ├── api/ # API documentation
│ ├── setup/ # Setup guides
│ └── architecture/ # Architecture docs
├── data/ # Data storage
│ ├── uploads/ # Uploaded files
│ └── chroma/ # ChromaDB data
├── scripts/ # Utility scripts
├── docker/ # Docker configuration
│ ├── backend/ # Backend Dockerfile
│ └── frontend/ # Frontend Dockerfile
├── docker-compose.yml # Docker compose configuration
├── requirements.txt # Python dependencies
└── README.md # Project documentation
This project is a FastAPI application that integrates with ChromaDB for data storage and retrieval. It also includes a frontend for user interaction.
- Clone the Repository: Clone the repository to your local machine.
- Install Dependencies: Navigate to the project directory and install the required dependencies using
pip install -r requirements.txt. - Run the Application: Use the command
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8001to start the FastAPI application.
- FastAPI
- Uvicorn
- ChromaDB
- Newspaper3k
- Other dependencies listed in
requirements.txt
- Backend: Start the FastAPI application using the command provided in the setup section.
- Frontend: Ensure the frontend is configured to communicate with the backend API.
- Use the Swagger UI at
http://localhost:8001/docsto test the API endpoints.