ربط TinyClaw مع نماذج LLM محلية مجانية متعددة وأنظمة متعددة – دليل عملي شامل 🦞

في هذا المقال، سنشرح بالتفصيل كيفية ربط TinyClaw بنماذج LLM محلية مجانية، وتشغيل أنظمة متعددة في نفس الوقت، وإنشاء فرق حقيقية بمهام محددة.
🧠 الجزء الأول: نماذج LLM المحلية المجانية
أفضل النماذج المتاحة
| النموذج | الحجم | الوصف | موقع التحميل |
|---|---|---|---|
| Llama 3 | 8B/70B | من Meta، أداء عالي | ollama.com |
| Mistral | 7B | مفتوح المصدر، سريع | ollama.com |
| Gemma | 2B/7B | من Google، خفيف | ollama.com |
| Phi-3 | 3.8B | من Microsoft، فعال | ollama.com |
| Codellama | 7B/34B | مخصص للبرمجة | ollama.com |
🔧 الجزء الثاني: التثبيت والإعداد
1. تثبيت Ollama (منصة النماذج)
# على Linux
curl -fsSL https://ollama.com/install | bash
# على Mac
brew install ollama
# على Windows
# حمل من ollama.com
2. تحميل النماذج
# تحميل Llama 3
ollama pull llama3
# تحميل Mistral
ollama pull mistral
# تحميل Codellama (للبرمجة)
ollama pull codellama
# تحميل Phi-3
ollama pull phi3
3. تشغيل Ollama كخدمة
# تشغيل الخادم
ollama serve
# التأكد من تشغيله
curl http://localhost:11434/api/version
🔗 الجزء الثالث: ربط TinyClaw بالنماذج المحلية
طريقة 1: استخدام Custom Provider
nano ~/.tinyclaw/settings.json
# أضف:
{
"custom_providers": {
"local_llama": {
"name": "Local Llama 3",
"harness": "claude",
"base_url": "http://localhost:11434/v1",
"api_key": "dummy-key",
"model": "llama3"
},
"local_coder": {
"name": "Local CodeLLaMa",
"harness": "claude",
"base_url": "http://localhost:11434/v1",
"api_key": "dummy-key",
"model": "codellama"
}
}
}
طريقة 2: استخدام OpenAI Compatible
{
"custom_providers": {
"ollama_mistral": {
"name": "Ollama Mistral",
"harness": "openai",
"base_url": "http://localhost:11434/v1",
"api_key": "not-needed",
"model": "mistral"
}
}
}
🏢 الجزء الرابع: تشغيل أنظمة متعددة في نفس الوقت
مثال 1: نظامين متوازيين
# النظام الأول: دعم العملاء
tinyclaw agent add
# Agent ID: support
# Provider: local_llama
# Model: llama3
# النظام الثاني: البرمجة
tinyclaw agent add
# Agent ID: coder
# Provider: local_coder
# Model: codellama
# تشغيلهم معاً!
tinyclaw start
مثال 2: 3 أنظمة مختلفة
# 1. نظام الأسئلة العامة
tinyclaw agent add general
# يستخدم: llama3 (أسئلة عامة)
# 2. نظام البرمجة
tinyclaw agent add coder
# يستخدم: codellama (كود)
# 3. نظام الترجمة
tinyclaw agent add translator
# يستخدم: mistral (ترجمة)
👥 الجزء الخامس: إنشاء فرق حقيقية بمهام محددة
مثال 1: فريق تطوير برمجيات
# إنشاء الفريق
tinyclaw team add dev_team
# إضافة الوكلاء
tinyclaw team add-agent dev_team coder
tinyclaw team add-agent dev_team reviewer
tinyclaw team add-agent dev_team writer
# تعيين القائد
tinyclaw team leader dev_team coder
وظائف كل عضو:
| الوكيل | المهمة | النموذج |
|---|---|---|
| coder | كتابة الكود | codellama |
| reviewer | مراجعة الكود | llama3 |
| writer | كتابة التوثيق | mistral |
مثال 2: فريق تسويق رقمي
# إنشاء الفريق
tinyclaw team add marketing
# إضافة الوكلاء
tinyclaw team add-agent marketing content_writer
tinyclaw team add-agent marketing seo_expert
tinyclaw team add-agent marketing designer
tinyclaw team add-agent marketing analytics
وظائف الفريق:
| الوكيل | المهمة | النموذج |
|---|---|---|
| content_writer | كتابة المحتوى | llama3 |
| seo_expert | تحسين محركات البحث | mistral |
| designer | إنشاء الصور (وصف) | gemma |
| analytics | تحليل البيانات | phi3 |
مثال 3: فريق دعم عملاء متعدد اللغات
# إنشاء الفريق add support_multi
# فريق الدعم
tinyclaw team add-agent support_multi arabic_support # Llama 3 (ع
tinyclaw teamربي)
tinyclaw team add-agent support_multi english_support # Llama 3 (إنجليزي)
tinyclaw team add-agent support_multi french_support # Mistral (فرنسي)
💡 الجزء السادس: أمثلة عملية حقيقية
مثال 1: طلب برمجي
@dev_team Write a Python function to connect to MySQL database and perform CRUD operationsالنتيجة:
- coder يكتب الكود
- reviewer يراجعه
- writer يوثقه
مثال 2: طلب تسويقي
@marketing Write a marketing campaign for a new product launch in Egyptالنتيجة:
- content_writer يكتب المحتوى
- seo_expert يحسن SEO
- designer يصف الصور المطلوبة
مثال 3: طلب دعم
@support_multi I need help with my order #12345النتيجة:
- arabic_support يرد بالعربية
⚙️ الجزء السابع: إعدادات متقدمة
1. تخصيص سلوك كل وكيل
# تعديل الإعدادات nano ~/tinyclaw-workspace/coder/AGENTS.md # أضف: # Role: Senior Python Developer # Expertise: Django, FastAPI, PostgreSQL # Code Style: PEP 8, Type Hints2. إضافة معرفة خاصة
# إنشاء قاعدة معرفة mkdir -p ~/tinyclaw-workspace/coder/knowledge nano ~/tinyclaw-workspace/coder/knowledge/company.md # أضف معلومات شركتك3. Heartbeat للتتبع
# إعداد Heartbeat nano ~/tinyclaw-workspace/coder/heartbeat.md # راجع المهام المعلقة والأخطاء📊 الجزء الثامن: إدارة فرق متعددة
# قائمة الفرق tinyclaw team list # معلومات كل فريق tinyclaw team show dev_team tinyclaw team show marketing tinyclaw team show support_multi # التبديل بين الفرق @dev_team Write a REST API @marketing Create ad copy @support_multi Help with billing🎯 الخلاصة
- ✅ نماذج مجانية: Llama 3, Mistral, CodeLLaMa, Phi-3
- ✅ تشغيل متوازي: عدة أنظمة في نفس الوقت
- ✅ فرق متخصصة: تطوير، تسويق، دعم
- ✅ تكلفة صفر: نماذج محلية مجانية
🔗 روابط مفيدة
