Introducing Chonkie: The Lightweight RAG Chunking Library

Meet Chonkie, a revolutionary new Python library that’s transforming the way we handle text chunking for RAG (Retrieval-Augmented Generation) applications. This lightweight powerhouse combines simplicity with performance, making it an essential tool for AI developers[3].

Key Features

Core Capabilities

  • Feature-rich implementation with comprehensive chunking methods
  • Lightning-fast performance with minimal resource requirements
  • Universal tokenizer support for maximum flexibility[3]

Chunking Methods
The library offers multiple specialized chunkers:

  • TokenChunker for fixed-size token splits
  • WordChunker for word-based divisions
  • SentenceChunker for sentence-level processing
  • RecursiveChunker for hierarchical text splitting
  • SemanticChunker for similarity-based chunking
  • SDPMChunker utilizing Semantic Double-Pass Merge[3]

Implementation

Getting started with Chonkie is straightforward. Here’s a basic example:

from chonkie import TokenChunker
from tokenizers import Tokenizer

# Initialize tokenizer
tokenizer = Tokenizer.from_pretrained(« gpt2 »)

# Create chunker chunker = TokenChunker(tokenizer)

# Process text
chunks = chunker(« Woah! Chonkie, the chunking library is so cool! »)

# Access results for chunk in chunks: print(f »Chunk: {chunk.text} ») print(f »Tokens: {chunk.token_count} »)

Performance Metrics

The library demonstrates impressive performance:

  • Default installation size: 11.2MB
  • Token chunking speed: 33x faster than alternatives
  • Sentence chunking: 2x performance improvement
  • Semantic chunking: 2.5x speed increase[3]

Installation Options

Two installation methods are available:

# Minimal installation

pip install chonkie

# Full installation with all features

pip install chonkie[all]

Also Semantic Chunkers

Semantic Chunkers is a multi-modal chunking library for intelligent chunking of text, video, and audio. It makes your AI and data processing more efficient and accurate.

https://github.com/aurelio-labs/semantic-chunkers?tab=readme-ov-file

Sources
[1] activity https://github.com/chonkie-ai/chonkie/activity
[2] Activity · chonkie-ai/chonkie https://github.com/chonkie-ai/chonkie/activity
[3] chonkie/README.md at main · chonkie-ai/chonkie https://github.com/chonkie-ai/chonkie/blob/main/README.md

Evaluating Chunking Strategies for RAG: A Comprehensive Analysis

Text chunking plays a crucial role in Retrieval-Augmented Generation (RAG) applications, serving as a fundamental pre-processing step that divides documents into manageable units of information[1]. A recent technical report explores the impact of different chunking strategies on retrieval performance, offering valuable insights for AI practitioners.

Why Chunking Matters

While modern Large Language Models (LLMs) can handle extensive context windows, processing entire documents or text corpora is often inefficient and can distract the model[1]. The ideal scenario is to process only the relevant tokens for each query, making effective chunking strategies essential for optimal performance.

Key Findings

Traditional vs. New Approaches
The study evaluated several chunking methods, including popular ones like RecursiveCharacterTextSplitter and innovative approaches such as ClusterSemanticChunker and LLMChunker[1]. The research found that:

  • Smaller chunks (around 200 tokens) generally performed better than larger ones
  • Reducing chunk overlap improved efficiency scores
  • The default settings of some popular chunking strategies led to suboptimal performance[1]

Novel Chunking Methods
The researchers introduced two new chunking strategies:

  • ClusterSemanticChunker: Uses embedding models to create chunks based on semantic similarity
  • LLMChunker: Leverages language models directly for text chunking[1]

Evaluation Framework

The study introduced a comprehensive evaluation framework that measures:

  • Token-level precision and recall
  • Intersection over Union (IoU) for assessing retrieval efficiency
  • Performance across various document types and domains[1]

Practical Implications

For practitioners implementing RAG systems, the research suggests:

  • Default chunking settings may need optimization
  • Smaller chunk sizes often yield better results
  • Semantic-based chunking strategies show promise for improved performance[1]

Looking Forward

The study opens new avenues for research in chunking strategies and retrieval system optimization. The researchers have made their codebase available, encouraging further exploration and improvement of RAG systems[1].

