تظهر المساعدات الشخصية الذكية كعوامل تغيير حقيقية. لديها القدرة على تحويل كيفية إدارتنا لمهامنا اليومية ومسؤولياتنا. على عكس برامج الدردشة الأساسية، فإن هذه المساعدات الذكية هي أنظمة متطورة تفهم تفاصيل حياتنا الشخصية، مما يجعل أنشطتنا اليومية أكثر سلاسة وكفاءة.
إن بناء مثل هذا المساعد الذكي يمكن أن يكون معقدًا بدون البنية التحتية الصحيحة. مدير المهام المتعددة من AWS هو إطار عمل مرن وقوي لإدارة عدة وكلاء ذكاء اصطناعي. يقوم مدير المهام باختيار الوكيل المناسب بناءً على مدخلات المستخدم، وخصائص الوكيل، وتاريخ المحادثة. كما يسهل المدير أيضًا تخزين تاريخ المحادثة لكل وكيل.
بناء مساعد ذكاء اصطناعي لمهام متنوعة
دعونا نبني مساعد ذكاء اصطناعي يستطيع فحص التقويم، اقتراح روتين لياقة بدنية، وقراءة الأخبار في آن واحد. هذه مهام منفصلة تمامًا يمكن أن تكون لها سياقات مختلفة خلال تفاعلات المستخدم معها. يمكن العثور على الشفرة المصدرية الكاملة لهذا المساعد الشخصي هنا.
وكيل التقويم
هذا هو وكيل سلسلة يستخدم داخليًا ApiAgent لاسترداد دعوات التقويم باستخدام واجهات برمجة تطبيقات Calendly. يتم بث الاستجابة من ApiAgent إلى BedrockLLMAgent لتلخيص الدعوات.
agent1 = ApiAgent(ApiAgentOptions(
endpoint = f"https://api.calendly.com/user_busy_times?user={CALENDLY_USER_URI}&start_time={start_time}&end_time={end_time}",
method = "GET",
name = "Calendly Schedule Agent",
description = "Specializes in Calendar scheduling",
streaming=False,
headers_callback=custom_headers_callback,
))
agent2 = BedrockLLMAgent(BedrockLLMAgentOptions(
name="Calendar Summarization",
streaming=True,
description="You are an AI agent specialized in summarizing calendar events. Given a list of events, produce a concise summary"\
" highlighting key details such as event names, dates, times, and participants. Ensure the summary is clear, brief, and "\
"informative for quick understanding. Do not provide duplicate information or irrelevant details.",
model_id="anthropic.claude-3-5-sonnet-20240620-v1:0",
callbacks=ChainlitAgentCallbacks()
))
وكيل قراءة الأخبار
يستخدم وكيل قراءة الأخبار أيضًا وكيل سلسلة، الذي يستخدم داخليًا ApiAgent لاسترداد الأخبار باستخدام واجهات برمجة تطبيقات Gnews. يتم بث الاستجابة من ApiAgent إلى BedrockLLMAgent لتلخيص الأخبار.
agent1 = ApiAgent(ApiAgentOptions(
endpoint = f"https://gnews.io/api/v4/search?q=example&apikey={GNEWS_API_KEY}",
method = "GET",
name = "News Reader Agent",
description = "Specializes in reading news from various sources",
streaming=False
))
agent2 = BedrockLLMAgent(BedrockLLMAgentOptions(
name="News Summarization Agent",
streaming=True,
description="You are a skilled journalist tasked with creating concise, engaging news summaries."\
"Given the following text, produce a clear and informative summary that captures the key points," \
"main actors, and significant details. Your summary should be objective, well-structured, "\
"and easily digestible for a general audience. Aim for clarity and brevity while maintaining the essence of the news story.",
model_id="anthropic.claude-3-5-sonnet-20240620-v1:0",
callbacks=ChainlitAgentCallbacks()
))
وكيل اللياقة البدنية
وكيل اللياقة البدنية هو وكيل مستقل يستخدم نموذج LLM لاقتراح روتين لياقة بدنية، خطط غذائية، ونصائح صحية.
fitness_agent = BedrockLLMAgent(BedrockLLMAgentOptions(
name="Fitness Agent",
streaming=True,
description="Specializes in fitness, health, and wellness. It can provide workout routines, diet plans, and general health tips.",
model_id="anthropic.claude-3-5-sonnet-20240620-v1:0",
callbacks=ChainlitAgentCallbacks()
))
تشغيل التطبيق
اتبع هذه التعليمات للمتطلبات الأولية.
1. استنسخ المستودع:
git clone https://github.com/ravilaudya/task-copilot.git
cd task-copilot
2. أنشئ بيئة افتراضية:
conda create -p venv python=3.12
conda activate ./venv
3. قم بتثبيت التبعيات المطلوبة:
pip install -r requirements.txt
4. قم بتشغيل التطبيق:
chainlit run app.py --port 8888
التفاعل مع الكوبيلوت
عند تشغيل التطبيق، ستفتح نافذة متصفح حيث يمكنك التفاعل مع الكوبيلوت الذكاء الاصطناعي. بعض الأسئلة النموذجية التي يمكنك طرحها تشمل:
- “ما هي آخر الأخبار؟”
- “كيف يبدو جدولي هذا الأسبوع؟”
- “كيف يمكنني فقدان الدهون؟”
الاستنتاج
يقوم الكوبيلوت الذكاء الاصطناعي بتبسيط المهام اليومية وتعزيز الإنتاجية من خلال توفير معلومات سريعة وذات صلة تتماشى مع تفضيلات الأفراد. بالبنية التحتية المناسبة، يمكن بناء كوبيلوت مثل هذا ويصبح مشروعًا قابلًا للإدارة والجوائز. إن وجود مثل هذا الكوبيلوت يشبه وجود شريك موثوق به بجانبك، مما يجعل الحياة أسهل قليلاً.
Source:
https://dzone.com/articles/ai-copilot-using-multi-agent-orchestrator