وصفات

دع نموذج اللغة يكتب نصًا موسومًا

اجعل نموذج اللغة في وكيلك الصوتي يضيف وسوم المشاعر والأسلوب، وتحقق منها قبل نطقها.

علّم نموذج اللغة الوسوم الاثني عشر في تعليمات النظام، ثم أزل أي شيء آخر يضعه بين قوسين معقوفين. الوسوم مشروحة في المشاعر وأسلوب الإلقاء.

أضف الوسوم إلى تعليمات النظام

الصق هذا في تعليمات النظام لوكيلك، بعد تعليماتك الخاصة:

تعليمات النظام
Your replies are spoken by a text-to-speech voice.

You can set how a sentence sounds with a tag at its start. Use only these 12 tags, spelled exactly like this:
[neutral] [happy] [sad] [angry] [fearful] [surprised] [whisper]
[news] [storytelling] [advertising] [call_center] [conversational]

Rules:
- Start your reply with [conversational].
- Use at most one tag per sentence, at the start of the sentence.
- A tag lasts until the next tag, so add one only where the tone changes.
- Pick the tag that fits the words: [sad] for an apology, [happy] for good news.
- Never put anything else in square brackets: no other names or synonyms, and no sound effects or stage directions such as [laughs] or [pause].
- Keep tag names in English, also when you reply in Arabic.
- Write plain spoken sentences: no Markdown, lists or emoji.

تحقق من الرد قبل نطقه

قد يخترع نموذج اللغة وسمًا مثل [laughs]، وأي نص بين قوسين معقوفين ليس من الوسوم الاثني عشر يُنطق. أزل ذلك، ثم أرسل الرد بوصفه text، كما في تشغيل الكلام أثناء البث:

const DELIVERIES = new Set([
  'neutral', 'happy', 'sad', 'angry', 'fearful', 'surprised', 'whisper',
  'news', 'storytelling', 'advertising', 'call_center', 'conversational',
]);

// Keeps the 12 tags and removes any other [bracketed] text, which would be spoken.
function cleanTags(reply: string): string {
  return reply
    .replace(/\s*\[([^[\]]*)\]/g, (tag, name: string) => (DELIVERIES.has(name.toLowerCase()) ? tag : ''))
    .trim();
}

for await (const chunk of client.synthesizeStream(cleanTags(reply), {
  voice_id: voice.id,
  model: TtsModel.Nebula,
  timeoutSeconds: 30,
})) {
  process.stdout.write(chunk.audio);
}

إذا كان وكيلك يرسل جملة واحدة في كل طلب، فانقل الوسم الأخير إلى الجملة التالية التي لا وسم لها: فالأداء لا ينتقل بين الطلبات.

استمع إلى رد نموذجي

الصوت mul_nourah.

اللغةالنص المُرسَلاستمع
العربية[conversational] أكيد، أقدر أساعدك. [happy] خبر حلو: طلبك انشحن الصباح وبيوصلك بكرة.
الإنجليزية[conversational] Sure, I can help with that. [happy] Good news: your order shipped this morning and should arrive tomorrow.

القواعد والقيود: مرجع المشاعر وأسلوب الإلقاء.

في هذه الصفحة