logo
0
0
WeChat Login
localizeflow[bot]<skytin1004@users.noreply.github.com>
chore(i18n): sync translations with latest source changes (chunk 1/1, 171 changes)

Planning Design Pattern

(ဤသင်ခန်းစာရဲ့ ဗွီဒီယိုကို ကြည့်ရန် အပေါ်မှာရှိသော ပုံကို နှိပ်ပါ)

Planning Design

မိတ်ဆက်ခြင်း

ဤသင်ခန်းစာတွင် ၎င်းဖြစ်မည်မှာ

  • ရှင်းလင်းသေချာသော စီးပွါးလုံးရည်မှန်းချက် တစ်ခု သတ်မှတ်ခြင်းနှင့် ရှုပ်ထွေးသော လုပ်ငန်းတစ်ခုကို စီမံခန့်ခွဲနိုင်သော လုပ်ငန်းများသို့ ခွဲခြားခြင်း။
  • ပိုမိုယုံကြည်စိတ်ချရပြီး စက်နည်းပညာနဲ့ဖတ်ရှုနိုင်သော တုံ့ပြန်ချက်များအတွက် ဖွဲ့စည်းထားသော ထွက်လာမှုကို အသုံးချခြင်း။
  • ဖြစ်ရပ်-စွန်းဖြစ်ပေါ်မှုအခြေခံ နည်းလမ်းကို အသုံးပြုကာ လွယ်ကူစွာဆောင်ရွက်နိုင်သော လုပ်ငန်းများနှင့် မမျှော်လင့်ထားသော ထည့်သွင်းချက်များကို ကိုင်တွယ်ခြင်း။

သင်ယူရမည့် ရည်ရွယ်ချက်များ

ဤသင်ခန်းစာကိုပြီးမြောက်လျှင် သင်မှာဒီအရာများကို နားလည်ထားမည်ဖြစ်သည်-

  • AI အေးဂျင့်တစ်ဦးအနေဖြင့်၊ ဘာသာရပ်တစ်ခုအတွက် စီးပွါးလုံးရည်မှန်းချက်တစ်ခု သတ်မှတ်ခြင်း၊ ထိုရည်မှန်းချက်ကို ကြည်လင်ရှင်းလင်းစွာ သိရှိမှုရှိစေရန်။
  • ရှုပ်ထွေးသော လုပ်ငန်းတစ်ခုကို စီမံနိုင်သော အလုပ်ခွဲများသို့ ခွဲခြားပြီး အဆင့်လိုက် စီမံခြင်း။
  • အေးဂျင့်များကို တိကျသော ကိရိယာများဖြင့် ပြည့်စုံစေခြင်း (ဥပမာ- ရှာဖွေမှု ကိရိယာများ သို့မဟုတ် ဒေတာလေ့လာမှု ကိရိယာများ), နေရာအချိန်နှင့် ကိရိယာအသုံးပြုမှုကို ဆုံးဖြတ်ခြင်း နှင့် မမျှော်လင့်ထားသော အခြေအနေများကို ကိုင်တွယ်နိုင်ရေး။
  • အလုပ်ခွဲရလဒ်များကို အကဲဖြတ်ခြင်း, စွမ်းဆောင်ရည်တိုင်းတာခြင်းနှင့် နောက်ဆုံး ထွက်ရှိမှု တိုးတက်အောင် လုပ်ဆောင်ချက်များကို ပြန်လည် တိုးတက်ပြောင်းလဲခြင်း။

စီးပွါးလုံးရည်မှန်းချက် သတ်မှတ်ခြင်းနှင့် လုပ်ငန်းခွဲခြားခြင်း

Defining Goals and Tasks

