
Miniautogen เป็นห้องสมุดโอเพนซอร์ซที่เป็นนวัตกรรมที่ออกแบบมาสำหรับแอพพลิเคชั่นรุ่นต่อไปในรูปแบบภาษาขนาดใหญ่ (LLMS) มุ่งเน้นไปที่การเปิดใช้งานการสนทนาหลายตัวแทน Miniautogen ได้รับการเฉลิมฉลองสำหรับโครงสร้างที่มีน้ำหนักเบาและยืดหยุ่น เหมาะอย่างยิ่งสำหรับนักพัฒนาและนักวิจัยที่ตั้งเป้าหมายที่จะสำรวจและขยายขอบเขตของการสนทนา AI
การวาดแรงบันดาลใจจาก Autogen, Miniautogen นำเสนอชุดเครื่องมือที่ครอบคลุม:
chat ): อำนวยความสะดวกในการสร้างและการจัดการการสนทนาหลายตัวแทนchatadmin ): ทำให้มั่นใจได้ว่าการซิงโครไนซ์และการจัดการตัวแทนที่มีประสิทธิภาพagent ): ให้ความยืดหยุ่นในการปรับแต่งตัวแทนตามความต้องการเฉพาะpipeline ): การทำงานของตัวแทนอัตโนมัติและปรับปรุงการทำงานของตัวแทนเพิ่มความสามารถในการปรับขนาดและการบำรุงรักษาการผสมผสาน Litellm, Miniautogen รวมเข้ากับ LLM มากกว่า 100 LLM แล้ว ใช้ข้อเท็จจริง, 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()
การสนทนาหลายตัวแทนเป็นตัวแทนของการโต้ตอบที่เกี่ยวข้องกับตัวแทนหลายคนไม่ว่าจะเป็นอิสระหรือมนุษย์แต่ละคนมีความเป็นอิสระและความสามารถพิเศษ พวกเขาทำงานร่วมกันเพื่อแก้ปัญหาที่ซับซ้อนแบ่งปันข้อมูลหรือปฏิบัติงานเฉพาะ
ในตัวอย่างนี้เราจะตั้งค่าการสนทนาระหว่างตัวแทนสองคน: หนึ่งเล่นบทบาทของเจ้าของผลิตภัณฑ์และอีกคนที่ทำหน้าที่เป็นผู้เชี่ยวชาญในการพัฒนาส่วนประกอบ miniautogen ใน Python
เป้าหมายหลักของการทดสอบนี้คือการแสดงให้เห็นถึงความยืดหยุ่นความสะดวกและประสิทธิภาพของ miniautogen ในการสร้างและประสานงานการสนทนาหลายตัวแทนรวมถึงความเรียบง่ายในการพัฒนาส่วนประกอบใหม่ด้วยการออกแบบที่ยืดหยุ่นของห้องสมุด
ประวัติการสนทนาที่สมบูรณ์: chat_history.md
ดูสมุดบันทึกที่นี่
สำหรับข้อมูลเชิงลึกและแรงบันดาลใจเพิ่มเติมเยี่ยมชมโฟลเดอร์ตัวอย่างของเรา ที่นี่คุณจะพบกับสถานการณ์ที่หลากหลายที่แสดงให้เห็นถึงความเก่งกาจและความสามารถของ miniautogen ในบริบทที่แตกต่างกัน
เราขอเชิญชวนผู้ที่ชื่นชอบ AI นักพัฒนาและนักวิจัยให้มีส่วนร่วมและกำหนดอนาคตของการสนทนาหลายตัวแทน ความเชี่ยวชาญของคุณสามารถช่วยพัฒนา miniautogen สร้างแอพพลิเคชั่นที่แข็งแกร่งและหลากหลายมากขึ้น
ดูเพิ่มเติม: มีส่วนร่วม
Miniautogen: บุกเบิกอนาคตของการสนทนาที่ชาญฉลาดและโต้ตอบ