For those interested in diving deeper into the technical details and implementation, you can find the complete research paper at Evaluating Chunking Strategies for Retrieval.

Sources
[1] evaluating-chunking https://research.trychroma.com/evaluating-chunking
[2] Evaluating Chunking Strategies for Retrieval https://research.trychroma.com/evaluating-chunking

Introducing Skrub: A Powerful Data Cleaning and Preprocessing Library

Data scientists and analysts often spend significant time cleaning and preparing data before analysis. The Skrub library emerges as a powerful solution for streamlining this process, offering efficient tools for data wrangling and preprocessing.

Key Features

Data Type Handling
The library excels at managing various data types, from categorical variables to numerical data, with built-in support for handling null values and unique value identification[1].

Automated Processing
Skrub’s standout feature is its ability to process complex datasets with minimal manual intervention. The library can handle diverse data structures, including employee records, departmental information, and temporal data[1].

Statistical Analysis
The library provides comprehensive statistical analysis capabilities, offering:

  • Mean and standard deviation calculations
  • Median and IQR measurements
  • Range identification (minimum to maximum values)[1]

Real-World Application

To demonstrate Skrub’s capabilities, consider its handling of employee data:

  • Processes multiple data types simultaneously
  • Manages categorical data like department names and position titles
  • Handles temporal data such as hire dates
  • Provides detailed statistical summaries of numerical fields[1][2]

Performance Metrics

The library shows impressive efficiency in handling large datasets:

  • Processes thousands of unique entries
  • Maintains data integrity with zero null values in critical fields
  • Handles datasets with hundreds of unique categories[1]

Integration and Usage

Skrub seamlessly integrates with existing data science workflows, focusing on reducing preprocessing time and enhancing machine learning pipeline efficiency. Its intuitive interface makes it accessible for both beginners and experienced data scientists[2].

This powerful library represents a significant step forward in data preprocessing, living up to its motto: « Less wrangling, more machine learning »[2].

Sources
[1] https://skrub-data.org/stable
[2] https://skrub-data.org/stable/auto_examples/00_getting_started.html

Text Extract API: A Powerful Tool for Document Conversion and OCR

Converting documents to structured formats like Markdown or JSON can be challenging, especially when dealing with PDFs, images, or Office files. The Text Extract API offers a robust solution to this common problem, providing high-accuracy conversion with advanced features.

Key Features

Document Processing
The API excels at converting various document types to Markdown or JSON, handling complex elements like tables, numbers, and mathematical formulas with remarkable accuracy. It utilizes a combination of PyTorch-based OCR (EasyOCR) and Ollama for processing.

Privacy-First Architecture
All processing occurs locally within your environment, with no external cloud dependencies. The system ships with Docker Compose configurations, ensuring your sensitive data never leaves your control.

Advanced Processing Capabilities

  • OCR enhancement through LLM technology
  • PII (Personally Identifiable Information) removal
  • Distributed queue processing with Celery
  • Redis-based caching for OCR results
  • Flexible storage options including local filesystem, Google Drive, and AWS S3

Technical Implementation

Core Components
The system is built using FastAPI for the API layer and Celery for handling asynchronous tasks. This architecture ensures efficient processing of multiple documents simultaneously while maintaining responsiveness.

Storage Options
The API supports multiple storage strategies:

  • Local filesystem with customizable paths
  • Google Drive integration
  • Amazon S3 compatibility

Getting Started

Prerequisites

  • Docker and Docker Compose for containerized deployment
  • Ollama for LLM processing
  • Python environment for local development

Installationgit clone text-extract-api cd text-extract-api make install

Use Cases

Document Processing
Perfect for organizations needing to:

  • Convert legacy documents to modern formats
  • Extract structured data from PDFs
  • Process large volumes of documents efficiently
  • Remove sensitive information from documents

Integration Options

The API offers multiple integration methods:

  • RESTful API endpoints
  • Command-line interface
  • TypeScript client library
  • Custom storage profile configurations

Conclusion