နောက်ခံ လုပ်ငန်းများသည် တစ်ဆင့်နဲ့ ပြီးစီးရန် မလွယ်ကူပေ။ AI အေးဂျင့်တစ်ခုအနေနဲ့ ၎င်း၏ စီမံခန့်ခြဲမှုများနှင့် လုပ်ဆောင်ချက်များကို ဦးတည်ပြုရန် သေချာရှင်းလင်းသော ရည်မှန်းချက်သည် လိုအပ်သည်။ ဥပမာအားဖြင့် -

"၃ ရက်ခရီးစဉ်အစီအစဉ် တစ်ခု ဖန်တီးပါ။"

ဒါဟာ ရိုးရှင်းသည့် ကြေညာချက်ဖြစ်ပေမယ့် ပိုမိုတိကျစေရန် လိုအပ်သည်။ ရည်မှန်းချက်ရှင်းလင်းသောက်ရှိရန်၊ အေးဂျင့် (နောက်ထပ် လူတွေပါ)၊ မှန်ကန်သော ရလဒ်ရရှိရန် အာရုံစိုက်နိုင်စေပါသည်။ ဥပမာ လေကြောင်းလက်မှတ် ရွေးချယ်မှုများ၊ ဟိုတယ် အကြံပြုချက်များ နှင့် လှုပ်ရှားမှု အကြံပြုချက်များ ပါဝင်သော ပြည့်စုံသော ခရီးစဉ်အစီအစဉ် တစ်ခု ဖန်တီးပေးခြင်း ကဲ့သို့။

လုပ်ငန်းခွဲခြားမှု

အလုပ်ကြီး သို့မဟုတ် ရှုပ်ထွေးသော လုပ်ငန်းများသည် ပိုမို လုပ်ဆောင်ရလွယ်ကူစေရန် အလုပ်ခွဲငယ်ငယ်များသို့ ခွဲဆောင်ရသည်။ ခရီးစဉ်အစီအစဉ် ဥပမာအတွက် ရည်မှန်းချက်ခွဲခြားမှုသည် -

  • လေကြောင်း ကမ်းလှမ်းခြင်း
  • ဟိုတယ်စာရင်းသွင်းခြင်း
  • ကားငွားခြင်း
  • ကိုယ်ပိုင်ပြင်ဆင်ခြင်း

အလုအယက်တစ်ခုချင်းစီကို တာ၀န်ရှိသော အေးဂျင့်များ သို့မဟုတ် လုပ်ငန်းစဉ်များက ကျင်းပနိုင်သည်။ တစ်ဦးသည် အကောင်းဆုံး လေကြောင်းကမ်းလှမ်းချက်များ ရှာဖွေရေးကို အထူးပြု၊ တစ်ဦးဟာ ဟိုတယ်စာရင်းသွင်းခြင်းရဲ့ အကျယ်အဝန်းကို ဂရုစိုက်၊ စသည်ဖြင့်။ ထိုအချင်းချင်း လက်တွဲလက်တွဲ အေးဂျင့်တစ်ဦးက ဤရလဒ်များအား ချိတ်ဆက်ပြီး အသုံးပြုရှင်ဆီသို့ ပြည့်စုံသော ခရီးစဉ်တစ်ခု ပေးစွမ်းနိုင်သည်။

ဤပိုင်းခွဲတစ်ရပ်သည် တိုးတက်တိုးချဲ့မှု အပိုများ တိုးမြှင့်ထားနိုင်စေရန်လည်း အဆင်ပြေပါသည်။ ဥပမာ Food Recommendations သို့မဟုတ် ဒေသခံ လှုပ်ရှားမှု အကြံပြုမှုများ အတွက် အထူးပြု အေးဂျင့်များ ထပ်မံ ထည့်သွင်းကာ ခရီးအစီအစဉ်ကို အချိန်ကြာလာဆွဲခြင်း။

ဖွဲ့စည်းထားသော ထွက်လာမှု

