https://github.com/bjornmelin/docmind-ai
DocMind AI is a powerful, open-source Streamlit application leveraging LangChain and local Large Language Models (LLMs) via Ollama for advanced document analysis. Analyze, summarize, and extract insights from a wide array of file formatsโsecurely and privately, all offline.
https://github.com/bjornmelin/docmind-ai
ai ai-applications docker document-analysis generative-ai langchain llm local-ai machine-learning natural-language-processing ollama privacy-first pydantic python streamlit text-analysis
Last synced: 7 months ago
JSON representation
DocMind AI is a powerful, open-source Streamlit application leveraging LangChain and local Large Language Models (LLMs) via Ollama for advanced document analysis. Analyze, summarize, and extract insights from a wide array of file formatsโsecurely and privately, all offline.
- Host: GitHub
- URL: https://github.com/bjornmelin/docmind-ai
- Owner: BjornMelin
- License: mit
- Created: 2025-01-21T02:20:37.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-21T03:08:50.000Z (9 months ago)
- Last Synced: 2025-01-21T03:26:22.813Z (9 months ago)
- Topics: ai, ai-applications, docker, document-analysis, generative-ai, langchain, llm, local-ai, machine-learning, natural-language-processing, ollama, privacy-first, pydantic, python, streamlit, text-analysis
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ๐ง DocMind AI: Local LLM for AI-Powered Document Analysis