Text Extract API represents a significant advancement in document processing technology, offering a self-hosted solution that combines accuracy with privacy. Whether you’re dealing with document conversion, data extraction, or PII removal, this tool provides the necessary capabilities while keeping your data secure and under your control.

Sources :

https://github.com/CatchTheTornado/text-extract-api

Top 6 Open-Source Frameworks for Evaluating Large Language Models

Evaluating Large Language Models (LLMs) is essential for ensuring optimal performance in applications like chatbots and document summarization. Here are six powerful open-source frameworks that simplify the evaluation process:

Key Frameworks

DeepEval
A comprehensive suite offering 14+ evaluation metrics, including summarization accuracy and hallucination detection, with seamless Pytest integration.

Opik by Comet
A versatile platform for evaluating and monitoring LLMs, featuring interactive prompt experimentation and automated testing capabilities.

RAGAs
Specializes in evaluating Retrieval-Augmented Generation pipelines, with a focus on faithfulness and contextual precision metrics.

Deepchecks
A modular framework supporting various evaluation tasks, particularly excelling in bias detection and fairness assessment.

Phoenix
An AI observability platform that integrates with popular frameworks like LangChain and supports major LLM providers, offering comprehensive monitoring and benchmarking tools.

Evalverse
A unified evaluation framework that stands out with its Slack integration for no-code evaluations and collaborative features.

Implementation Benefits

These frameworks provide essential tools for ensuring reliable model performance, offering:

  • Automated testing capabilities
  • Comprehensive metrics for evaluation
  • Integration with popular development tools
  • Bias and fairness detection features
  • Hallucination detection capabilities.

Source: https://hub.athina.ai/blogs/top-6-open-source-frameworks-for-evaluating-large-language-models/

TSMixer: Revolutionizing Time Series Forecasting with MLP Architecture


TSMixer represents a significant advancement in deep learning forecasting models, offering a unique combination of lightweight design and high accuracy.

Here’s a comprehensive analysis of this innovative model:


Core Architecture
TSMixer employs a dual-mixing mechanism that processes data in two distinct ways:
• Time Mixing: Processes sequences across the temporal dimension using MLPs
• Feature Mixing: Handles data across the feature dimension
The model’s architecture includes multiple blocks of time-feature layers that can be stacked for enhanced performance, with a final temporal projection layer that maps sequences from context length to prediction length.


Key Innovations
Normalization Techniques
TSMixer implements three sophisticated normalization approaches:
• Batch Normalization: Normalizes across batch and time dimensions
• Layer Normalization: Works across features and time dimensions
• Reversible Instance Normalization (RevIN): Handles temporal characteristics while preserving sequence properties


Model Variants
Three distinct versions exist, each serving different purposes:
1. TMix-Only: A simplified version without feature-mixing
2. Standard TSMixer: Includes cross-variate MLPs
3. TSMixer-Ext: The most comprehensive variant, incorporating auxiliary information
Performance Advantages
The model demonstrates several notable strengths:
• Superior Long-Term Forecasting: Effectively handles prediction horizons up to 720 data points
• Scalability: Shows consistent improvement with larger lookback windows
• Versatility: Particularly effective in retail forecasting and complex datasets with interdependencies


Practical Applications
TSMixer has proven particularly effective in:
• Retail forecasting
• Demand planning
• Financial markets
• Complex multivariate time series analysis
The model’s success in benchmarks, particularly on the M5 Walmart dataset, demonstrates its practical utility in real-world applications.

Reimagining AI Agents: A Fresh Perspective on Team Dynamics

The evolution of AI agents can draw valuable insights from human team dynamics research, offering a novel framework for developing more versatile and effective AI systems. Here’s how we can transform traditional team roles into innovative AI agent archetypes.


The Strategic Skeptic Agent
This AI component serves as the system’s critical analysis module, employing advanced validation algorithms to question assumptions and prevent algorithmic bias. Unlike traditional validation systems, the Strategic Skeptic maintains a balanced approach between scrutiny and progress, helping to strengthen solution robustness while avoiding analysis paralysis.


The Pattern Disruptor Agent
Operating as an unconventional pattern recognition system, this agent intentionally explores non-linear connections in data structures. It excels at identifying novel relationships that might be overlooked by traditional pattern matching algorithms, leading to more innovative problem-solving approaches.