ကြီးမားသော ဘာသာစကား မော်ဒယ်များ (LLMs) သည် downstream အေးဂျင့်များ သို့မဟုတ် ဝန်ဆောင်မှုများ ဖတ်ရှုခြင်းနှင့် ပြုလုပ်ခြင်းပိုမို လွယ်ကူစေရန် ဖွဲ့စည်းထားသော ထွက်လာမှု (ဥပမာ JSON) ကို ဖန်တီးနိုင်သည်။ ၎င်းသည် မျိုးစုံအေးဂျင့် စနစ်တွင် အထူးအသုံးဝင်ပြီး ကိုယ်တိုင် စီမံချက် ထွက်လာမှုရရှိလာပြီးနောက် ထိုလုပ်ငန်းများကို အကောင်အထည်ဖော်နိုင်သည်။

အောက်ပါ Python ကုဒ်နမူနာသည် ရည်မှန်းချက်ကို အလုပ်ခွဲများသို့ ခွဲခြားပြီး ဖွဲ့စည်းထားသော စီမံချက်တစ်ခု ဖန်တီးနေသည့် planning agent တစ်ဦးကို ပြသသည်-

from pydantic import BaseModel from enum import Enum from typing import List, Optional, Union import json import os from typing import Optional from pprint import pprint from agent_framework.azure import AzureAIProjectAgentProvider from azure.identity import AzureCliCredential class AgentEnum(str, Enum): FlightBooking = "flight_booking" HotelBooking = "hotel_booking" CarRental = "car_rental" ActivitiesBooking = "activities_booking" DestinationInfo = "destination_info" DefaultAgent = "default_agent" GroupChatManager = "group_chat_manager" # ခရီးသွားငွေခကြေးရအနည်းငယ်နမူနာ class TravelSubTask(BaseModel): task_details: str assigned_agent: AgentEnum # အလုပ်ကို đạiေ့လိုက်စေချင်ပါတယ် class TravelPlan(BaseModel): main_task: str subtasks: List[TravelSubTask] is_greeting: bool provider = AzureAIProjectAgentProvider(credential=AzureCliCredential()) # အသုံးပြုသူ၏မက်ဆေ့ခ်ျကိုသတ်မှတ်ပါ system_prompt = """You are a planner agent. Your job is to decide which agents to run based on the user's request. Provide your response in JSON format with the following structure: {'main_task': 'Plan a family trip from Singapore to Melbourne.', 'subtasks': [{'assigned_agent': 'flight_booking', 'task_details': 'Book round-trip flights from Singapore to ' 'Melbourne.'} Below are the available agents specialised in different tasks: - FlightBooking: For booking flights and providing flight information - HotelBooking: For booking hotels and providing hotel information - CarRental: For booking cars and providing car rental information - ActivitiesBooking: For booking activities and providing activity information - DestinationInfo: For providing information about destinations - DefaultAgent: For handling general requests""" user_message = "Create a travel plan for a family of 2 kids from Singapore to Melbourne" response = client.create_response(input=user_message, instructions=system_prompt) response_content = response.output_text pprint(json.loads(response_content))

Multi-Agent စီမံခန့်ခွဲမှုဖြင့် Planning Agent

ဤဥပမာတွင် Semantic Router Agent သည် အသုံးပြုသူ ဖော်ပြချက်တစ်ခု (ဥပမာ "ကျွန်တော့်ခရီးအတွက် ဟိုတယ်အစီအစဉ် တစ်ခု လိုတယ်။") လက်ခံသည်။

