A scientific question answering system built with SynaLinks, leveraging language models to provide accurate scientific answers with citations.
- Scientific question answering with domain-specific knowledge
- Citation and reference tracking for answers
- API for integration with other applications
- Customizable examples for improved responses
- Docker support for easy deployment
- Responsive GUI for desktop, tablet, and mobile devices
- Python 3.10+
- Docker and Docker Compose (for containerized deployment)
- OpenAI API key
-
Clone the repository
git clone https://github.com/jmanhype/synaflow.git cd synaflow -
Install dependencies
pip install -r requirements.txt -
Set up environment variables
cp .env.example .env # Edit .env with your API keys
-
Train the model (optional, use pre-trained model if available)
python main.py --train -
Run the interactive demo
python examples/simplified_demo.py -
Start the API server with GUI
python api/app.pyThen open your browser and navigate to
http://localhost:8000 -
Or start the API server without GUI (legacy)
python api/app_direct.py
-
Build and start the containers
docker-compose up -d -
Check the API is running
curl http://localhost:8000/health
The SynaFlow application now includes a responsive GUI that works on desktop, tablet, and mobile devices:
-
Ask Questions: Enter your scientific question, optionally select a domain, and provide additional context if needed.
-
View Structured Answers: Receive comprehensive answers with background information, reasoning, confidence level, citations, and further reading recommendations.
-
Question History: Access your previous questions and answers from the sidebar.
-
Mobile-Friendly: The interface adapts to different screen sizes for a seamless experience on any device.
POST /query
{
"question": "What is quantum entanglement?",
"domain": "physics",
"context": "I'm a university student"
}
Response:
{
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2023-11-18T12:34:56.789Z",
"result": {
"background": "Quantum entanglement is a fundamental concept in quantum physics...",
"reasoning": "When we consider the mathematical framework of quantum mechanics...",
"answer": "Quantum entanglement occurs when pairs or groups of particles interact...",
"confidence": 0.95,
"citations": [
{
"title": "Quantum entanglement and information",
"authors": ["Einstein, A.", "Podolsky, B.", "Rosen, N."],
"year": 1935,
"source": "Physical Review",
"url": "https://example.com/paper"
}
],
"further_reading": [
"Quantum Computation and Quantum Information by Nielsen and Chuang"
]
}
}synaflow/
├── api/ # API implementation
│ ├── app.py # FastAPI application with GUI
│ └── app_direct.py # FastAPI application (legacy)
├── examples/ # Example scripts and demos
│ ├── simplified_demo.py
│ ├── comparison_test.py
│ └── interactive_demo.py
├── models/ # Trained models
│ └── trained_qa_program.json
├── src/ # Source code
│ ├── config.py # Configuration settings
│ ├── data_models.py # Data models and schemas
│ ├── language_models.py # LLM integration
│ ├── programs.py # Program implementations
│ ├── simplified_program.py # Simplified implementation
│ ├── training.py # Training utilities
│ └── utils.py # Utility functions
├── static/ # Static files for GUI
│ ├── css/ # CSS stylesheets
│ ├── js/ # JavaScript files
│ └── index.html # Main HTML file
├── tests/ # Test suite
├── documentation.md # Detailed documentation
├── .env.example # Example environment variables
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker build configuration
├── main.py # Main entry point
└── requirements.txt # Python dependencies
This project is licensed under the MIT License - see the LICENSE file for details.
- SynaLinks for the underlying framework