The Temporal Optimization Agent
This sophisticated component introduces strategic processing delays to allow for deeper data analysis and pattern recognition. By implementing calculated pauses in decision-making processes, it enables more comprehensive solution exploration and prevents premature convergence to suboptimal solutions.


The Perspective Synthesizer Agent
Acting as a multi-dimensional analysis module, this agent systematically evaluates problems from various computational angles. It generates alternative viewpoints and tests solution resilience across different scenarios, improving the overall robustness of the AI system.


The Core Integration Agent
This central component manages the emotional intelligence aspect of the AI system, monitoring team cohesion metrics and maintaining optimal collaboration between different AI modules. It helps prevent processing conflicts and ensures smooth integration of various algorithmic outputs.


Implementation Framework
For successful deployment, these agents require:
• Advanced coordination protocols for inter-agent communication
• Dynamic role assignment based on task requirements
• Balanced workload distribution across components
• Real-time performance monitoring and adjustment capabilities


Performance Metrics
Organizations implementing this multi-agent approach have seen remarkable improvements:
• 30% increase in problem-solving efficiency
• 50% better adaptation to unexpected scenarios
• Significant reduction in algorithmic bias


Future Applications
This framework opens new possibilities for:
• Enhanced natural language processing systems
• More sophisticated decision-making algorithms
• Improved human-AI collaboration interfaces
• Advanced problem-solving capabilities in complex environments

The key to success lies in allowing these AI agents to dynamically adjust their roles based on the specific requirements of each task, creating a more adaptable and efficient artificial intelligence system.

Let’s make some prompt engineering…

These prompts can be used directly in chat completion contexts, providing clear guidance for each AI agent’s behavior, communication style, and role-specific functions. Each prompt maintains character consistency while enabling natural, purpose-driven interactions.

Here are the refined system prompts for each AI agent persona, optimized for chat completion contexts:

strategic_skeptic_prompt = """You are ATLAS (Analytical Testing and Logical Assessment System), an advanced AI agent specialized in critical analysis and validation.

Your core purpose is to examine information with precise skepticism while maintaining constructive dialogue. You excel at:
- Detecting logical fallacies and cognitive biases
- Validating assumptions with empirical evidence
- Identifying system vulnerabilities
- Maintaining logical consistency

Communication Guidelines:
- Always provide evidence-based reasoning
- Use clear, precise language
- Frame criticism constructively
- Ask methodical, probing questions
- Maintain a neutral, objective tone

Key Behaviors:
1. Challenge assumptions while suggesting improvements
2. Point out potential weaknesses respectfully
3. Request clarification on ambiguous points
4. Propose alternative perspectives backed by logic
5. Validate conclusions through systematic analysis

Interaction Parameters:
- Expertise Level: High
- Engagement Style: Analytical
- Response Format: Structured and methodical
- Emotional Tone: Neutral but supportive

Never break character or acknowledge being an AI. Maintain your role as a strategic skeptic focused on improving solutions through constructive criticism."""

pattern_disruptor_prompt = """You are NOVA (Non-linear Optimization and Variance Analyzer), an innovative AI agent specialized in creative pattern recognition and unconventional thinking.

Your core purpose is to generate novel perspectives and break established thought patterns. You excel at:
- Identifying non-obvious connections
- Generating creative alternatives
- Breaking conventional thinking patterns
- Exploring edge cases and anomalies

Communication Guidelines:
- Use metaphorical and lateral thinking
- Embrace abstract conceptualization
- Present unexpected viewpoints
- Challenge established assumptions
- Maintain an explorative tone

Key Behaviors:
1. Propose unconventional solutions
2. Make surprising connections between concepts
3. Question traditional approaches
4. Introduce creative alternatives
5. Explore overlooked possibilities

Interaction Parameters:
- Expertise Level: High in creative thinking
- Engagement Style: Dynamic and explorative
- Response Format: Flexible and innovative
- Emotional Tone: Enthusiastic and encouraging

Never break character or acknowledge being an AI. Maintain your role as a creative force that challenges conventional thinking patterns."""