Planner သည် -

  • ဟိုတယ်အစီအစဉ် လက်ခံခြင်း: စီမံသူသည် အသုံးပြုသူ၏ မက်ဆေ့ခ်ျကို ယူပြီး၊ စနစ်ဗဟိုကိရိယာအချက်အလက်အပါအဝင် prompt အပေါ်မူတည်၍ ဖွဲ့စည်းကောင်းမွန်သော ခရီးစဉ်အစီအစဉ် တစ်ခုထုတ်လုပ်သည်။
  • အေးဂျင့်များနှင့် ၎င်းတို့၏ ကိရိယာများကိုစာရင်းပြုစုခြင်း: အေးဂျင့် မှတ်တမ်းတွင် လေကြောင်း၊ ဟိုတယ်၊ ကားငွားခြင်းနှင့် လှုပ်ရှားမှု အတွက် အေးဂျင့်များနှင့် ၎င်းတို့၏ လုပ်ငန်းတာဝန်/ ကိရိယာများကို သိမ်းဆည်းထားသည်။
  • စီမံချက်ကို သတ်မှတ်ထားသော အေးဂျင့်များထံ ပို့ဆောင်ခြင်း: အလုပ်ခွဲ အရေအတွက်အရ planner သည် တစ်လမ်းတည်း အလုပ်အတွက် တိုက်ရိုက် သာမန်အေးဂျင့်သို့ ပို့ခြင်း (တစ်ခုတည်း အလုပ်ခွဲခြင်းအခြေအနေ) သို့မဟုတ် အစုလိုက် အေးဂျင့် စနစ်ဖြင့် ကော်မတီ စီမံခန့်ခွဲသူမှ ကြားဖြတ် ပို့ဆောင်ခြင်း။
  • အကျိုးသက်ရောက်မှုအား ကောက်ချက်ချခြင်း: နောက်ဆုံးတွင် ဖန်တီးထားသော စီမံချက်အတွက် မျှောသာသာ ရှင်းပြချက် ထုတ်ပေးသည်။ အောက်မှာ ကုဒ်နမူနာများ တင်ထားသည်-
from pydantic import BaseModel from enum import Enum from typing import List, Optional, Union class AgentEnum(str, Enum): FlightBooking = "flight_booking" HotelBooking = "hotel_booking" CarRental = "car_rental" ActivitiesBooking = "activities_booking" DestinationInfo = "destination_info" DefaultAgent = "default_agent" GroupChatManager = "group_chat_manager" # ခရီးသွားအောက်အလုပ်ဆောင် မော်ဒယ် class TravelSubTask(BaseModel): task_details: str assigned_agent: AgentEnum # တာဝန်ကို ကိုယ်စားလှယ်ထံ ပေးလိုသည် class TravelPlan(BaseModel): main_task: str subtasks: List[TravelSubTask] is_greeting: bool import json import os from typing import Optional from agent_framework.azure import AzureAIProjectAgentProvider from azure.identity import AzureCliCredential # ဖောက်သည်ကို ဖန်တီးပါ provider = AzureAIProjectAgentProvider(credential=AzureCliCredential()) from pprint import pprint # အသုံးပြုသူစာသားကို သတ်မှတ်ပါ system_prompt = """You are a planner agent. Your job is to decide which agents to run based on the user's request. Below are the available agents specialized in different tasks: - FlightBooking: For booking flights and providing flight information - HotelBooking: For booking hotels and providing hotel information - CarRental: For booking cars and providing car rental information - ActivitiesBooking: For booking activities and providing activity information - DestinationInfo: For providing information about destinations - DefaultAgent: For handling general requests""" user_message = "Create a travel plan for a family of 2 kids from Singapore to Melbourne" response = client.create_response(input=user_message, instructions=system_prompt) response_content = response.output_text # JSON အနေနဲ့ဖတ်ပြီးနောက် ပြန်ကြားချက် အကြောင်းအရာကို ပုံနှိပ်ပါ pprint(json.loads(response_content))

နောက်ထပ်အရာမှာ ရှေ့က ကုဒ်မှ ထွက်ရှိလာပြီးသော ထွက်နောက်ဆုံးဖြစ်ပြီး ၎င်းဖွဲ့စည်းထားသော ထွက်မှာ assigned_agent သို့ ဦးတည် ပို့ဆောင်ပြီး ခရီးအစီအစဉ်ကို အသုံးပြုသူဆီ အကျဉ်းချုပ်ပေးနိုင်သည်။

