التفويض والهوية في استدعاءات الأدوات
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
make every tool call run as the end user.
الموضوعات المخطط لها
- The tool call carries the customer's token (from the session), never a shared service account.
- The downstream service checks ownership exactly as it does for the customer's own request.
- Never put the user id in a model-controlled argument; take it from the authenticated context.
- Whether an action is allowed is decided by code and policy, never by the model's judgment ("the user seems entitled").
تفاصيل المخطط المبدئي
عرض عملي
diagram: customer token → assistant backend → orders API (ownership check) → 403 for someone else's order; the model sees only {error:"NOT_ALLOWED"}.
اختبر فهمك
Where does the user id for a tool call come from?
أظهر الإجابة
The authenticated session, not the model.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.