Skip to content

BM Librarian

BM Librarian is a sophisticated Python system for AI-powered biomedical literature research. It combines multiple specialized AI agents with robust database infrastructure to convert research questions into comprehensive, evidence-based medical reports with proper citations.

What is BM Librarian?

BM Librarian provides an intelligent platform for biomedical research that goes far beyond traditional literature search:

  • Multi-Agent AI Architecture: Specialized agents work together to query, score, cite, and synthesize biomedical literature
  • Comprehensive Database: Indexed PubMed abstracts, MedRxiv publications, and open access full texts with semantic search capabilities
  • Evidence-Based Reports: Generates publication-style reports with validated citations, preventing AI hallucination
  • Counterfactual Analysis: Identifies and integrates contradictory evidence for balanced conclusions

Key Features

Fact Checker System

Evaluates biomedical statements as yes/no/maybe based on literature evidence. Includes both CLI and desktop GUI with blind mode for unbiased human annotation.

PaperChecker System

Validates research abstracts through multi-strategy searches (semantic, HyDE, keyword) and generates counter-reports with evidence-based verdicts.

Multi-Agent Architecture

Agent Role
QueryAgent Converts natural language to database queries
DocumentScoringAgent Rates document relevance (1-5 scale)
CitationFinderAgent Extracts relevant passages from documents
ReportingAgent Synthesizes citations into publication-style reports
CounterfactualAgent Identifies contradictory evidence
EditorAgent Creates balanced reports integrating all evidence
FactCheckerAgent Evaluates biomedical statements with literature evidence
PaperCheckerAgent Validates abstract claims against contradictory literature

Advanced Analytics

  • Multi-model query generation using up to 3 AI models simultaneously for 20-40% improved document retrieval
  • Query performance tracking showing which models find most relevant documents
  • Counterfactual analysis with progressive audit trails
  • Citation validation preventing AI fabrication

Infrastructure

  • PostgreSQL with pgvector for semantic search
  • SQLite-based task queue for memory-efficient processing
  • Automated database migrations at startup
  • PostgreSQL audit trail tracking complete research sessions
  • Local LLM integration via Ollama

Getting Started

Requirements

  • Python 3.12+
  • PostgreSQL 12+ with pgvector extension
  • Ollama service for local LLM

Installation

git clone https://github.com/hherb/bmlibrarian
cd bmlibrarian
uv sync

Usage

Research CLI:

uv run python bmlibrarian_cli.py

GUI Research Application:

uv run python bmlibrarian_research_gui.py

Fact-Checker CLI:

uv run python fact_checker_cli.py input.json -o results.json

Fact-Checker Review GUI:

uv run python fact_checker_review_gui.py --input-file results.db --blind

Configuration GUI:

uv run python bmlibrarian_qt.py


BM Librarian Lite & Medical Fact Checker

BM Librarian Lite is the lightweight companion to BM Librarian, designed for medical fact-checking without requiring local database installations or running local models.

The mobile and desktop apps are branded as Medical Fact Checker (MFC) to reflect their primary focus: answering medical questions and verifying health claims using the biomedical literature. Unlike the full BM Librarian system, MFC is not designed for comprehensive systematic literature reviews - mobile hardware constraints and the lack of large-volume local databases with powerful semantic search make this impractical on phones and tablets.

Key Differences from BM Librarian

Feature BM Librarian BM Librarian Lite / MFC
Database PostgreSQL + pgvector SQLite + sqlite-vec
LLM Local via Ollama Cloud APIs (Claude, OpenAI, etc.)
Search Local indexed database Direct PubMed/Europe PMC queries
Use Case Systematic reviews, research Quick fact-checking, Q&A
Platform Desktop (requires setup) Mobile apps + lightweight desktop

Cross-Platform Python App (BM Librarian Lite)

The desktop application runs on Windows, macOS, and Linux, built with PySide6 for a native look and feel.

BM Librarian Lite Desktop Application

Features:

  • Systematic literature review workflows with PubMed searching
  • Document scoring and citation extraction
  • Multi-model benchmarking to compare LLM performance
  • Quality assessment with evidence grading
  • Audit trail showing LLM reasoning
  • No PostgreSQL required - uses SQLite with sqlite-vec for vector search

Installation:

pip install bmlibrarian-lite

Medical Fact Checker for iOS

The iOS app brings medical fact-checking to iPhone and iPad with a native SwiftUI interface.

MedicalFactChecker on iPhone

MedicalFactChecker on iPad

Features:

  • Search over 36 million PubMed articles
  • Dual scoring system combining LLM analysis with on-device Apple NLEmbedding
  • Hypothetical Document Embedding (HyDE) for improved search relevance
  • Multiple AI providers: Claude, OpenAI, DeepSeek, Groq, Mistral, or local Ollama
  • Budget controls with per-analysis and monthly spending limits
  • iCloud sync across devices
  • PDF export with full citations
  • Secure API key storage in Keychain

Availability: Available now on the App Store

Requirements: iOS 17.0+ or iPadOS 17.0+

Medical Fact Checker for macOS

The macOS version provides a native desktop experience optimized for keyboard-driven workflows.

MedicalFactChecker on macOS

Features:

  • Native macOS interface with keyboard navigation
  • Full-text article viewing with JATS XML rendering
  • Hybrid search across PubMed and Europe PMC
  • AppKit-based PDF generation
  • iCloud synchronization with iOS version
  • Optimized for Apple Silicon

Availability: Awaiting App Store approval

Requirements: macOS 14.0+ with Apple Silicon (M1 or later)

Medical Fact Checker for Android

The Android app brings the same fact-checking capabilities to Android devices with Material Design 3.

MedicalFactChecker on Android

Features:

  • Material 3 design following Google guidelines
  • Medical fact-checking workflow
  • Room database for local persistence
  • Multiple search provider support (PubMed, Europe PMC)
  • Secure API key storage via EncryptedSharedPreferences
  • Support for Claude, OpenAI, DeepSeek, Groq, and Mistral

Availability: Submission to Google Play Store coming soon


Stay Updated

Check out our Blog for the latest development updates, release announcements, and tutorials.

Open Source

BM Librarian is free software released under the GNU General Public License v3.0. Visit our GitHub repository to contribute.

BM Librarian Lite is also open source - visit the bmlibrarian_lite repository for the Python desktop application and mobile app source code.