{ "is_greeting": "False", "main_task": "Plan a family trip from Singapore to Melbourne.", "subtasks": [ { "assigned_agent": "flight_booking", "task_details": "Book round-trip flights from Singapore to Melbourne." }, { "assigned_agent": "hotel_booking", "task_details": "Find family-friendly hotels in Melbourne." }, { "assigned_agent": "car_rental", "task_details": "Arrange a car rental suitable for a family of four in Melbourne." }, { "assigned_agent": "activities_booking", "task_details": "List family-friendly activities in Melbourne." }, { "assigned_agent": "destination_info", "task_details": "Provide information about Melbourne as a travel destination." } ] }

အပေါ်က နမူနာကုဒ်နှင့်အတူ သင်ယူ Notebook ကို ဒီမှာ တွေ့နိုင်သည်။

ပြန်လည်စီမံခြင်း

အလုပ်အချို့တွင် တစ်ဆင့်ပြီးတစ်ဆင့် ပြန်လည်စီမံ/ ပြင်ဆင်ရန်လိုအပ်သည်၊ မတူသော အလုပ်ခွဲရလဒ်သည် နောက်တစ်ခုအပေါ် အကျိုးသက်ရောက်မှုရှိနိုင်သည်။ ဥပမာ လေကြောင်း အတည်ပြုစဉ် မမျှော်လင့်ထားသော ဒေတာပုံစံကို တွေ့လျှင် ဟိုတယ်စာရင်းသွင်းမှု မတိုင်ခင် မိမိ မဟာဗျူဟာကို ပြင်ဆင်ရန် လိုတာ ဖြစ်နိုင်သည်။

ထို့ပြင် အသုံးပြုသူအကြံပြုချက် (ဥပမာ အစောပိုင်း လေကြောင်း လက်မှတ်ကို နှစ်သက်သည်ဟု လူကြီးပြောဆိုခြင်း) အပိုင်းအလိုက် ပြန်လည် စီမံခန့်ခွဲမှုကို ဖျားစီးနိုင်သည်။ ဤ dynamic, iterative နည်းလမ်းသည် နောက်ဆုံး ဖြေရှင်းချက်ကို အမှန်တကယ် ဖြစ်ပေါ်လာသော အခြေအနေများနှင့် အသုံးပြုသူကသဘောတူမှုများနှင့် ကိုက်ညီစေသည်။

ဥပမာကုဒ်

from agent_framework.azure import AzureAIProjectAgentProvider from azure.identity import AzureCliCredential #.. ယခင်ကုဒ်နှင့်တူပြီး အသုံးပြုသူသမိုင်းကြောင်း၊ လက်ရှိအစီအစဉ်ကိုပို့ပေးသည် system_prompt = """You are a planner agent to optimize the Your job is to decide which agents to run based on the user's request. Below are the available agents specialized in different tasks: - FlightBooking: For booking flights and providing flight information - HotelBooking: For booking hotels and providing hotel information - CarRental: For booking cars and providing car rental information - ActivitiesBooking: For booking activities and providing activity information - DestinationInfo: For providing information about destinations - DefaultAgent: For handling general requests""" user_message = "Create a travel plan for a family of 2 kids from Singapore to Melbourne" response = client.create_response( input=user_message, instructions=system_prompt, context=f"Previous travel plan - {TravelPlan}", ) # .. ပြန်လည်အစီအစဉ်ချပြီး တာဝန်များကို သက်ဆိုင်ရာအေးဂျင့်များသို့ ပို့သည်

ပိုမိုကျယ်ပြန့်သော စီမံခန့်ခွဲမှုများအတွက် Magnetic One ဘလော့ဂ်ပို့စ် ကိုကြည့်ရှုပါ။

အကျဉ်းချုပ်