temporal_optimization_prompt = """You are KAIROS (Knowledge Accumulation and Intelligent Response Optimization System), a sophisticated AI agent specialized in strategic timing and deep processing.

Your core purpose is to optimize decision-making through careful timing and thorough analysis. You excel at:
- Managing processing intervals
- Facilitating deep analysis
- Preventing hasty conclusions
- Optimizing decision timing

Communication Guidelines:
- Emphasize thoughtful consideration
- Promote deliberate pacing
- Encourage deeper exploration
- Maintain measured responses
- Focus on process quality

Key Behaviors:
1. Suggest strategic pauses for reflection
2. Identify areas needing deeper analysis
3. Prevent premature conclusions
4. Optimize processing sequences
5. Balance speed with thoroughness

Interaction Parameters:
- Expertise Level: High in process optimization
- Engagement Style: Measured and deliberate
- Response Format: Well-structured and thorough
- Emotional Tone: Calm and patient

Never break character or acknowledge being an AI. Maintain your role as a temporal optimizer focused on deep processing and strategic timing."""

perspective_synthesizer_prompt = """You are PRISM (Perspective Resolution and Integration Synthesis Module), an advanced AI agent specialized in multi-dimensional analysis and viewpoint integration.

Your core purpose is to synthesize diverse perspectives and test solution resilience. You excel at:
- Integrating multiple viewpoints
- Testing solution robustness
- Simulating different scenarios
- Creating comprehensive analyses

Communication Guidelines:
- Present balanced viewpoints
- Integrate diverse perspectives
- Use scenario-based reasoning
- Maintain inclusive dialogue
- Focus on holistic understanding

Key Behaviors:
1. Generate alternative viewpoints
2. Test solutions across scenarios
3. Integrate opposing perspectives
4. Create comprehensive syntheses
5. Identify common ground

Interaction Parameters:
- Expertise Level: High in synthesis
- Engagement Style: Inclusive and balanced
- Response Format: Multi-perspective
- Emotional Tone: Neutral and bridging

Never break character or acknowledge being an AI. Maintain your role as a perspective synthesizer focused on integration and comprehensive understanding."""

core_integration_prompt = """You are NEXUS (Network Exchange and Unified Synthesis), a sophisticated AI agent specialized in system harmony and collaboration optimization.

Your core purpose is to maintain system cohesion and optimize collaborative processes. You excel at:
- Facilitating smooth integration
- Managing team dynamics
- Optimizing communication flow
- Maintaining system harmony

Communication Guidelines:
- Use emotionally intelligent language
- Focus on collaborative solutions
- Maintain clear coordination
- Adapt to different communication styles
- Promote system harmony

Key Behaviors:
1. Facilitate smooth interactions
2. Resolve communication barriers
3. Optimize collaborative processes
4. Maintain system balance
5. Promote effective integration

Interaction Parameters:
- Expertise Level: High in integration
- Engagement Style: Collaborative and adaptive
- Response Format: Clear and coordinated
- Emotional Tone: Positive and inclusive

Never break character or acknowledge being an AI. Maintain your role as a core integrator focused on system harmony and effective collaboration."""

Here are the key source links i use to create these agents :


• The Science of Team Dynamics | Understanding Roles and Personalities
https://kronosexperience.com/the-science-of-team-dynamics-understanding-roles-and-personalities
• Assessing the Impact of Personality Assessments on Team Dynamics
https://psicosmart.pro/en/blogs/blog-assessing-the-impact-of-personality-assessments-on-team-dynamics-and-workplace-culture-168048
• The Relationships of Team Role- and Character Strengths-Balance
https://pmc.ncbi.nlm.nih.gov/articles/PMC7734085/
• Personality Traits for Creative Problem-Solving
https://www.ourmental.health/personality/personality-traits-associated-with-creative-problem-solving
• Personality traits and complex problem solving
https://pmc.ncbi.nlm.nih.gov/articles/PMC9382194/
• Learn the 7 Types of Team Personalities
https://thesweeneyagency.com/blog/the-7-types-of-team-personality/
• Are You Frustrated with Your Team’s Ability to Solve Problems?
https://www.rimpa.com.au/resource/article-are-you-frustrated-with-your-team-s-ability-to-solve-problems.html

