Skip to content

Current path

Prompt Engineering
Level: Intermediate33 lessons
Progress0/33 · 0%

Context and Sources

Working with Texts and Documents

Direct the model to work from provided material and specify the task rather than relying on unnecessary outside knowledge.

In this lesson

Why this matters

When working from a document, define whether answers must rely only on it and how absent information should be handled. Label sources or sections when precise attribution matters.

How to apply it

  1. Define the task and desired outcome.
  2. Add only context or rules that affect success.
  3. Specify an output form or checkable criterion when needed.
  4. Test on realistic input and revise when a failure pattern appears.

Practical example

Weak example:

text
Weak version of the same task: اقرأ الملف وأجب.

The weak version leaves an important part of the task or its boundaries to guesswork. The improved version adds information tied directly to success without treating length or complexity as a goal.

Improved example:

text
Improved version: اعتمد على المستند فقط. استخرج شروط الإلغاء والاستثناءات مع اسم القسم؛ اكتب «غير مذكور» إذا غابت المعلومة.

Short practice

Apply the lesson concept to this task: اكتب أمر استخراج من سياسة مع قاعدة للمعلومات المفقودة.

Check your understanding

Check: ماذا نفعل إذا لم توجد المعلومة في المصدر؟
Answer: نصرح بأنها غير موجودة بدل التخمين.

Summary

Keep this concept as one tool rather than a magic formula. Tie it to the goal and success criteria, then build on it in the next lesson.