
Miniautogen هي مكتبة مبتكرة مفتوحة المصدر مصممة للجيل القادم من التطبيقات في نماذج اللغة الكبيرة (LLMS). يركز على تمكين محادثات متعددة الوكلاء ، يتم الاحتفال بالميناء من أجل بنيته الخفيفة والمرنة. إنه مثالي للمطورين والباحثين الذين يهدفون إلى استكشاف وتوسيع حدود الذكاء الاصطناعي للمحادثة.
يستلهم Miniautogen ، الرسم من Autogen ، مجموعة شاملة من الأدوات:
chat ): يسهل إنشاء وإدارة المحادثات متعددة الوكلاء.chatadmin ): يضمن التزامن وإدارة الوكلاء الفعال.agent ): يوفر المرونة في تخصيص الوكلاء وفقًا للاحتياجات المحددة.pipeline ): عمليات الأتمتة وتبسيط عمليات وكيل ، وتعزيز قابلية التوسع والصيانة.دمج Litellm ، يتكامل Miniautogen بالفعل مع أكثر من 100 LLMs. استخدم الأساس ، Azure ، Openai ، Cohere ، Anthropic ، Ollama ، Sagemaker ، Huggingface ، تكرار.
agent .استكشاف مجموعة متنوعة من المكونات التي تم بناؤها مسبقًا ، متوفرة هنا.
تثبيت pip install miniautogen
iniciate دردشة مع LLM
#Initializing LLM Clients
import os
os.environ["OPENAI_API_KEY"] = "your-openai-key"
from miniautogen.llms.llm_client import LiteLLMClient
openai_client = LiteLLMClient(model='gpt-3.5-turbo-16k')
# Building the Chat Environment
from miniautogen.chat.chat import Chat
from miniautogen.agent.agent import Agent
from miniautogen.chat.chatadmin import ChatAdmin
from miniautogen.pipeline.pipeline import Pipeline
from miniautogen.pipeline.components.components import (
UserResponseComponent, AgentReplyComponent, TerminateChatComponent,
Jinja2SingleTemplateComponent, LLMResponseComponent, NextAgentSelectorComponent
)
# Define a Jinja2 template for formatting messages
template_str = """
[{"role": "system", "content": "{{ agent.role }}"}{% for message in messages %},
{% if message.sender_id == agent.agent_id %}
{"role": "assistant", "content": {{ message.message | tojson | safe }}}
{% else %}
{"role": "user", "content": {{ message.message | tojson | safe }}}
{% endif %}
{% endfor %}]
"""
# Initialize Jinja2 component with the template
jinja_component = Jinja2SingleTemplateComponent()
jinja_component.set_template_str(template_str)
# Set up pipelines for different components
pipeline_user = Pipeline([UserResponseComponent()])
pipeline_jinja = Pipeline([jinja_component, LLMResponseComponent(litellm_client)])
pipeline_admin = Pipeline([NextAgentSelectorComponent(), AgentReplyComponent(), TerminateChatComponent()])
# Create the chat environment
chat = Chat()
# Define agents with JSON data
json_data = {'agent_id': 'Bruno', 'name': 'Bruno', 'role': 'user'}
agent1 = Agent.from_json(json_data)
agent1.pipeline = pipeline_user # Assign the user pipeline to agent1
agent2 = Agent("dev", "Carlos", "Python Senior Developer")
agent2.pipeline = pipeline_jinja # Assign the LLM pipeline to agent2
# Add agents to the chat
chat.add_agent(agent1)
chat.add_agent(agent2)
# Add test messages to the chat
json_messages = [{'sender_id': 'Bruno', 'message': 'It’s a test, don’t worry'}]
chat.add_messages(json_messages)
# Initialize and configure ChatAdmin
chat_admin = ChatAdmin("admin", "Admin", "admin_role", pipeline_admin, chat, 10)
#running the chat
chat_admin.run()
تمثل المحادثات متعددة الوكلاء التفاعلات التي تنطوي على عوامل متعددة ، سواء كانت مستقلة أو إنسانية ، كل منها يتمتع بالاستقلالية والقدرات المتخصصة. إنها تعمل معًا لحل المشكلات المعقدة أو مشاركة المعلومات أو أداء مهام محددة.
في هذا المثال ، سنقوم بإنشاء محادثة بين وكيلين: أحدهما يلعب دور مالك المنتج والآخر يتصرف كخبير في تطوير مكونات الجينات الصغيرة في بيثون.
الهدف الرئيسي من هذا الاختبار هو إظهار المرونة وسهولة وكفاءة المصغرة في إنشاء وتنسيق محادثات متعددة الوكلاء ، وكذلك البساطة في تطوير مكونات جديدة ، وذلك بفضل التصميم المرن للمكتبة.
تاريخ المحادثة الكامل: chat_history.md
عرض دفتر الملاحظات هنا
للحصول على رؤى إضافية وإلهام ، تفضل بزيارة مجلد الأمثلة. هنا ، ستجد مجموعة متنوعة من السيناريوهات التي توضح براعة وقدرات المصغرة في سياقات مختلفة.
ندعو عشاق الذكاء الاصطناعي والمطورين والباحثين للمساهمة وتشكيل مستقبل المحادثات متعددة الوكلاء. يمكن أن تساعد خبرتك في تطوير الجينات الصغيرة ، مما يخلق تطبيقات أكثر قوة ومتنوعة.
انظر المزيد: المساهمة
Miniautogen: الرائدة في مستقبل المحادثات التفاعلية الذكية.