Bielik โ local chat client (CLI + web) with HuggingFace Integration
Project description
๐ฆ Bielik
Author: Tom Sapletta
License: Apache-2.0
๐ต๐ฑ Bielik is a powerful Polish AI Assistant that downloads and runs Polish language models from HuggingFace, created specifically for the Bielik models from Speakleash.
๐ Key Features:
- ๐ฏ HuggingFace Integration - Direct model downloads from HF Hub
- ๐ฌ Polish Language Optimized - Built for Polish conversation and analysis
- ๐ผ๏ธ Vision Capabilities - Image analysis and visual question answering
- ๐ Document Processing - PDF, DOCX, web content analysis
- ๐ณ Docker Ready - Containerized testing environments
- โก Lightweight - Minimal (~50MB) or Full (~2GB) installation options
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฆ
BIELIK SYSTEM โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโค
โ ๐ฅ๏ธ CLI Shell โ ๐ FastAPI Server โ ๐ณ Docker Tests โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโ โ
โ โ โข Interactive โโ โ โข REST /chat โ โ โ โข Minimal โ โ
โ โ โข Personalized โโ โ โข WebSocket /ws โ โ โ โข Full โ โ
โ โ โข Multi-modal โโ โ โข Port 8000 โ โ โ โข CI/CD โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค HUGGINGFACE INTEGRATION โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Direct Downloads โโโโโบโ Local Model Execution โ โ
โ โ โโ HF Hub API โ โ โโ Transformers Pipeline โ โ
โ โ โโ Model Management โ โ โโ Vision Models (optional) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ POLISH LANGUAGE MODELS โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ค Speakleash/Bielik Models (HuggingFace Hub) โ โ
โ โ ๐ Direct: HuggingFace โ Local Storage โ Execution โ โ
โ โ ๐ฏ Polish-optimized conversation and analysis โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ค About Bielik Model
Bielik is a groundbreaking Polish language model created by Speakleash - a foundation dedicated to the development of Polish artificial intelligence.
๐ External Dependencies & Links:
- HuggingFace Hub - Primary source for Polish language models
- Bielik Models on HuggingFace - Official model repository
- Speakleash Foundation - Creators of the Bielik models
- Polish AI Initiative - Government support for Polish AI
๐ How it Works:
- Bielik CLI connects directly to HuggingFace Hub
- Models are downloaded from Speakleash organization on HuggingFace
- Local execution uses Transformers library (optional for vision)
- Chat interface (CLI/Web) โ Local Models โ Polish responses
- Modular design supports text-only or full vision capabilities
๐ Features
- ๐ฏ HuggingFace Integration โ Direct model downloads and management
- ๐ Model Discovery โ Browse available Polish language models
- ๐ฆ Smart Downloads โ Automatic model caching and versioning
- ๐ Auto-Switch โ Automatically switches to newly downloaded models
- ๐ ๏ธ Interactive โ User-friendly model selection on first startup
- ๐ฅ๏ธ Enhanced CLI
python -m bielikโ Personalized chat experience- ๐ Commands โ
:help,:models,:download,:delete,:switch,:settings,:name - โ๏ธ Personalization โ Custom user names, dynamic assistant names
- ๐ค HF Management โ Direct HuggingFace model operations
- ๐ Content Analysis โ Folder scanning, document processing
- ๐ Cross-platform โ Windows, macOS, Linux support
- ๐ Commands โ
- ๐ผ๏ธ Vision Capabilities (Full version only)
- ๐ Image Analysis โ Automatic image captioning in Polish
- โ Visual QA โ Ask questions about images
- ๐จ Multi-modal โ Combined text and image understanding
- โก GPU Support โ Hardware acceleration for faster processing
- ๐ Python API โ Programmatic access via
BielikClientclass- ๐ฌ Chat methods โ
chat(),query(), conversation management - ๐ง Model control โ Download, switch, and manage models
- ๐ค HF Models โ Full HuggingFace integration
- ๐ค Export โ Conversation history in multiple formats
- ๐ฌ Chat methods โ
- ๐ Web Server (FastAPI on port 8000):
- ๐ก REST โ
POST /chatendpoint for JSON communication - โก WebSocket โ
WS /wsfor real-time chat - ๐ผ๏ธ Multi-modal โ Support for text and image inputs
- ๐ก REST โ
- ๐ณ Docker Support โ Complete containerized testing
- ๐ฆ Minimal Version โ Lightweight text-only container (~50MB)
- ๐ฏ Full Version โ Complete vision-enabled container (~2GB)
- ๐ง CI/CD โ Automated testing environments
โ๏ธ Installation Options
Bielik offers two installation modes to suit different needs:
๐ชถ Minimal Version (Recommended for most users)
~50MB installation - Perfect for text-based Polish AI conversations:
# Install minimal version (text-only)
pip install bielik
# Start CLI and download your first model
python -m bielik
What's included:
- โ Polish conversation and text analysis
- โ HuggingFace model downloads and management
- โ Document processing (PDF, DOCX, TXT)
- โ Web content analysis
- โ Folder structure analysis
- โ Personalized CLI experience
- โ Image analysis (can be added later)
๐ฏ Full Version (For image analysis)
~2GB+ installation - Complete AI assistant with vision capabilities:
# Install full version (text + vision)
pip install bielik[vision]
# Start CLI with image analysis support
python -m bielik
What's included:
- โ Everything from minimal version
- โ Image analysis and captioning
- โ Visual question answering
- โ GPU acceleration support
- โ Multi-modal document processing
๐ Upgrade Anytime
Start minimal and upgrade when needed:
# Upgrade minimal โ full
pip install bielik[vision]
# Or install specific optional features
pip install bielik[local] # Local model execution
pip install bielik[gpu] # GPU acceleration
pip install bielik[dev] # Development tools
๐ Quick Start Guide
๐ฏ Instant Start (No setup required!)
Bielik now works without any external dependencies. Just install and start chatting:
# Install minimal version
pip install bielik
# Start CLI and choose your first model
python -m bielik
What happens on first run:
- ๐ Model Selection โ Choose from available Polish models
- ๐ฅ Auto Download โ Selected model downloads from HuggingFace
- ๐ Auto Switch โ Automatically switches to the new model
- ๐ฌ Ready to Chat โ Start conversing in Polish immediately!
๐ฑ Choose Your Experience
๐ชถ Minimal Setup (Recommended)
Perfect for text conversations and document analysis:
# 1. Install
pip install bielik
# 2. Start and download your first model
python -m bielik
:download speakleash/bielik-4.5b-v3.0-instruct
# 3. Start chatting in Polish!
Czeลฤ! Jak mogฤ Ci pomรณc?
๐ฏ Full Setup (For image analysis)
Includes vision capabilities for image analysis:
# 1. Install with vision support
pip install bielik[vision]
# 2. Start and download models
python -m bielik
:download speakleash/bielik-4.5b-v3.0-instruct
# 3. Analyze images
Przeanalizuj to zdjฤcie: image.jpg
๐ณ Docker Setup (For testing)
Use Docker for isolated testing environments:
# Clone repository
git clone https://github.com/tom-sapletta-com/bielik.git
cd bielik
# Test minimal version
docker-compose --profile minimal up bielik-minimal
# Test full version
docker-compose --profile full up bielik-full
๐ป Usage
๐ฅ๏ธ CLI Commands & Options
Starting Bielik
# Basic usage
python -m bielik # Start interactive chat
bielik # Alternative (if in PATH)
# Advanced options
python -m bielik --help # Show all options
Interactive Commands (inside chat session)
๐ Model Management:
:models # List available HuggingFace models
:download <model-name> # Download model from HuggingFace
:switch <model-name> # Switch to downloaded model
:delete <model-name> # Delete model from local storage
โ๏ธ Personalization:
:name <your-name> # Set your display name
:settings # Show current configuration
๐ ๏ธ Utilities:
:help # Show all commands
:clear # Clear conversation history
:exit # Quit (or Ctrl+C)
Usage Examples
First Time Setup:
$ python -m bielik
# Choose from recommended models:
# 1. speakleash/bielik-4.5b-v3.0-instruct (Recommended)
# 2. speakleash/bielik-7b-instruct-v0.1
# Enter choice: 1
๐ Downloading speakleash/bielik-4.5b-v3.0-instruct...
โ
Model ready! Switching to bielik-4.5b-v3.0-instruct
๐ค You: Czeลฤ! Jak siฤ masz?
๐ค bielik-4.5b: Czeลฤ! Mam siฤ dobrze, dziฤkujฤ...
Everyday Usage:
๐ค You: :name Jan
โ
Display name set to: Jan
๐ค Jan: Przeanalizuj folder ~/dokumenty
๐ค bielik-4.5b: [Analyzes folder structure and contents]
๐ค Jan: Opisz to zdjฤcie: vacation.jpg # (Full version only)
๐ค bielik-4.5b: [Describes image in Polish]
๐ Python API
Use Bielik programmatically in your Python applications:
from bielik.client import BielikClient
# Create client (auto-downloads model if needed)
client = BielikClient()
# Send a Polish message
response = client.chat("Napisz krรณtki wiersz o Polsce")
print(response)
# Get model status
status = client.get_status()
print(f"Current model: {status['current_model']}")
print(f"Models available: {status['models_available']}")
# Export conversation
history = client.export_conversation(format="markdown")
Quick functions:
from bielik.client import quick_chat
# One-off Polish query
response = quick_chat("Co to jest sztuczna inteligencja?")
print(response)
BielikClient Options:
model: Specific HuggingFace model to useauto_download: Auto-download model if missing (default: True)
๐ Web Server
# Start web server
uvicorn bielik.server:app --port 8000
# Or with Docker
docker-compose --profile minimal up bielik-minimal
Endpoints:
POST /chat- JSON chat endpointWS /ws- WebSocket real-time chatGET /models- List available models
Example request:
{"messages": [{"role":"user","content":"Czeลฤ! Jak siฤ masz?"}]}
๐ณ Docker Usage
Quick Testing:
# Test minimal version
docker run -it bielik:minimal
# Test full version with GPU
docker run --gpus all -it bielik:full
With persistent storage:
# Minimal with model persistence
docker run -it -v $(pwd)/models:/app/models bielik:minimal
# Full with models and images
docker run -it \
-v $(pwd)/models:/app/models \
-v $(pwd)/images:/app/images \
bielik:full
Development setup:
# Clone and test
git clone https://github.com/tom-sapletta-com/bielik.git
cd bielik
# Run automated tests
docker-compose --profile test up test-runner
# Interactive development
docker-compose --profile minimal run --rm bielik-minimal bash
๐ง Environment Variables
Core Settings:
BIELIK_CLI_USERNAMEโ Your display name in CLI (auto-detected from system)BIELIK_CLI_CURRENT_MODELโ Currently selected modelBIELIK_CLI_ASSISTANT_NAMEโ Assistant display name (auto-set from model)BIELIK_CLI_AUTO_SWITCHโ Auto-switch to newly downloaded models (default: true)
Storage & Cache:
BIELIK_MODELS_DIRโ Local model storage directoryBIELIK_DATA_DIRโ User data and settings directoryHF_HOMEโ HuggingFace cache directory
Docker Environment:
BIELIK_MODEโminimalorfull(Docker only)BIELIK_IMAGES_DIRโ Images directory for analysis (full version)
๐ ๏ธ Troubleshooting
Installation Issues
Problem: Minimal version works but vision features don't
# Upgrade to full version
pip install bielik[vision]
# Verify vision packages
python -c "import PIL, transformers; print('Vision packages OK')"
Problem: Model download fails or times out
# Check HuggingFace connectivity
python -c "from huggingface_hub import HfApi; print('HF connection OK')"
# Check available disk space (models are 2-8GB)
df -h
# Manual download with timeout
:download speakleash/bielik-4.5b-v3.0-instruct
Problem: "No models available" on first startup
# Download a model manually
python -m bielik
:models
:download speakleash/bielik-4.5b-v3.0-instruct
Runtime Issues
Problem: Model responses are slow or use too much memory
# Use smaller model
:switch speakleash/bielik-4.5b-v3.0-instruct # instead of 7b
# Check system resources
htop # Linux/macOS
taskmgr # Windows
# Enable GPU acceleration (full version)
pip install bielik[gpu]
Problem: Image analysis not working
# Check if vision packages installed
python -c "from bielik.image_analyzer import ImageAnalyzer; ia = ImageAnalyzer(); print(f'Available: {ia.is_available()}')"
# Install vision support
pip install bielik[vision]
Problem: CLI settings not persisting
# Check .env file creation
ls -la ~/.bielik/ || ls -la ./
# Reset settings
:name YourName
:settings
Docker Issues
Problem: Docker containers fail to start
# Build images manually
docker build -f docker/Dockerfile.minimal -t bielik:minimal .
docker build -f docker/Dockerfile.full -t bielik:full .
# Check container logs
docker logs bielik-minimal
Problem: Models not persisting between Docker runs
# Use volume mounts
docker run -v $(pwd)/models:/app/models bielik:minimal
# Or use Docker Compose
docker-compose --profile minimal up
Getting Help
- GitHub Issues: Report bugs and feature requests
- Command Help:
python -m bielik --helpor:helpin CLI - Test Environment: Use Docker for isolated testing
- Check Status: Use
:settingscommand for current configuration
๐ Development
git clone https://github.com/tom-sapletta-com/bielik.git
cd bielik
python -m venv .venv
source .venv/bin/activate
pip install -e .[ollama]
๐ Package Structure
bielik/
โโโ bielik/
โ โโโ __init__.py # Package initialization
โ โโโ cli.py # CLI entry point (wrapper)
โ โโโ client.py # Client entry point (wrapper)
โ โโโ server.py # FastAPI web server
โ โโโ config.py # Configuration management
โ โโโ hf_models.py # Hugging Face model management
โ โโโ content_processor.py # Content processing utilities
โ โโโ cli/ # Modular CLI components
โ โ โโโ __init__.py
โ โ โโโ main.py # Main CLI entry and argument parsing
โ โ โโโ commands.py # Command processing and execution
โ โ โโโ models.py # HF model management CLI
โ โ โโโ setup.py # Interactive setup manager
โ โ โโโ send_chat.py # Chat communication handling
โ โโโ client/ # Modular client components
โ โโโ __init__.py # Client package exports
โ โโโ core.py # Core BielikClient class
โ โโโ model_manager.py # HF model operations for client
โ โโโ utils.py # Client utility functions
โโโ tests/
โ โโโ __init__.py
โ โโโ test_cli.py # CLI unit tests
โ โโโ test_server.py # Server unit tests
โโโ pyproject.toml # Modern Python packaging
โโโ setup.cfg # Package configuration
โโโ MANIFEST.in # Package manifest
โโโ LICENSE # Apache 2.0 license
โโโ README.md # This documentation
โโโ Makefile # Development automation
โโโ todo.md # Project specifications
โโโ .github/workflows/ # CI/CD automation
โโโ python-publish.yml
๐ License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bielik-0.1.7.tar.gz.
File metadata
- Download URL: bielik-0.1.7.tar.gz
- Upload date:
- Size: 55.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e850beff605097ea71711715db7d9f654c20eba14907385fb8385866943c7854
|
|
| MD5 |
0dc313014a441e3c377989eed6537592
|
|
| BLAKE2b-256 |
f3f22a428fc48a9045d3591942f61d9b63a0cff09cdd3b5b3f025204af9484fc
|
File details
Details for the file bielik-0.1.7-py3-none-any.whl.
File metadata
- Download URL: bielik-0.1.7-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5e7e6908ce5944b0e69c912f9475ff981e8ca3aa6ee7233b117ea753b8431da
|
|
| MD5 |
c334363ca6a1dbb9da867ee2be23bdf3
|
|
| BLAKE2b-256 |
e7e3eb4259b77a639f88c6bd9d13f8e508596f2d6cdff9e5147f8dd94eaf007d
|