Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Personal AI Framework

Build your own personalized AI assistant with custom models, RAG, and conversation memory

Python Status License

[πŸ“Έ Screenshot Coming Soon]

Overview

A modular framework for building personalized AI assistants from scratch. Supports custom model training, retrieval-augmented generation (RAG), conversation memory, and extensible plugin architecture.

Perfect for:

  • Learning how AI assistants work under the hood
  • Building custom AI solutions for personal use
  • Experimenting with different AI models and techniques
  • Privacy-focused AI with local processing

Features

  • πŸ€– Custom AI Engine - Integrate any model (HuggingFace, OpenAI, Ollama)
  • πŸ’Ύ Conversation Memory - Persistent context across sessions
  • πŸ“š RAG Support - Retrieval-augmented generation for knowledge bases
  • πŸ”Œ Plugin Architecture - Extensible with custom tools and skills
  • 🎯 CLI Interface - Simple command-line interaction
  • πŸ›‘οΈ Privacy-First - Local processing option, no data leaks
  • βš™οΈ Modular Design - Easy to customize and extend

Quick Start

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • (Optional) Ollama for local AI models

Installation

  1. Clone and navigate:

    cd personal-ai
  2. Create virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run the CLI:

    python src/cli.py

First Conversation

$ python src/cli.py

πŸ€– Personal AI - Ready to chat!
Type 'exit' to quit, 'clear' to reset conversation

You: Hello! What can you do?
AI: I'm your personal AI assistant. I can help with...

You: Tell me about Python
AI: Python is a high-level programming language...

Architecture

personal-ai/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ ai_engine.py      # Core AI model integration
β”‚   β”‚   β”œβ”€β”€ memory.py          # Conversation memory manager
β”‚   β”‚   └── embeddings.py      # Text embeddings for RAG
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ base.py            # Base model interface
β”‚   β”‚   β”œβ”€β”€ ollama.py          # Ollama integration
β”‚   β”‚   └── openai.py          # OpenAI integration
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ processor.py       # Data preprocessing
β”‚   β”‚   └── vectorstore.py     # Vector database
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ config.py          # Configuration management
β”‚   β”‚   └── logger.py          # Logging utilities
β”‚   β”œβ”€β”€ cli.py                 # Command-line interface
β”‚   └── main.py                # Main application
β”œβ”€β”€ tests/                     # Unit tests
β”œβ”€β”€ docs/                      # Documentation
β”œβ”€β”€ config/
β”‚   └── default.yaml           # Default configuration
β”œβ”€β”€ data/                      # User data & documents
β”œβ”€β”€ models/                    # Downloaded model files
└── logs/                      # Application logs

Usage Examples

Basic Chat

from src.core.ai_engine import AIEngine

engine = AIEngine(model="ollama/llama2")
response = engine.chat("What is machine learning?")
print(response)

Conversation with Memory

from src.core.ai_engine import AIEngine
from src.core.memory import ConversationMemory

memory = ConversationMemory()
engine = AIEngine(memory=memory)

engine.chat("My name is John")
engine.chat("What's my name?")  # AI remembers context

RAG with Documents

from src.core.ai_engine import AIEngine
from src.data.vectorstore import VectorStore

vectorstore = VectorStore()
vectorstore.add_documents(["path/to/docs"])

engine = AIEngine(vectorstore=vectorstore)
response = engine.chat("Summarize the documentation")

Configuration

AI Model Settings

Edit config/default.yaml:

ai:
  provider: ollama  # Options: ollama, openai, huggingface
  model: llama2
  temperature: 0.7
  max_tokens: 500

memory:
  enabled: true
  max_history: 10
  
rag:
  enabled: false
  chunk_size: 500
  overlap: 50

Environment Variables

# For OpenAI (if using)
export OPENAI_API_KEY=your_key_here

# For HuggingFace (if using)
export HUGGINGFACE_TOKEN=your_token_here

Tech Stack

  • Language: Python 3.8+
  • AI Integration: HuggingFace Transformers, OpenAI API, Ollama
  • Embeddings: Sentence Transformers
  • Vector Store: ChromaDB / FAISS
  • CLI: Click / argparse
  • Testing: pytest

Project Status

  • Project structure and architecture
  • Configuration system
  • Logging utilities
  • Core AI engine (IN PROGRESS)
  • Conversation memory
  • RAG implementation
  • CLI interface
  • Plugin system
  • Web interface
  • Documentation

Roadmap

Phase 1: Core Functionality (Current)

  • Implement AI engine with model loading
  • Add basic conversation memory
  • Create functional CLI

Phase 2: Advanced Features

  • RAG with document ingestion
  • Plugin architecture
  • Multiple model support

Phase 3: Polish

  • Web interface
  • Model fine-tuning tools
  • Comprehensive documentation

Development

Run in development mode:

source .venv/bin/activate
python src/cli.py --debug

Run tests:

pytest tests/ -v

Code formatting:

black src/
flake8 src/

Troubleshooting

Import errors:

source .venv/bin/activate
pip install -r requirements.txt

Model loading slow:

  • First load downloads models (can take time)
  • Models are cached for subsequent runs
  • Use smaller models for faster startup

Memory issues:

  • Reduce max_tokens in config
  • Use quantized models
  • Clear conversation history regularly

Contributing

Contributions welcome! This project is actively being developed.

Areas needing work:

  • Core AI engine implementation
  • RAG system
  • Additional model integrations
  • Documentation
  • Tests

License

MIT License - Free to use and modify!

Resources

About

Custom personal AI framework with modular architecture - AI/ML development platform with privacy-focused local processing

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages