เฟรมเวิร์กที่ยืดหยุ่นและทรงพลังสำหรับการจัดการตัวแทน AI หลายตัวและจัดการการสนทนาที่ซับซ้อน
Orchestrator Multi-Agent เป็นกรอบความยืดหยุ่นสำหรับการจัดการตัวแทน AI หลายตัวและการจัดการการสนทนาที่ซับซ้อน มันกำหนดเส้นทางอย่างชาญฉลาดและรักษาบริบทในการโต้ตอบ
ระบบนำเสนอส่วนประกอบที่สร้างไว้ล่วงหน้าสำหรับการปรับใช้อย่างรวดเร็วในขณะที่ยังช่วยให้การรวมตัวแทนที่กำหนดเองและโซลูชั่นการจัดเก็บข้อความการสนทนาได้ง่าย
การปรับตัวนี้ทำให้เหมาะสำหรับแอพพลิเคชั่นที่หลากหลายตั้งแต่ chatbots ง่าย ๆ ไปจนถึงระบบ AI ที่ซับซ้อนรองรับความต้องการที่หลากหลายและการปรับขนาดได้อย่างมีประสิทธิภาพ
เพื่อให้ได้รับความรู้สึกอย่างรวดเร็วสำหรับผู้ประกอบวงดนตรีหลายตัวแทนเราได้จัดเตรียมแอพสาธิตให้กับตัวแทนพื้นฐานบางอย่าง การสาธิตแบบโต้ตอบนี้แสดงความสามารถของ Orchestrator ในอินเทอร์เฟซที่ใช้งานง่าย หากต้องการเรียนรู้เพิ่มเติมเกี่ยวกับการตั้งค่าและเรียกใช้แอพสาธิตโปรดดูส่วนแอพสาธิตของเรา
ในการบันทึกหน้าจอด้านล่างเราแสดงให้เห็นถึงแอพสาธิตรุ่นต่อไปที่ใช้ตัวแทนพิเศษ 6 ตัว:
ดูในขณะที่ระบบสลับบริบทระหว่างหัวข้อที่หลากหลายตั้งแต่การจองเที่ยวบินไปจนถึงการตรวจสอบสภาพอากาศการแก้ปัญหาทางคณิตศาสตร์และการให้ข้อมูลด้านสุขภาพ ขอให้สังเกตว่าตัวแทนที่เหมาะสมถูกเลือกอย่างไรสำหรับแต่ละการสืบค้นรักษาความเชื่อมโยงกันแม้จะมีอินพุตติดตามสั้น ๆ
การสาธิตเน้นถึงความสามารถของระบบในการจัดการการสนทนาที่ซับซ้อนหลายครั้งในขณะที่รักษาบริบทและใช้ประโยชน์จากตัวแทนพิเศษในโดเมนต่าง ๆ
หากต้องการรับความรู้สึกอย่างรวดเร็วสำหรับผู้ประกอบวงดนตรีหลายตัวแทนลองดูแอพสาธิตของเรา ตัวอย่างรหัสเพิ่มเติมมีอยู่ในทั้งเอกสารและโฟลเดอร์ examples
รับประสบการณ์ตรงกับผู้ดำเนินการหลายตัวแทนผ่านชุดตัวอย่างที่หลากหลายของเรา:
examples
:chat-demo-app
: อินเทอร์เฟซแชทบนเว็บพร้อมตัวแทนพิเศษหลายตัวecommerce-support-simulator
: ระบบสนับสนุนลูกค้าที่ขับเคลื่อนด้วย AIchat-chainlit-app
: แอปพลิเคชันแชทที่สร้างขึ้นด้วย chainlitfast-api-streaming
: การใช้งาน Fastapi พร้อมการสนับสนุนสตรีมมิ่งtext-2-structured-output
: ภาษาธรรมชาติไปยังข้อมูลที่มีโครงสร้างbedrock-inline-agents
: ตัวอย่างตัวแทนอินไลน์ของข้อเท็จจริงตัวอย่างทั้งหมดมีอยู่ในการใช้งาน Python และ TypeScript ตรวจสอบเอกสารของเราสำหรับคำแนะนำที่ครอบคลุมเกี่ยวกับการตั้งค่าและการใช้ Orchestrator หลายตัวแทน!
ค้นพบการใช้งานที่สร้างสรรค์และแอพพลิเคชั่นที่หลากหลายของ Orchestrator Multi-Agent:
จาก 'Bonjour' ถึง 'Boarding Pass': AI chatbot หลายภาษาสำหรับการจองเที่ยวบิน
บทความนี้แสดงให้เห็นถึงวิธีการสร้างแชทบ็อตหลายภาษาโดยใช้กรอบการทำงานแบบหลายตัวแทน บทความอธิบายวิธีการใช้ Amazon Lex Bot เป็นตัวแทนพร้อมกับตัวแทนใหม่อีก 2 ตัวเพื่อให้มันทำงานในหลายภาษาด้วยรหัสเพียงไม่กี่บรรทัด
Beyond Auto-Replies: การสร้างระบบสนับสนุนอีคอมเมิร์ซ AI ที่ขับเคลื่อนด้วย AI
บทความนี้แสดงให้เห็นถึงวิธีการสร้างระบบหลายตัวแทนที่ขับเคลื่อนด้วย AI สำหรับการสนับสนุนอีเมลลูกค้าอีคอมเมิร์ซอัตโนมัติ มันครอบคลุมสถาปัตยกรรมและการตั้งค่าตัวแทน AI เฉพาะทางโดยใช้เฟรมเวิร์ก Orchestrator Multi-Agent โดยรวมการประมวลผลอัตโนมัติเข้ากับการกำกับดูแลของมนุษย์ในวง คู่มือสำรวจการบริโภคอีเมลการกำหนดเส้นทางอัจฉริยะการสร้างการตอบสนองอัตโนมัติและการตรวจสอบของมนุษย์ซึ่งเป็นวิธีการที่ครอบคลุมในการสร้างสมดุลให้กับประสิทธิภาพของ AI กับความเชี่ยวชาญของมนุษย์ในการสนับสนุนลูกค้า
พูดออกมา AI: เปล่งเสียงตัวแทนของคุณด้วย Amazon Connect, Lex และ Bedrock
บทความนี้แสดงให้เห็นถึงวิธีการสร้างศูนย์บริการลูกค้า AI มันครอบคลุมสถาปัตยกรรมและการตั้งค่าของตัวแทน AI พิเศษโดยใช้เฟรมเวิร์ก Orchestrator Multi-Agent ที่มีปฏิสัมพันธ์กับเสียงผ่าน Amazon Connect และ Amazon Lex
npm install multi-agent-orchestrator
ตัวอย่างต่อไปนี้แสดงให้เห็นถึงวิธีการใช้ Orchestrator หลายตัวแทนที่มีตัวแทนสองประเภทที่แตกต่างกัน: ตัวแทน LLM ของข้อเท็จจริงที่มีการสนับสนุน API Converse และ Agent Lex Bot สิ่งนี้แสดงให้เห็นถึงความยืดหยุ่นของระบบในการรวมบริการ AI ต่างๆ
import { MultiAgentOrchestrator , BedrockLLMAgent , LexBotAgent } from "multi-agent-orchestrator" ;
const orchestrator = new MultiAgentOrchestrator ( ) ;
// Add a Bedrock LLM Agent with Converse API support
orchestrator . addAgent (
new BedrockLLMAgent ( {
name : "Tech Agent" ,
description :
"Specializes in technology areas including software development, hardware, AI, cybersecurity, blockchain, cloud computing, emerging tech innovations, and pricing/costs related to technology products and services." ,
streaming : true
} )
) ;
// Add a Lex Bot Agent for handling travel-related queries
orchestrator . addAgent (
new LexBotAgent ( {
name : "Travel Agent" ,
description : "Helps users book and manage their flight reservations" ,
botId : process . env . LEX_BOT_ID ,
botAliasId : process . env . LEX_BOT_ALIAS_ID ,
localeId : "en_US" ,
} )
) ;
// Example usage
const response = await orchestrator . routeRequest (
"I want to book a flight" ,
'user123' ,
'session456'
) ;
// Handle the response (streaming or non-streaming)
if ( response . streaming == true ) {
console . log ( "n** RESPONSE STREAMING ** n" ) ;
// Send metadata immediately
console . log ( `> Agent ID: ${ response . metadata . agentId } ` ) ;
console . log ( `> Agent Name: ${ response . metadata . agentName } ` ) ;
console . log ( `> User Input: ${ response . metadata . userInput } ` ) ;
console . log ( `> User ID: ${ response . metadata . userId } ` ) ;
console . log ( `> Session ID: ${ response . metadata . sessionId } ` ) ;
console . log (
`> Additional Parameters:` ,
response . metadata . additionalParams
) ;
console . log ( `n> Response: ` ) ;
// Stream the content
for await ( const chunk of response . output ) {
if ( typeof chunk === "string" ) {
process . stdout . write ( chunk ) ;
} else {
console . error ( "Received unexpected chunk type:" , typeof chunk ) ;
}
}
} else {
// Handle non-streaming response (AgentProcessingResult)
console . log ( "n** RESPONSE ** n" ) ;
console . log ( `> Agent ID: ${ response . metadata . agentId } ` ) ;
console . log ( `> Agent Name: ${ response . metadata . agentName } ` ) ;
console . log ( `> User Input: ${ response . metadata . userInput } ` ) ;
console . log ( `> User ID: ${ response . metadata . userId } ` ) ;
console . log ( `> Session ID: ${ response . metadata . sessionId } ` ) ;
console . log (
`> Additional Parameters:` ,
response . metadata . additionalParams
) ;
console . log ( `n> Response: ${ response . output } ` ) ;
}
# Optional: Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use `venvScriptsactivate`
pip install multi-agent-orchestrator
นี่คือตัวอย่าง Python ที่เทียบเท่าแสดงให้เห็นถึงการใช้ Orchestrator Multi-Agent กับ Agent LLM BETROCK และ Agent Lex Bot:
import os
import asyncio
from multi_agent_orchestrator . orchestrator import MultiAgentOrchestrator
from multi_agent_orchestrator . agents import BedrockLLMAgent , LexBotAgent , BedrockLLMAgentOptions , LexBotAgentOptions , AgentCallbacks
orchestrator = MultiAgentOrchestrator ()
class BedrockLLMAgentCallbacks ( AgentCallbacks ):
def on_llm_new_token ( self , token : str ) -> None :
# handle response streaming here
print ( token , end = '' , flush = True )
tech_agent = BedrockLLMAgent ( BedrockLLMAgentOptions (
name = "Tech Agent" ,
streaming = True ,
description = "Specializes in technology areas including software development, hardware, AI,
cybersecurity, blockchain, cloud computing, emerging tech innovations, and pricing/costs
related to technology products and services." ,
model_id = "anthropic.claude-3-sonnet-20240229-v1:0" ,
callbacks = BedrockLLMAgentCallbacks ()
))
orchestrator . add_agent ( tech_agent )
# Add a Lex Bot Agent for handling travel-related queries
orchestrator . add_agent (
LexBotAgent ( LexBotAgentOptions (
name = "Travel Agent" ,
description = "Helps users book and manage their flight reservations" ,
bot_id = os . environ . get ( 'LEX_BOT_ID' ),
bot_alias_id = os . environ . get ( 'LEX_BOT_ALIAS_ID' ),
locale_id = "en_US" ,
))
)
async def main ():
# Example usage
response = await orchestrator . route_request (
"I want to book a flight" ,
'user123' ,
'session456'
)
# Handle the response (streaming or non-streaming)
if response . streaming :
print ( " n ** RESPONSE STREAMING ** n " )
# Send metadata immediately
print ( f"> Agent ID: { response . metadata . agent_id } " )
print ( f"> Agent Name: { response . metadata . agent_name } " )
print ( f"> User Input: { response . metadata . user_input } " )
print ( f"> User ID: { response . metadata . user_id } " )
print ( f"> Session ID: { response . metadata . session_id } " )
print ( f"> Additional Parameters: { response . metadata . additional_params } " )
print ( " n > Response: " )
# Stream the content
async for chunk in response . output :
if isinstance ( chunk , str ):
print ( chunk , end = '' , flush = True )
else :
print ( f"Received unexpected chunk type: { type ( chunk ) } " , file = sys . stderr )
else :
# Handle non-streaming response (AgentProcessingResult)
print ( " n ** RESPONSE ** n " )
print ( f"> Agent ID: { response . metadata . agent_id } " )
print ( f"> Agent Name: { response . metadata . agent_name } " )
print ( f"> User Input: { response . metadata . user_input } " )
print ( f"> User ID: { response . metadata . user_id } " )
print ( f"> Session ID: { response . metadata . session_id } " )
print ( f"> Additional Parameters: { response . metadata . additional_params } " )
print ( f" n > Response: { response . output . content } " )
if __name__ == "__main__" :
asyncio . run ( main ())
ตัวอย่างเหล่านี้แสดง:
หากคุณต้องการใช้มานุษยวิทยาหรือ OpenAI สำหรับตัวจําแนกและ/หรือตัวแทนตรวจสอบให้แน่ใจว่าได้ติดตั้ง Multi-agent-Orchestrator ด้วยคุณสมบัติพิเศษที่เกี่ยวข้อง
pip install " multi-agent-orchestrator[anthropic] "
pip install " multi-agent-orchestrator[openai] "
สำหรับการติดตั้งที่สมบูรณ์ (รวมถึงมานุษยวิทยาและ openai):
pip install " multi-agent-orchestrator[all] "
เรายินดีต้อนรับผลงาน! โปรดดูคู่มือการสนับสนุนของเราสำหรับรายละเอียดเพิ่มเติม
ตะโกนออกไปหาผู้สนับสนุนที่ยอดเยี่ยมของเรา! ขอบคุณที่ทำให้โครงการนี้ดีขึ้น! -
โปรดดูคู่มือการสนับสนุนของเราสำหรับแนวทางเกี่ยวกับวิธีการเสนอการแก้ไขข้อผิดพลาดและการปรับปรุง
โครงการนี้ได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 - ดูไฟล์ใบอนุญาตสำหรับรายละเอียด
โครงการนี้ใช้ตัวอักษร Jetbrainsmono NF ซึ่งได้รับใบอนุญาตภายใต้ใบอนุญาต SIL Open Font 1.1 สำหรับรายละเอียดใบอนุญาตทั้งหมดดู Font-License.md