A Python application that records lab sessions, identifies speakers, and uses LLMs to generate structured lab books with multimodal support, lab cycle organization, and advanced analysis.
- Lab Cycle Organization: Group related lab sessions into cycles (e.g., "Wave Experiments")
- RAG Knowledge Base: Each lab cycle builds a knowledge base for improved context in future sessions
- Enhanced Speaker Diarization: Better distinguish between the primary user and external speakers
- External Comments Section: Lab partner or demonstrator comments are properly categorized
- Post-Processing Analysis: Get feedback and improvement suggestions from advanced LLMs
- Audio Recording: Captures lab sessions with automatic silence detection
- Speech Recognition: Transcribes audio using OpenAI's Whisper
- Speaker Diarization: Identifies different speakers in the recording
- Lab Book Generation: Creates structured lab books using a local LLM
- Multimodal Support: Analyzes graphs and images for inclusion in lab books
- Multiple Output Formats: Generates lab books in Markdown and/or DOCX format
-
Clone the repository:
git clone https://github.com/yourusername/labbook-generator.git cd labbook-generator -
Run the setup script:
chmod +x setup-v2.sh ./setup-v2.sh
-
(Optional) Set API keys for advanced post-processing:
export OPENAI_API_KEY=your_openai_key_here export ANTHROPIC_API_KEY=your_anthropic_key_here
-
(Optional) Set up speaker diarization with HuggingFace:
export HF_TOKEN=your_huggingface_token_here
Organize your lab sessions into cycles:
python main_updated.py --create-cycle waves --cycle-title "Wave Experiments" --cycle-desc "Lab experiments focusing on wave properties and interference"python main_updated.py --record --cycle-id wavesThis will start recording. Use the following commands during recording:
p- Pause recordingr- Resume recordings- Save current segment and start a new onel- Generate interim lab bookqorCtrl+C- End session and generate lab book
python main_updated.py --process path/to/audio_file.wav --cycle-id wavespython main_updated.py --cyclespython main_updated.py --sessions--output-format: Choose output format (markdown,docx, orboth)--model: Specify a custom LLM model path--whisper-model: Select Whisper model size (tinytolarge)--post-process: Enable analysis with advanced LLM APIs (default if API keys available)--no-post-process: Disable advanced LLM post-processing--api: Choose API provider for post-processing (openaioranthropic)
Example:
python main_updated.py --record --cycle-id waves --output-format markdown --whisper-model small --api anthropicThe RAG (Retrieval Augmented Generation) system automatically:
- Stores all lab book content in a knowledge base for each lab cycle
- Retrieves relevant context from previous lab sessions when generating new lab books
- Provides continuity and knowledge transfer between related sessions
The system now:
- Distinguishes between the primary user and external speakers
- Creates a separate "External Comments" section in the lab book
- Maintains profiles for known speakers for better identification
After generating a lab book, the system can:
- Send the content to OpenAI or Anthropic APIs for advanced analysis
- Receive feedback on strengths, weaknesses, and potential improvements
- Get suggestions for follow-up experiments or additional analyses
Edit config_updated.py to customize:
- Default lab cycle
- LLM parameters
- Speaker diarization settings
- RAG system configuration
- Post-processing options
- Speaker diarization accuracy depends on audio quality and speaker separation
- RAG context retrieval requires sufficient previous lab content
- Advanced post-processing requires API keys and internet access