الانتقال إلى المحتوى الرئيسي
لأن وثيقة توليد الطاقة مكشوفة كـ أداة، يمكن لوكيل الذكاء الاصطناعي أن يطلق عليها. دعونا نضيف وكيلا ومهارة حتى يمكن للمستخدمين أن يقولوا فقط “إنشاء اقتراح لـ Jeffery Griffin”.

المهارة

A skill قابل لإعادة الاستخدام- المعرفة التي تربطها بالوكلاء. علمنا النموذج كيفية استخدام الأداة.
import { defineSkill } from 'twenty-sdk/define';

export default defineSkill({
  universalIdentifier: DOCUMENT_SKILL_UNIVERSAL_IDENTIFIER,
  name: 'document-drafting',
  label: 'Document drafting',
  icon: 'IconFileText',
  content: [
    'To generate a document, call the `generate-document` tool with:',
    '- `templateId`: the id of the document template to use.',
    '- `recordId`: the id of the Person or Company the document is for.',
    '',
    'If the user names a template or person instead of an id, find the record first,',
    'then pass its id. Make sure the template target matches the record type.',
  ].join('\n'),
});

الوكيل

agent يزوج موجه مع نموذج . تعيين ‘استمارة الاستجابة’ بشكل صريح لتجنب تحذير البناء.
import { defineAgent } from 'twenty-sdk/define';

export default defineAgent({
  universalIdentifier: DOCUMENT_AGENT_UNIVERSAL_IDENTIFIER,
  name: 'document-assistant',
  label: 'Document Assistant',
  description: 'Generates documents from your templates and CRM records.',
  icon: 'IconFileText',
  responseFormat: { type: 'text' },
  prompt: [
    'You are the Document Assistant for a CRM.',
    'You help users generate personalized documents from reusable templates',
    'and the data already in their CRM. Use the generate-document tool, and',
    'always confirm what you created.',
  ].join(' '),
});
ولا يمكن للوكيل الاتصال بالأداة إلا إذا كان دوره يسمح بذلك. لقد قمنا بالفعل بتعيين ‘cancessAllTools: true’ و ‘canBeAssignedToAgents: true’ على دور التطبيق في الفصل 2.

جرب ذلك

افتح محادثة مع مساعد مستندات واطلب منها إعداد وثيقة لشخص في إدارة علاقات العملاء الخاصة بك. يجد السجل، يستدعي generate-document، ويُرجِع المستند الذي أنشأه — الذي يظهر الآن في عرض Documents لديك، تمامًا مثل مسارات قائمة الأوامر وسير العمل. هذه هي ثمرة إتاحة المنطق كأداة: دالة واحدة، وكثير من نقاط الدخول — قائمة الأوامر، وHTTP، وخطوة سير العمل، والآن اللغة الطبيعية. بعد هذه الخطوة: التطبيق كامل الميزة ومفيد حقا. حان الوقت لإطلاقه.

التالي: النشر →

إضافة بيانات التعريف للسوق والنشر.