Skip to content

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.

License

Notifications You must be signed in to change notification settings

BjornMelin/docmind-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  DocMind AI: Local LLM for AI-Powered Document Analysis

Python Streamlit LangChain Docker Ollama

MIT License GitHub LinkedIn

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. 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
  2. Getting Started with DocMind AI: Local LLM Analysis
  3. Usage
  4. Architecture
  5. How to Cite
  6. Contributing
  7. License

๐Ÿš€ Getting Started with DocMind AI: Local LLM Analysis

๐Ÿ“‹ Prerequisites

  • Ollama installed and running.
  • Python 3.8 or higher.
  • (Optional) Docker and Docker Compose for containerized deployment.

โš™๏ธ Installation

  1. Clone the repository:

    git clone https://github.com/BjornMelin/docmind-ai.git
    cd docmind-ai
  2. Install dependencies:

    pip install -r requirements.txt

โ–ถ๏ธ Running the App

Locally:

streamlit run app.py

With Docker:

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 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:

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
Loading

๐Ÿ“– How to Cite

If you use DocMind AI in your research or work, please cite it as follows:

@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 file for details on how to contribute to this project.

๐Ÿ“ƒ License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with โค๏ธ by Bjorn Melin

About

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.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published