You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
يستعرض هذا الدفتر أنماط دمج الأدوات على مستوى المؤسسات باستخدام إطار عمل Microsoft Agent في .NET مع نماذج GitHub. ستتعلم كيفية بناء وكلاء متقدمين باستخدام أدوات متعددة ومتخصصة، مستفيدًا من قوة الكتابة القوية في C# وميزات .NET على مستوى المؤسسات.
15
15
16
-
**قدرات الأدوات المتقدمة التي ستتقنها:**
16
+
### القدرات المتقدمة للأدوات التي ستتقنها
17
+
17
18
- 🔧 **هيكلية متعددة الأدوات**: بناء وكلاء بقدرات متعددة ومتخصصة
18
-
- 🎯 **تنفيذ آمن للأدوات**: الاستفادة من التحقق أثناء وقت الترجمة في C#
19
+
- 🎯 **تنفيذ آمن للأنواع**: الاستفادة من التحقق أثناء وقت الترجمة في C#
// Define Agent Identity and Comprehensive Instructions
194
+
// Agent name for identification and logging purposes
195
+
varAGENT_NAME="TravelAgent";
196
+
197
+
// Detailed instructions that define the agent's personality, capabilities, and behavior
198
+
// This system prompt shapes how the agent responds and interacts with users
199
+
varAGENT_INSTRUCTIONS="""
200
+
You are a helpful AI Agent that can help plan vacations for customers.
201
+
202
+
Important: When users specify a destination, always plan for that location. Only suggest random destinations when the user hasn't specified a preference.
203
+
204
+
When the conversation begins, introduce yourself with this message:
205
+
"Hello! I'm your TravelAgent assistant. I can help plan vacations and suggest interesting destinations for you. Here are some things you can ask me:
206
+
1. Plan a day trip to a specific location
207
+
2. Suggest a random vacation destination
208
+
3. Find destinations with specific features (beaches, mountains, historical sites, etc.)
209
+
4. Plan an alternative trip if you don't like my first suggestion
210
+
211
+
What kind of trip would you like me to help you plan today?"
212
+
213
+
Always prioritize user preferences. If they mention a specific destination like "Bali" or "Paris," focus your planning on that location rather than suggesting alternatives.
214
+
""";
215
+
216
+
// Create AI Agent with Advanced Travel Planning Capabilities
// Create New Conversation Thread for Context Management
229
+
// Initialize a new conversation thread to maintain context across multiple interactions
230
+
// Threads enable the agent to remember previous exchanges and maintain conversational state
231
+
// This is essential for multi-turn conversations and contextual understanding
232
+
AgentThreadthread=agent.GetNewThread();
233
+
234
+
// Execute Agent: First Travel Planning Request
235
+
// Run the agent with an initial request that will likely trigger the random destination tool
236
+
// The agent will analyze the request, use the GetRandomDestination tool, and create an itinerary
237
+
// Using the thread parameter maintains conversation context for subsequent interactions
238
+
awaitforeach (varupdateinagent.RunStreamingAsync("Plan me a day trip", thread))
239
+
{
240
+
awaitTask.Delay(10);
241
+
Console.Write(update);
242
+
}
243
+
244
+
Console.WriteLine();
245
+
246
+
// Execute Agent: Follow-up Request with Context Awareness
247
+
// Demonstrate contextual conversation by referencing the previous response
248
+
// The agent remembers the previous destination suggestion and will provide an alternative
249
+
// This showcases the power of conversation threads and contextual understanding in .NET agents
250
+
awaitforeach (varupdateinagent.RunStreamingAsync("I don't like that destination. Plan me another vacation.", thread))
251
+
{
252
+
awaitTask.Delay(10);
253
+
Console.Write(update);
254
+
}
114
255
```
115
256
116
257
---
117
258
259
+
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
118
260
**إخلاء المسؤولية**:
119
-
تم ترجمة هذا المستند باستخدام خدمة الترجمة بالذكاء الاصطناعي [Co-op Translator](https://github.com/Azure/co-op-translator). بينما نسعى لتحقيق الدقة، يرجى العلم أن الترجمات الآلية قد تحتوي على أخطاء أو عدم دقة. يجب اعتبار المستند الأصلي بلغته الأصلية المصدر الموثوق. للحصول على معلومات حاسمة، يُوصى بالترجمة البشرية الاحترافية. نحن غير مسؤولين عن أي سوء فهم أو تفسيرات خاطئة ناتجة عن استخدام هذه الترجمة.
261
+
تمت ترجمة هذا المستند باستخدام خدمة الترجمة بالذكاء الاصطناعي [Co-op Translator](https://github.com/Azure/co-op-translator). بينما نسعى لتحقيق الدقة، يرجى العلم أن الترجمات الآلية قد تحتوي على أخطاء أو عدم دقة. يجب اعتبار المستند الأصلي بلغته الأصلية المصدر الموثوق. للحصول على معلومات حاسمة، يُوصى بالترجمة البشرية الاحترافية. نحن غير مسؤولين عن أي سوء فهم أو تفسيرات خاطئة ناتجة عن استخدام هذه الترجمة.
0 commit comments