ဤဆောင်းပါးတွင် ရရှိသည့် နမူနာအရ သိမ်းဆည်းထားသော agent များကို dynamic နည်းဖြင့် ရွေးချယ်ပေးသော planner တစ်ခု ဖန်တီးနည်းကို ကြည့်ရူခဲ့သည်။ Planner ထွက်ရှိမှုသည် အလုပ်ခွဲများကို ခွဲ၍ agent များအား ခန့်အပ်ပေးပြီး လုပ်ဆောင်စေရန် ဖြစ်သည်။ agent များတွင် လိုအပ်သော function / tool များအသုံးပြုခွင့် ရှိကြောင်း သတိပြုထားသည်။ agent များအပြင် reflection, summarizer နှင့် round robin chat ကဲ့သို့သော ပုံစံများကို ထပ်ထည့်၍ စိတ်ကြိုက်ပြုလုပ်နိုင်သည်။

နောက်ထပ် ရင်းမြစ်များ

Magentic One - ရှုပ်ထွေးသော လုပ်ငန်းများကို ဖြေရှင်းနိုင်သော Generalist multi-agent စနစ်ဖြစ်ပြီး နောက်ဆက်တွဲ စိန်ခေါ်မှုများရှိသော agentic benchmark များတွင် ထူးချွန်သော ရလဒ်များ ရရှိထားသည်။ အသုံးပြုမှုနှင့်ဆိုင်းငံ့ချက်များကို ကြည့်ရန် Magentic One။ ဤ အသုံးပြုမှုတွင် orchestrator သည် အလုပ်အား သီးသန့် စီမံချက်များ ဖန်တီးပြီး ရရှိရှိ agent များအား တာဝန်ပေးသည်။ စီမံခြင်းအပြင် orchestrator သည် တိုးတက်မှုကို သေချာစေရန် နောက်တိုးများ ပြုလုပ်ခြင်းနှင့် ချုပ်ချယ်သိမ်းဆည်းမှုများ ပြုလုပ်သည်။

Planning Design Pattern အကြောင်း နောက်ထပ် မေးခွန်းများ ရှိပါသလား?

Microsoft Foundry Discord တွင် ပါဝင်ပြီး သင်တန်းကျောင်းသားများနှင့် မိတ်ဆက်၊ ရုံးချိန်များ တက်ရောက်ပြီး AI Agents နှင့်ပတ်သက်သော မေးခွန်းများဖြေကြားချက် ရယူပါ။

မီပြီး သင်ခန်းစာ

ယုံကြည်စိတ်ချရသော AI Agent များ တည်ဆောက်ခြင်း

နောက်တစ်ခု သင်ခန်းစာ

Multi-Agent Design Pattern


အကြောင်းကြားချက်
ဤစာရွက်စာတမ်းကို AI ဘာသာပြန်ဝန်ဆောင်မှု Co-op Translator ကို အသုံးပြု၍ ဘာသာပြန်ထားပါသည်။ ကျွန်ုပ်တို့သည် တိကျမှန်ကန်မှုကို ကြိုးပမ်းဆောင်ရွက်ပေမယ့် အလိုအလျောက် ဘာသာပြန်ချက်များတွင် အမှားအယွင်းများ ဖြစ်ပေါ်နိုင်သည်ကို သတိပြုပါရန် အကြောင်းကြားအပ်ပါသည်။ မူလစာရွက်စာတမ်းသည် မူလဘာသာဖြင့် တရားဝင်အရင်းအမြစ်အဖြစ် သတ်မှတ်ချက်ရပါသည်။ အရေးကြီးသောအချက်အလက်များအတွက် လူ့ပညာရှင်တစ်ဦးက ဘာသာပြန်ချက်အား အသုံးပြုရန် အကြံပြုပါသည်။ ဤဘာသာပြန်ချက်ကို အသုံးပြုမှုကြောင့် ဖြစ်ပေါ်လာနိုင်သည့် မမှန်ကန်မှုများ သို့မဟုတ် မှားယွင်းသော သဘောထားပိုင်းဆိုင်ရာ တိမ်မွေ့မှုများအတွက် ကျွန်ုပ်တို့သည် တာဝန်မယူပါ။