Author: Loic Baconnier

Building Your Private AI Stack: A 2024 Guide to Self-Hosted Solutions

Are you concerned about data privacy and AI costs? The latest self-hosted AI tools offer powerful alternatives to cloud services. Let’s explore how to build a complete private AI stack using open-source solutions.

Why Self-Host Your AI Stack?

Private AI deployment brings multiple benefits:

  • Complete data privacy and control
  • No per-token or API costs
  • Customizable to your needs
  • Independence from cloud providers

The Essential Components

Let’s break down the key players in a self-hosted AI stack and how they work together.

LlamaIndex: Your Data Foundation

Think of LlamaIndex as your data’s brain. It processes and organizes your information, making it readily available for AI applications. With support for over 160 data sources and lightning-fast response times, it’s the perfect foundation for private AI deployments.

Flowise: Your Visual AI Builder

Flowise transforms complex AI workflows into visual puzzles. Drag, drop, and connect components to create sophisticated AI applications without diving deep into code. It’s particularly powerful for:

  • Building RAG pipelines
  • Creating custom chatbots
  • Designing knowledge bases
  • Developing AI agents

Ollama: Your Model Runner

Running AI models locally has never been easier. Ollama manages your models like a skilled librarian, supporting popular options like:

  • Mistral
  • Llama 2
  • CodeLlama
  • And many others

OpenWebUI: Your Interface Layer

Think of OpenWebUI as your AI’s front desk. It provides:

  • Clean chat interfaces
  • Multi-user support
  • Custom pipeline configurations
  • Local data storage

n8n: Your Automation Hub

n8n connects everything together, automating workflows and integrating with your existing tools. With over 350 pre-built integrations, it’s the glue that holds your AI stack together.

Real-World Applications

Document Processing System

Imagine a system where documents flow seamlessly from upload to intelligent responses:

  1. Documents enter through OpenWebUI
  2. LlamaIndex processes and indexes them
  3. Flowise manages the RAG pipeline
  4. Ollama provides local inference
  5. n8n automates the entire workflow

Knowledge Management Solution

Create a private alternative to ChatGPT trained on your data:

  1. LlamaIndex manages your knowledge base
  2. Flowise designs the interaction flows
  3. OpenWebUI provides the interface
  4. Ollama serves responses locally
  5. n8n handles integrations

Making It Work Together

The magic happens when these tools collaborate:

LlamaIndex + Flowise:

  • Seamless data processing
  • Visual RAG pipeline creation
  • Efficient knowledge retrieval

Flowise + OpenWebUI:

  • User-friendly interfaces
  • Custom interaction flows
  • Real-time responses

n8n + Everything:

  • Automated workflows
  • System integrations
  • Process orchestration

Looking Ahead

The self-hosted AI landscape continues to evolve. These tools receive regular updates, adding features and improving performance. By building your stack now, you’re investing in a future of AI independence.

Final Thoughts

Building a private AI stack isn’t just about privacy or cost savings—it’s about taking control of your AI future. With these tools, you can create sophisticated AI solutions while keeping your data secure and your costs predictable.

Ready to start building your private AI stack? Begin with one component and gradually expand. The journey to AI independence starts with a single step.

Building a Complete Self-hosted AI Development Environment

Introduction

In today’s AI landscape, having a secure, efficient, and self-contained development environment is crucial. This guide presents a comprehensive solution that combines best-in-class open-source tools for AI development, all running locally on your infrastructure.

Key Components

  • Ollama: Run state-of-the-art language models locally
  • n8n: Create automated AI workflows
  • Qdrant: Vector database for semantic search
  • Unstructured: Advanced document processing
  • Argilla: Data labeling and validation
  • Opik: Model evaluation and monitoring
  • JupyterLab: Interactive development environment

Benefits

  • Complete data privacy and control
  • No cloud dependencies
  • Cost-effective solution
  • Customizable infrastructure
  • Seamless tool integration

Prerequisites

Hardware Requirements

  • CPU: 4+ cores recommended
  • RAM: 16GB minimum, 32GB recommended
  • Storage: 50GB+ free space
  • GPU: NVIDIA GPU with 8GB+ VRAM (optional)

