A FastAPI-based backend service for the VCell AI platform. This service provides RESTful APIs for biomodel retrieval, AI-powered analysis, knowledge base management, and vector database operations.
The backend follows a clean architecture pattern with the following structure:
backend/
├── app/
│ ├── main.py # FastAPI application entry point
│ ├── core/ # Core configurations and utilities
│ │ ├── config.py # Application settings
│ │ └── logger.py # Logging configuration
│ ├── routes/ # API route definitions
│ │ ├── vcelldb_router.py # VCellDB API wrapper routes
│ │ ├── llms_router.py # LLM and AI analysis routes
│ │ ├── knowledge_base_router.py # Knowledge base management
│ │ └── qdrant_router.py # Vector database operations
│ ├── controllers/ # Business logic layer
│ ├── services/ # External service integrations
│ ├── schemas/ # Pydantic data models
│ └── utils/ # Utility functions
├── tests/ # Test suite
├── pyproject.toml # Project configuration
└── Dockerfile # Container configuration
- VCellDB Integration: Wrapper for VCell biomodel database API
- AI-Powered Analysis: LLM integration with tool calling capabilities
- Knowledge Base: Vector-based document storage and retrieval
- File Processing: Support for PDF, text, and markdown files
- RESTful APIs: Comprehensive API endpoints with automatic documentation
GET /biomodel- Retrieve biomodels with filtering and sortingGET /biomodel/{id}/simulations- Get simulations for a biomodelGET /biomodel/{id}/biomodel.vcml- Retrieve VCML file contentGET /biomodel/{id}/biomodel.sbml- Retrieve SBML file contentGET /biomodel/{id}/diagram- Get diagram URLGET /biomodel/{id}/diagram/image- Get diagram imageGET /biomodel/{id}/applications/files- Get application files
POST /query- General LLM query with tool callingPOST /analyse/{biomodel_id}- Analyze specific biomodelPOST /analyse/{biomodel_id}/vcml- Analyze VCML contentPOST /analyse/{biomodel_id}/diagram- Analyze diagram
POST /create-collection- Create knowledge base collectionGET /files- List all files in knowledge basePOST /upload-pdf- Upload PDF filePOST /upload-text- Upload text fileDELETE /files/{file_name}- Delete fileGET /similar- Find similar documentsGET /files/{file_name}/chunks- Get file chunks
- Direct vector database operations for advanced use cases
- Framework: FastAPI 0.115+
- Language: Python 3.12+
- Dependency Management: uv
- Database: Qdrant Vector Database
- AI/ML: OpenAI API, LangChain
- File Processing: PyPDF, Markitdown
- Testing: Pytest with async support
- Documentation: Auto-generated OpenAPI/Swagger docs
- Python 3.12+
- uv
- Docker (for Qdrant)
-
Clone and navigate to backend
cd backend -
Install dependencies
uv sync
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration -
Start the development server
uv run uvicorn app.main:app --reload
-
Build the container
docker build -t vcell-backend . -
Run with Docker Compose
docker-compose up backend
Once the server is running, you can access:
- Interactive API Docs: http://localhost:8000/docs
- OpenAPI Schema: http://localhost:8000/openapi.json
The application uses structured logging with different levels:
- DEBUG: Detailed debugging information
- INFO: General application information
- WARNING: Warning messages
- ERROR: Error messages
- CRITICAL: Critical errors
Logs are configured in
app/core/logger.pyand can be customized via environment variables.