idun-gguf β Lokaler GGUF Tool-Agent
idun-gguf ist ein voll funktionsfΓ€higer lokaler Tool-Agent, der das Pattern von idun-sdk 1:1 spiegelt β aber mit lokalen GGUF-Modellen via Ollama statt Azure Cloud.
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β idun-gguf CLI / Python / MCP β
β (OpenAI-kompatibler Client, stdlib-only) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Ollama (localhost:11434) β
β qwen3:8b (GGUF, Q4_K_M) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tool Registry (7 Tools) β
β web_search memory file_ops code_executor β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Full Agent Trajectory Output β
β .text (final answer) + .steps (Schritte) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
Features
| Feature | Beschreibung |
|---|---|
| CLI | idun-gguf chat (finale Antwort), idun-gguf trace (voller Trajectory) |
| Python | IdunLocalClient().complete(prompt) β .text + .steps |
| MCP Server | stdio MCP Server mit idun_chat + idun_trace Tools |
| 7 Tools | web_search, memory_search, memory_save, file_read, file_write, file_list, code_executor |
| 100% Lokal | Kein API-Key, kein Cloud-Dienst, keine Datenverlassen dein Netz |
| Trajectory | VollstΓ€ndiger Agent-Pfad (Reasoning, Tool-Calls, Ergebnisse) |
| CPU-freundlich | qwen3:8b (Q4_K_M, 5.2GB) lΓ€uft auf CPU |
Voraussetzungen
- Python β₯ 3.10
- Ollama (siehe Setup)
- ~8GB freier RAM (fΓΌr qwen3:8b)
- ~5.2GB Festplatte (fΓΌr das Modell)
Installation
1. Ollama installieren
curl -fsSL https://ollama.com/install.sh | sh
2. Ollama Server starten
ollama serve &
3. Modell pullen
ollama pull qwen3:8b
Hinweis:
qwen3:8bhat exzellentes Tool-Calling (5.2GB, Q4_K_M).
Alternativen:qwen3:14b,llama3.1:8b,mistral-nemo:12b
4. idun-gguf installieren
# Aus dem Projektverzeichnis
cd /app/idun_gguf_integration_1709
pip install -e .
# Oder direkt
pip install -e /app/idun_gguf_integration_1709/
5. AbhΓ€ngigkeiten
pip install duckduckgo-search chromadb click
Quick Start
CLI
# Einfache Frage (finale Antwort)
idun-gguf chat "Was ist Python?"
# VollstΓ€ndigen Agent-Trajectory anzeigen
idun-gguf trace "Was ist Python?"
# VerfΓΌgbare Tools auflisten
idun-gguf tools
# Aktuelles Modell anzeigen
idun-gguf model
Python Client
from idun_gguf import IdunLocalClient, Response
# Client erstellen
client = IdunLocalClient()
# Einfache Antwort
response = client.complete("Was ist Python?")
print(response.text) # Finale Antwort
print(len(response.steps)) # Anzahl Schritte
# Mit Trajectory
for step in response.steps:
print(f"[{step.type}] {step.content}")
if step.type == "tool_call":
print(f" β Tool: {step.tool_name}, Input: {step.tool_input}")
if step.type == "tool_result":
print(f" β Ergebnis: {step.tool_output[:100]}...")
MCP Server
# Tools auflisten
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | \
python3 -m idun_gguf.mcp_server
# idun_chat aufrufen
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"idun_chat","arguments":{"prompt":"Was ist Python?"}},"id":2}' | \
python3 -m idun_gguf.mcp_server
CLI Commands
idun-gguf chat
FΓΌhrt eine Anfrage aus und zeigt die finale Antwort.
# Mit Prompt als Argument
idun-gguf chat "Was ist Python?"
# Mit System-Prompt
idun-gguf chat "ErklΓ€re ML" --system "Du bist ein ML-Experte"
# Als JSON-Ausgabe
idun-gguf chat "Hallo" --json
# Mit anderem Modell
idun-gguf chat "Hallo" --model llama3.1:8b
idun-gguf trace
FΓΌhrt eine Anfrage aus und zeigt den vollstΓ€ndigen Agent-Trajectory.
# VollstΓ€ndigen Trace anzeigen
idun-gguf trace "Was ist Python?"
# Als JSON-Ausgabe
idun-gguf trace "Hallo" --json
idun-gguf tools
Listet alle verfΓΌgbaren Tools mit ihren Parametern.
idun-gguf tools
idun-gguf model
Zeigt das aktuell verwendete Modell und die Ollama-URL.
idun-gguf model
Tools
| Tool | Beschreibung | Parameter |
|---|---|---|
web_search |
DuckDuckGo-Websuche | query, max_results |
memory_search |
Vektor-GedΓ€chtnis durchsuchen | query, n_results |
memory_save |
Info im Vektor-GedΓ€chtnis speichern | text, source |
file_read |
Datei lesen | path, max_lines |
file_write |
Datei schreiben | path, content |
file_list |
Verzeichnis auflisten | path, pattern |
code_executor |
Python-Code ausfΓΌhren | code, timeout |
Architektur
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β idun-gguf Package β
β β
β βββββββββββββββ βββββββββββββββββββ β
β β cli.py β β mcp_server.py β β
β β (Click) β β (JSON-RPC) β β
β ββββββββ¬βββββββ ββββββββββ¬βββββββββ β
β β β β
β ββββββββ΄βββββββββββββββββββ΄βββββββββ β
β β client.py β β
β β IdunLocalClient: .complete() β β
β β β Response(.text, .steps) β β
β βββββββββββββββββ¬βββββββββββββββββββ β
β β β
β βββββββββββββββββ΄βββββββββββββββββββ β
β β Tool Registry β β
β β web_search β memory β file_ops β β
β β code_executor β β
β ββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Ollama (localhost) β
β qwen3:8b (GGUF) β
β OpenAI-kompatible API β
βββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β GGUF Model (Q4_K_M) β
β ~5.2GB, CPU-Inference β
βββββββββββββββββββββββββ
Datenfluss
- User gibt Prompt ein (CLI / Python / MCP)
- IdunLocalClient sendet Prompt + Tool-Definitionen an Ollama
- Ollama fΓΌhrt das GGUF-Modell aus (qwen3:8b)
- Modell entscheidet: Antwort geben oder Tool aufrufen
- Tool Registry fΓΌhrt Tool-Calls aus (web_search, memory, etc.)
- Ergebnisse werden zurΓΌck ans Modell gegeben
- Loop wiederholt bis finale Antwort
- Response mit
.text(finale Antwort) +.steps(vollstΓ€ndiger Trajectory)
Umgebungsvariablen
| Variable | Default | Beschreibung |
|---|---|---|
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama Server-URL |
IDUN_GGUF_MODEL |
qwen3:8b |
Standard-Modell |
Projekte vergleichen
| Aspekt | idun-sdk (Azure) | idun-gguf (Lokal) |
|---|---|---|
| Backend | Azure AI Foundry | Ollama + GGUF |
| Modell | NatureLM-Idun-5-MoE | qwen3:8b (austauschbar) |
| Latenz | 2-10s (Cloud) | 30-120s (CPU) |
| Kosten | Pay-per-Token | Kostenlos (Strom) |
| Datenschutz | Cloud | 100% Lokal |
| Offline | β | β |
| Tools | web_search, memory_search | 7 Tools (erweiterbar) |
| Trajectory | β .text + .steps | β .text + .steps |
Troubleshooting
Ollama lΓ€uft nicht
# PrΓΌfen
curl http://localhost:11434/api/tags
# Neustarten
ollama serve &
Modell nicht gefunden
ollama list # PrΓΌfen ob qwen3:8b gelistet ist
ollama pull qwen3:8b # Falls nicht
Package-Import-Fehler
pip install -e /app/idun_gguf_integration_1709/ --force-reinstall
ChromaDB-Fehler
# ChromaDB persistiert in ~/.idun_gguf_memory/
# Bei Problemen: rm -rf ~/.idun_gguf_memory/
Entwicklung
# Repository klonen
git clone https://huggingface.co/Qapdex/Idun-5-MoE-sdk-GGUF
cd idun-gguf
# Entwicklungsmodus
pip install -e .
# Tests
python -m pytest tests/
Lizenz
MIT
Verwandte Projekte
- idun-sdk β Thin Client fΓΌr NatureLM-Idun-5-MoE auf Azure
- idun-gguf auf HuggingFace β Thin Client fΓΌr NatureLM-Idun-5-MoE auf Azure
- Ollama β Lokale LLM-Inference
- idun-agent-platform β Produktions-Runtime fΓΌr Agenten