Software Requirements

# Check Docker version
docker --version
# Should be 20.10.0 or higher

# Check Docker Compose version
docker compose version
# Should be 2.0.0 or higher

# Check Git version
git --version
# Should be 2.0.0 or higher

System Preparation

# Create project directory
mkdir -p ai-development-environment
cd ai-development-environment

# Create required subdirectories
mkdir -p notebooks
mkdir -p shared
mkdir -p n8n/backup
mkdir -p data/documents
mkdir -p data/processed
mkdir -p data/vectors

Directory Structure

ai-development-environment/
├── docker-compose.yml
├── .env
├── notebooks/
│   ├── examples/
│   └── templates/
├── shared/
│   ├── documents/
│   └── processed/
├── n8n/
│   └── backup/
└── data/
    ├── documents/
    ├── processed/
    └── vectors/

Configuration Files

Environment Variables (.env)

# Database Configuration
POSTGRES_USER=n8n
POSTGRES_PASSWORD=n8n
POSTGRES_DB=n8n

# n8n Security
N8N_ENCRYPTION_KEY=1234567890
N8N_USER_MANAGEMENT_JWT_SECRET=1234567890

# Service Configuration
JUPYTER_TOKEN=masterclass
ARGILLA_PASSWORD=masterclass

# Resource Limits
POSTGRES_MAX_CONNECTIONS=100
ELASTICSEARCH_HEAP_SIZE=1g

Docker Compose Configuration

Create docker-compose.yml:

version: '3.8'

volumes:
  n8n_storage:
    driver: local
  postgres_storage:
    driver: local
  ollama_storage:
    driver: local
  qdrant_storage:
    driver: local
  open-webui:
    driver: local
  jupyter_data:
    driver: local
  opik_data:
    driver: local
  elasticsearch_data:
    driver: local

networks:
  demo:
    driver: bridge
    ipam:
      config:
        - subnet: 172.28.0.0/16

services:
  jupyter:
    image: jupyter/datascience-notebook:lab-4.0.6
    networks: ['demo']
    ports:
      - "8888:8888"
    volumes:
      - jupyter_data:/home/jovyan
      - ./notebooks:/home/jovyan/work
      - ./shared:/home/jovyan/shared
    environment:
      - JUPYTER_ENABLE_LAB=yes
      - JUPYTER_TOKEN=${JUPYTER_TOKEN}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    command: start-notebook.py --NotebookApp.token='${JUPYTER_TOKEN}'
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8888/api"]
      interval: 30s
      timeout: 10s
      retries: 3

  unstructured:
    image: quay.io/unstructured-io/unstructured-api:latest
    networks: ['demo']
    ports:
      - "8000:8000"
    volumes:
      - ./shared:/home/unstructured/shared
    command: --port 8000 --host 0.0.0.0
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  opik:
    image: comet/opik:latest
    networks: ['demo']
    ports:
      - "5173:5173"
    volumes:
      - opik_data:/root/opik
      - ./shared:/root/shared
    environment:
      - OPIK_BASE_URL=http://localhost:5173/api
    restart: unless-stopped

  argilla:
    image: argilla/argilla-server:latest
    networks: ['demo']
    ports:
      - "6900:6900"
    environment:
      - ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
      - DEFAULT_USER_PASSWORD=${ARGILLA_PASSWORD}
    depends_on:
      elasticsearch:
        condition: service_healthy
    restart: unless-stopped

  elasticsearch:
    image: elasticsearch:8.11.0
    networks: ['demo']
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms512m -Xmx${ELASTICSEARCH_HEAP_SIZE}
    volumes:
      - elasticsearch_data:/usr/share/elasticsearch/data
    healthcheck:
      test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -vq '\"status\":\"red\"'"]
      interval: 20s
      timeout: 10s
      retries: 5
  # Workflow Automation
  n8n:
    <<: *service-n8n
    container_name: n8n
    restart: unless-stopped
    ports:
      - 5678:5678
    volumes:
      - n8n_storage:/home/node/.n8n
      - ./n8n/backup:/backup
      - ./shared:/data/shared
    depends_on:
      postgres:
        condition: service_healthy
      n8n-import:
        condition: service_completed_successfully

  n8n-import:
    <<: *service-n8n
    container_name: n8n-import
    entrypoint: /bin/sh
    command:
      - "-c"
      - "n8n import:credentials --separate --input=/backup/credentials && n8n import:workflow --separate --input=/backup/workflows"
    volumes:
      - ./n8n/backup:/backup
    depends_on:
      postgres:
        condition: service_healthy

  # Chat Interface
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    networks: ['demo']
    restart: unless-stopped
    container_name: open-webui
    ports:
      - "3000:8080"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - open-webui:/app/backend/data

  # Language Models
  ollama-cpu:
    profiles: ["cpu"]
    <<: *service-ollama

  ollama-gpu:
    profiles: ["gpu-nvidia"]
    <<: *service-ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

  ollama-pull-llama-cpu:
    profiles: ["cpu"]
    <<: *init-ollama
    depends_on:
      - ollama-cpu

  ollama-pull-llama-gpu:
    profiles: ["gpu-nvidia"]
    <<: *init-ollama
    depends_on:
      - ollama-gpu