[](https://choosealicense.com/licenses/mit/)
[](https://github.com/BjornMelin)
[](https://www.linkedin.com/in/bjorn-melin/)**DocMind AI** is a powerful, open-source Streamlit application that leverages the capabilities of Large Language Models (LLMs) running locally on your machine through [Ollama](https://ollama.com/). Analyze a vast array of document types, extract key insights, generate summaries, identify action items, and surface open questions โ all without sending your data to the cloud!
## โจ Features of DocMind AI
- **Privacy-Focused:** Your documents are processed locally, ensuring data privacy and security.
- **Versatile Document Handling:** Supports a wide range of file formats:
- ๐ PDF
- ๐ DOCX
- ๐ TXT
- ๐ XLSX
- ๐ MD (Markdown)
- ๐๏ธ JSON
- ๐๏ธ XML
- ๐ค RTF
- ๐ CSV
- ๐ง MSG (Email)
- ๐ฅ๏ธ PPTX (PowerPoint)
- ๐ ODT (OpenDocument Text)
- ๐ EPUB (E-book)
- ๐ป Code files (PY, JS, JAVA, TS, TSX, C, CPP, H, and more!)
- **Powerful AI Analysis:** Uses the power of LangChain to provide in-depth analysis.
- **Structured Output:** Get results in a well-defined format using Pydantic.
- **Customizable Prompts:** Tailor the analysis to your specific needs with pre-defined or custom prompts.
- **Tone and Instruction Control:** Fine-tune the LLM's responses by selecting the desired tone (e.g., professional, informal, academic) and specific instructions (e.g., act as a researcher, software engineer, business analyst).
- **Length/Detail Selection:** Control the length and level of detail of the generated responses (e.g., concise, detailed, comprehensive).
- **Flexible Analysis Modes:** Choose to analyze each document individually or combine them for a holistic analysis.
- **Interactive Chat:** Continue the conversation with the LLM to explore the documents further.
- **Docker Support:** Easily deploy the application using Docker or Docker Compose.## ๐ Table of Contents
1. [Features of DocMind AI](#-features-of-docmind-ai)
2. [Getting Started with DocMind AI: Local LLM Analysis](#-getting-started-with-docmind-ai-local-llm-analysis)
- [Prerequisites](#-prerequisites)
- [Installation](#๏ธ-installation)
- [Running the App](#๏ธ-running-the-app)
3. [Usage](#-usage)
- [Selecting a Model](#๏ธ-selecting-a-model)
- [Uploading Documents](#-uploading-documents)
- [Choosing Prompts](#๏ธ-choosing-prompts)
- [Selecting Tone](#-selecting-tone)
- [Selecting Instructions](#-selecting-instructions)
- [Setting Length/Detail](#-setting-lengthdetail)
- [Choosing Analysis Mode](#๏ธ-choosing-analysis-mode)
- [Analyzing Documents](#-analyzing-documents)
- [Interacting with the LLM](#-interacting-with-the-llm)
4. [Architecture](#๏ธ-architecture)
5. [How to Cite](#-how-to-cite)
6. [Contributing](#-contributing)
7. [License](#-license)## ๐ Getting Started with DocMind AI: Local LLM Analysis
### ๐ Prerequisites
- [Ollama](https://ollama.com/) installed and running.
- Python 3.8 or higher.
- (Optional) Docker and Docker Compose for containerized deployment.### โ๏ธ Installation
1. **Clone the repository:**
```bash
git clone https://github.com/BjornMelin/docmind-ai.git
cd docmind-ai
```2. **Install dependencies:**
```bash
pip install -r requirements.txt
```### โถ๏ธ Running the App
**Locally:**
```bash
streamlit run app.py
```**With Docker:**
```bash
docker-compose up --build
```The app will be accessible at `http://localhost:8501`.
## ๐ป Usage
### ๐๏ธ Selecting a Model
1. Enter the **Ollama Base URL** (default: `http://localhost:11434`).
2. Choose your desired **Ollama Model Name** (e.g., `llama2`) from the dropdown.### ๐ Uploading Documents
Click the **"Browse files"** button to upload one or more documents. Supported file types are listed above in the [Features](#-features) section.
### โ๏ธ Choosing Prompts
Select a pre-defined prompt from the dropdown:
- **Comprehensive Document Analysis:** Get a summary, key insights, action items, and open questions.
- **Extract Key Insights and Action Items:** Focus on extracting these two elements.
- **Summarize and Identify Open Questions:** Generate a summary and a list of open questions.
- **Custom Prompt:** Enter your own prompt to guide the analysis.### ๐ Selecting Tone
Choose the desired tone for the LLM's response:
- **Professional:** Objective and formal.
- **Academic:** Scholarly and research-oriented.
- **Informal:** Casual and conversational.
- **Creative:** Imaginative and artistic.
- **Neutral:** Unbiased and objective.
- **Direct:** Concise and to-the-point.
- **Empathetic:** Understanding and compassionate.
- **Humorous:** Witty and lighthearted.
- **Authoritative:** Confident and expert.
- **Inquisitive:** Curious and exploratory.### ๐งฎ Selecting Instructions
Select the persona or instructions that the LLM should follow:
- **General Assistant:** Act as a helpful assistant.
- **Researcher:** Provide in-depth research and analysis.
- **Software Engineer:** Focus on technical details and code.
- **Product Manager:** Consider product strategy and user experience.
- **Data Scientist:** Emphasize data analysis and modeling.
- **Business Analyst:** Analyze from a business and strategic perspective.
- **Technical Writer:** Create clear and concise documentation.
- **Marketing Specialist:** Focus on branding and customer engagement.
- **HR Manager:** Consider human resources aspects.
- **Legal Advisor:** Provide information from a legal standpoint.
- **Custom Instructions:** Enter your own specific instructions.### ๐ Setting Length/Detail
Choose the desired length and level of detail for the LLM's response:
- **Concise:** Brief and to-the-point.
- **Detailed:** Thorough and comprehensive.
- **Comprehensive:** Extensive and in-depth.
- **Bullet Points:** Provide response in bullet point format.### ๐๏ธ Choosing Analysis Mode
Select the analysis mode:
- **Analyze each document separately:** Process and analyze each document individually.
- **Combine analysis for all documents:** Treat all uploaded documents as a single unit for analysis.### ๐ง Analyzing Documents
1. Upload your documents.
2. Choose your analysis prompt, tone, instructions, desired length, and analysis mode.
3. Click the **"Extract and Analyze"** button.The application will display the analysis results, attempting to format them according to the defined output schema. If parsing fails, the raw LLM output will be shown.
### ๐ฌ Interacting with the LLM
Use the chat interface to ask follow-up questions about the analyzed documents. The LLM will use the extracted information as context for its responses.
## ๐๏ธ Architecture
Here's a Mermaid diagram illustrating the application's architecture:
```mermaid
graph TD
A[User] -->|Uploads Documents| B(Streamlit App - app.py);
B -->|Selects Model, Prompt, Tone, Instructions, Length, Mode| C{Ollama API};
C -->|Processes Documents| D[LangChain];
D -->|Loads Documents| E{Document Loaders};
E -->|PDF| F[PyPDFLoader];
E -->|DOCX| G[Docx2Loader];
E -->|TXT, Code| H[TextLoader];
E -->|...| I;
D -->|Splits Text| J[RecursiveCharacterTextSplitter];
D -->|Generates Analysis| K[LLM - Ollama Model];
K -->|Structured Output| L[PydanticOutputParser];
B -->|Displays Results| A;
A -->|Asks Follow-up Questions| B;
B -->|Interacts with LLM| C;style A fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#ccf,stroke:#333,stroke-width:2px
style C fill:#cfc,stroke:#333,stroke-width:2px
style D fill:#fcc,stroke:#333,stroke-width:2px
style K fill:#ccf,stroke:#333,stroke-width:2px
```## ๐ How to Cite
If you use DocMind AI in your research or work, please cite it as follows:
```bibtex
@software{melin_docmind_ai_2025,
author = {Melin, Bjorn},
title = {DocMind AI: Local LLM for AI-Powered Document Analysis},
url = {https://github.com/BjornMelin/docmind-ai},
version = {0.1.0},
year = {2025}
}
```## ๐ Contributing
We welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to this project.
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
Built with โค๏ธ by [Bjorn Melin](https://bjornmelin.io)