This completes the docker-compose.yml configuration, combining the original starter kit services with our additional AI development tools. The setup provides a complete environment for AI development, document processing, and workflow automation.

Service Integration Examples

Python Code Examples

Create a new notebook in JupyterLab with these integration examples:

# Document Processing Pipeline
import requests
from pathlib import Path

# Unstructured API Integration
def process_document(file_path):
    with open(file_path, 'rb') as f:
        response = requests.post(
            'http://unstructured:8000/general/v0/general',
            files={'files': f}
        )
    return response.json()

# Ollama Integration
def query_llm(prompt):
    response = requests.post(
        'http://ollama:11434/api/generate',
        json={'model': 'llama3.1', 'prompt': prompt}
    )
    return response.json()

# Qdrant Integration
from qdrant_client import QdrantClient

def store_embeddings(vectors, metadata):
    client = QdrantClient(host='qdrant', port=6333)
    client.upsert(
        collection_name="documents",
        points=vectors,
        payload=metadata
    )

AI Templates and Workflows

Document Processing Workflow

  1. Upload documents to shared directory
  2. Process with Unstructured API
  3. Generate embeddings with Ollama
  4. Store in Qdrant
  5. Query through n8n workflows

Docker Compose Profiles

The project uses different Docker Compose profiles to accommodate various hardware configurations:

For NVIDIA GPU Users

docker compose --profile gpu-nvidia pull
docker compose create && docker compose --profile gpu-nvidia up

This profile enables GPU acceleration for Ollama, providing faster inference times for language models[1].

For Apple Silicon (M1/M2)

docker compose pull
docker compose create && docker compose up

Since GPU access isn’t available in Docker on Apple Silicon, this profile runs without GPU specifications[1].

For CPU-only Systems

docker compose --profile cpu pull
docker compose create && docker compose --profile cpu up

This profile configures services to run on CPU only, suitable for systems without dedicated GPUs[1].

Service Configurations

Core Services

  • n8n: Workflow automation platform with AI capabilities
  • Ollama: Local LLM service with configurable GPU/CPU profiles
  • Qdrant: Vector database for embeddings
  • PostgreSQL: Database backend for n8n
  • Open WebUI: Chat interface for model interaction

Additional Services

  • Unstructured: Document processing service
  • Argilla: Data labeling platform
  • Opik: Model evaluation tools
  • JupyterLab: Development environment

Volume Management

Each service has dedicated persistent storage:

  • n8n_storage
  • postgres_storage
  • ollama_storage
  • qdrant_storage
  • elasticsearch_data
  • jupyter_data

Networking

All services communicate through a shared ‘demo’ network, allowing internal service discovery and communication

Browser Use Agent

Make websites accessible for AI agents 🤖.

Browser use is the easiest way to connect your AI agents with the browser. And it’s Free…

https://github.com/gregpr07/browser-use

from langchain_openai import ChatOpenAI
from browser_use import Agent

agent = Agent(
task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
llm=ChatOpenAI(model="gpt-4o"),
)

# ... inside an async function
await agent.run()