אסטרטגיות לעיצוב הנחיות

עיצוב פרומפטים הוא התהליך של יצירת פרומפטים, או בקשות בשפה טבעית, שמפיקים תשובות מדויקות ואיכותיות ממודל שפה.

בדף הזה מוסברים מושגים בסיסיים, אסטרטגיות ושיטות מומלצות שיעזרו לכם להתחיל לתכנן הנחיות כדי להפיק את המקסימום ממודלי ה-AI של Gemini.

מדריכים לכתיבת פרומפטים בנושאים ספציפיים

רוצים לקבל אסטרטגיות ספציפיות יותר לכתיבת הנחיות? כדאי לעיין במדריכים האחרים שלנו לכתיבת הנחיות בנושאים הבאים:

בגלריית ההנחיות יש דוגמאות נוספות להנחיות שממחישות באופן אינטראקטיבי הרבה מהמושגים שמופיעים במדריך הזה.

הוראות ברורות וספציפיות

דרך יעילה וטובה להתאים אישית את התנהגות המודל היא לספק לו הוראות ברורות וספציפיות. ההוראות יכולות להיות בצורת שאלה, משימות מפורטות או מורכבות כמו מיפוי של חוויית המשתמש והלך הרוח שלו.

קלט

הקלט הוא הטקסט שחובה לכלול בפרומפט כדי שהמודל יספק תגובה. קלט יכול להיות שאלה שהמודל עונה עליה (קלט של שאלה), משימה שהמודל מבצע (קלט של משימה), ישות שהמודל פועל עליה (קלט של ישות) או קלט חלקי שהמודל משלים או ממשיך (קלט של השלמה).

סוג קלט פרומפט הפלט שנוצר באמצעות AI
שאלה

    What's a good name for a flower shop that specializes in selling bouquets of
    dried flowers? Create a list of 5 options with just the names.

    Here are 5 names for a flower shop specializing in dried flowers:

    1. Everlasting Blooms
    2. Dried & Delightful
    3. The Petal Preserve
    4. Whispers of Wildflowers
    5. Forever Blooms
    
משימה
    Give me a simple list of just the things that I must bring on a camping trip. The list should have 5 items.
    1. **Tent:** Your shelter from the elements.
    2. **Sleeping Bag:** Stay warm and comfortable.
    3. **Sleeping Pad:** Insulation and cushioning for a good night's sleep.
    4. **Headlamp or Flashlight:** Light for nighttime activities.
    5. **First Aid Kit:** Be prepared for minor injuries.
ישות

    Classify the following items as [large, small]:
Elephant
Mouse
Snail

Here's the classification:

* **Elephant:** Large
* **Mouse:** Small
* **Snail:** Small
    

השלמה חלקית של קלט

מודלים גנרטיביים של שפה פועלים כמו כלי מתקדם להשלמה אוטומטית. כשמספקים תוכן חלקי, המודל יכול לספק את שאר התוכן או את מה שהוא חושב שהוא המשך של התוכן הזה כתשובה. כשעושים את זה, אם כוללים דוגמאות או הקשר, המודל יכול להתחשב בהם.

בדוגמה הבאה מופיע פרומפט עם הוראה וקלט של ישות:

For the given order, return a JSON object that has the fields cheeseburger, hamburger, fries, or
drink, with the value being the quantity.

Order: A burger and a drink.
  
{
  "cheeseburger": 0,
  "hamburger": 1,
  "fries": 0,
  "drink": 1
}
  

המודל פעל לפי ההנחיה, אבל לפעמים קשה לכתוב את ההוראות בשפה טבעית, והמודל צריך לפרש אותן. לדוגמה, תפריט של מסעדה יכול להכיל הרבה פריטים. כדי להקטין את הגודל של תגובת ה-JSON, כדאי להשמיט את הפריטים שלא הוזמנו. במקרה כזה, אתם יכולים לתת דוגמה ותחילית לתשובה, ולתת למודל להשלים אותה:

Valid fields are cheeseburger, hamburger, fries, and drink.
Order: Give me a cheeseburger and fries
Output:
```
{
  "cheeseburger": 1,
  "fries": 1
}
```
Order: I want two burgers, a drink, and fries.
Output:
  
```
{
  "hamburger": 2,
  "drink": 1,
  "fries": 1
}
```
  

שימו לב שהמילה "cheeseburger" לא נכללה בפלט כי היא לא הייתה חלק מההזמנה.

אפשר לציין את הפורמט של אובייקטים פשוטים של תגובת JSON באמצעות הנחיות, אבל מומלץ להשתמש בתכונה פלט מובנה של Gemini API כשמציינים סכימת JSON מורכבת יותר לתגובה.

מגבלות

ציינו מגבלות על קריאת ההנחיה או על יצירת התשובה. אתם יכולים להגיד למודל מה לעשות ומה לא לעשות. לדוגמה, אתם יכולים לציין במנחה מגבלה לגבי אורך הסיכום שאתם רוצים:

Summarize this text in one sentence:
Text: A quantum computer exploits quantum mechanical phenomena to perform calculations exponentially
faster than any modern traditional computer. At very tiny scales, physical matter acts as both
particles and as waves, and quantum computing uses specialized hardware to leverage this behavior.
The operating principles of quantum devices is beyond the scope of classical physics. When deployed
at scale, quantum computers could be used in a wide variety of applications such as: in
cybersecurity to break existing encryption methods while helping researchers create new ones, in
meteorology to develop better weather forecasting etc. However, the current state of the art quantum
computers are still largely experimental and impractical.
    

      Exploiting quantum mechanical phenomena, quantum computers can perform calculations exponentially faster than traditional computers for potential applications like cybersecurity and meteorology, although they are currently largely experimental and impractical.
    

פורמט התשובה

אתם יכולים לתת הוראות שמציינות את פורמט התשובה. לדוגמה, אתם יכולים לבקש שהתשובה תהיה בפורמט של טבלה, רשימה עם תבליטים, נאום מעלית, מילות מפתח, משפט או פסקה. הוראת המערכת הבאה אומרת למודל להיות יותר שיחתי בתשובה שלו:

    All questions should be answered comprehensively with details, unless the user requests a concise response specifically.
  
    What is a smart way to make a business that sells DVD's in 2026?
  
Starting a business selling DVDs in 2026 presents significant challenges due to the overwhelming dominance of digital streaming and on-demand services; a "smart" approach would therefore require a highly specialized niche, a strong value proposition beyond just the disc, and likely a focus on community or collector markets rather than mainstream consumption.

Here's a breakdown of what a smart DVD business in 2026 would likely entail:

1. Extreme Niche Specialization: You cannot compete with streaming libraries. Your business must focus on what digital doesn't offer easily or at all. This could include:

    * Out-of-Print & Rare Titles: Sourcing films or TV shows that have never been released digitally or are currently unavailable on major streaming platforms.
    ....
  

עיצוב התשובות באמצעות אסטרטגיית ההשלמה

אסטרטגיית ההשלמה יכולה גם לעזור בעיצוב התשובה. בדוגמה הבאה, המודל מתבקש ליצור ראשי פרקים למאמר:

Create an outline for an essay about hummingbirds.
  
Here is a possible outline for an essay about hummingbirds:

I. Introduction
A. Hook: Start with a captivating fact or description about hummingbirds (e.g., their speed, iridescent colors, or tiny size).
B. Background: Briefly introduce hummingbirds – where they are found (Americas), their reputation as unique birds.
C. Thesis Statement: State the main point of the essay, which could be about the remarkable adaptations, behaviors, and ecological importance of hummingbirds.

II. Appearance and Identification
.....
  

בהנחיה לא צוין הפורמט של המתאר, והמודל בחר פורמט בשבילכם. כדי שהמודל יחזיר ראשי פרקים בפורמט ספציפי, אפשר להוסיף טקסט שמייצג את תחילת ראשי הפרקים ולתת למודל להשלים אותם על סמך התבנית שהתחלתם.

Create an outline for an essay about hummingbirds.
I. Introduction
   *
  
Okay, here is an outline for an essay about hummingbirds, starting from the introduction you provided:

I. Introduction
* Hook: Start with a captivating fact or description about hummingbirds (e.g., their speed, iridescent colors, or tiny size).
* Background: Briefly introduce hummingbirds – where they are found (Americas), their reputation as unique birds, and their general characteristics.
* Thesis Statement: State the main point of the essay, focusing on the remarkable adaptations, behaviors, and ecological significance that make hummingbirds extraordinary.
.....
  

הנחיות בלי דוגמאות (zero-shot) לעומת הנחיות עם כמה דוגמאות (few-shot)

אתם יכולים לכלול בפרומפט דוגמאות שמראות למודל איך נראית תשובה נכונה. המודל מנסה לזהות דפוסים וקשרים מהדוגמאות, ומיישם אותם כשהוא יוצר תשובה. הנחיות שמכילות כמה דוגמאות נקראות הנחיות עם כמה דוגמאות, והנחיות שלא מכילות דוגמאות נקראות הנחיות ללא דוגמאות. פרומפטים עם כמה דוגמאות (few-shot prompting) משמשים לעיתים קרובות כדי להסדיר את העיצוב, הניסוח, ההיקף או הדפוס הכללי של התשובות מהמודל. כדאי להשתמש בדוגמאות ספציפיות ומגוונות כדי לעזור למודל לצמצם את המיקוד שלו וליצור תוצאות מדויקות יותר.

מומלץ תמיד לכלול כמה דוגמאות ב-פרומפט עם כמה דוגמאות (few-shot) שלכם. פרומפטים בלי פרומפט עם כמה דוגמאות (few-shot) כנראה יהיו פחות יעילים. למעשה, אתם יכולים להסיר את ההוראות מההנחיה אם הדוגמאות שלכם מראות בצורה מספיק ברורה את המשימה שאתם רוצים לבצע.

בפרומפט הבא בלי דוגמאות, המודל מתבקש לבחור את ההסבר הכי טוב.

Please choose the best explanation to the question:

Question: How is snow formed?
Explanation1: Snow is formed when water vapor in the air freezes into ice
crystals in the atmosphere, which can combine and grow into snowflakes as they
fall through the atmosphere and accumulate on the ground.
Explanation2: Water vapor freezes into ice crystals forming snow.
Answer:
  
Explanation1 is the better explanation because it provides more detail on the
process, including how ice crystals combine and grow into snowflakes as they
fall through the atmosphere.
  

אם בתרחיש השימוש שלכם המודל צריך לתת תשובות תמציתיות, אתם יכולים לכלול בהנחיה דוגמאות שמעדיפות תשובות תמציתיות.

בדוגמה הבאה להנחיה יש שתי דוגמאות שבהן ההסברים קצרים יותר. בתשובה אפשר לראות שהדוגמאות הנחו את המודל לבחור בהסבר הקצר יותר (Explanation2) במקום בהסבר הארוך יותר (Explanation1) כמו קודם.

Below are some examples showing a question, explanation, and answer format:

Question: Why is the sky blue?
Explanation1: The sky appears blue because of Rayleigh scattering, which causes
shorter blue wavelengths of light to be scattered more easily than longer red
wavelengths, making the sky look blue.
Explanation2: Due to Rayleigh scattering effect.
Answer: Explanation2

Question: What is the cause of earthquakes?
Explanation1: Sudden release of energy in the Earth's crust.
Explanation2: Earthquakes happen when tectonic plates suddenly slip or break
apart, causing a release of energy that creates seismic waves that can shake the
ground and cause damage.
Answer: Explanation1

Now, Answer the following question given the example formats above:

Question: How is snow formed?
Explanation1: Snow is formed when water vapor in the air freezes into ice
crystals in the atmosphere, which can combine and grow into snowflakes as they
fall through the atmosphere and accumulate on the ground.
Explanation2: Water vapor freezes into ice crystals forming snow.
Answer:
  
Answer: Explanation2
  

מספר הדוגמאות האופטימלי

מודלים כמו Gemini יכולים לזהות דפוסים באמצעות כמה דוגמאות, אבל יכול להיות שתצטרכו להתנסות עם מספר הדוגמאות שאתם מספקים בהנחיה כדי לקבל את התוצאות הכי טובות. מצד שני, אם תכללו יותר מדי דוגמאות, המודל עלול להתחיל ליצור התאמת יתר (overfitting) של התשובה לדוגמאות.

עיצוב עקבי

חשוב לוודא שהמבנה והפורמט של פרומפט עם כמה דוגמאות (few-shot) זהים, כדי למנוע תשובות בפורמטים לא רצויים. אחת מהמטרות העיקריות של הוספת דוגמאות להנחיות היא להראות למודל את פורמט התשובה. לכן, חשוב לוודא שהפורמט עקבי בכל הדוגמאות, ובמיוחד לשים לב לתגי XML, לרווחים הלבנים, למעברי השורה ולמפרידי הדוגמאות.

הוספת הקשר

אתם יכולים לכלול בהנחיה הוראות ומידע שהמודל צריך כדי לפתור בעיה, במקום להניח שיש למודל את כל המידע הנדרש. המידע הזה עוזר למודל להבין את המגבלות והפרטים של מה שאתם מבקשים ממנו לעשות.

בדוגמה הבאה, המודל מתבקש לתת הנחיות לפתרון בעיות בנתב:

What should I do to fix my disconnected wifi? The light on my Google
Wifi router is yellow and blinking slowly.
  
  A yellow blinking light on your Google Wifi router usually indicates a problem
  with the internet connection. Here are some steps to troubleshoot and fix the
  issue:
  1. Restart your router and modem:
    - Unplug your modem from the power outlet and wait for 30 seconds.
    - Plug your modem back in and wait for it to fully boot up.
    - Unplug your Google Wifi router and wait for 30 seconds.
    - Plug your Google Wifi router back in and wait for it to fully boot up.
.....
  

התשובה נראית כמו מידע כללי לפתרון בעיות שלא ספציפי לנתב או לסטטוס של נוריות ה-LED.

כדי להתאים אישית את התשובה לנתב הספציפי, אפשר להוסיף לפרומפט את מדריך פתרון הבעיות של הנתב כהקשר שאליו Gemini יכול להתייחס כשמספק תשובה.

Answer the question using the text below. Respond with only the text provided.
Question: What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and blinking slowly.

Text:
Color: Slowly pulsing yellow
What it means: There is a network error.
What to do:
Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again.

Color: Fast blinking yellow
What it means: You are holding down the reset button and are factory resetting this device.
What to do:
If you keep holding down the reset button, after about 12 seconds, the light will turn solid yellow. Once it is solid yellow, let go of the factory reset button.

Color: Solid yellow
What it means: Router is factory resetting.
What to do:
This can take up to 10 minutes. When it's done, the device will reset itself and start pulsing white, letting you know it's ready for setup.

Color: Solid red
What it means: Something is wrong.
What to do:
Critical failure. Factory reset the router. If the light stays red, contact Wifi customer support.
  
Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again.
  

פירוק הנחיות לרכיבים

בתרחישי שימוש שבהם נדרשות הנחיות מורכבות, אפשר לעזור למודל להתמודד עם המורכבות הזו על ידי פירוק הדברים לרכיבים פשוטים יותר.

  1. פירוק ההוראות: במקום לכלול הרבה הוראות בהנחיה אחת, צרו הנחיה אחת לכל הוראה. אתם יכולים לבחור איזו הנחיה לעבד על סמך הקלט של המשתמש.

  2. הנחיות משורשרות: במשימות מורכבות שכוללות כמה שלבים, הפכו כל שלב להנחיה ושרשרו את ההנחיות יחד ברצף. בשרשרת הפרומפטים הזו, הפלט של פרומפט אחד ברצף הופך לקלט של הפרומפט הבא. הפלט של ההנחיה האחרונה ברצף הוא הפלט הסופי.

  3. צבירת תגובות: צבירה היא מצב שבו רוצים לבצע משימות מקבילות שונות בחלקים שונים של הנתונים ולצבור את התוצאות כדי ליצור את הפלט הסופי. לדוגמה, אתם יכולים להורות למודל לבצע פעולה אחת בחלק הראשון של הנתונים, לבצע פעולה אחרת בשאר הנתונים ולצבור את התוצאות.

התנסות בפרמטרים של המודל

כל קריאה ששולחים למודל כוללת ערכי פרמטרים שקובעים איך המודל ייצור את התשובה. המודל יכול ליצור תוצאות שונות לערכי פרמטרים שונים. כדאי להתנסות עם ערכים שונים של פרמטרים כדי לקבל את ערכי הפרמטרים הכי טובים למשימה. יכול להיות שיהיו הבדלים בין הפרמטרים שזמינים במודלים שונים. הפרמטרים הנפוצים ביותר הם:

  1. ‫Max output tokens: המספר המקסימלי של טוקנים שאפשר ליצור בתשובה. טוקן הוא בערך ארבעה תווים. ‫100 טוקנים שווים בערך ל-60 עד 80 מילים.

  2. טמפרטורה: הטמפרטורה שולטת במידת האקראיות בבחירת האסימון. הטמפרטורה משמשת לדגימה במהלך יצירת התשובה, שמתרחשת כשמחילים את topP ו-topK. טמפרטורות נמוכות מתאימות להנחיות שדורשות תשובה יותר דטרמיניסטית או פחות פתוחה, ואילו טמפרטורות גבוהות יכולות להוביל לתוצאות יותר מגוונות או יצירתיות. טמפרטורה של 0 היא דטרמיניסטית, כלומר תמיד נבחרת התשובה עם ההסתברות הגבוהה ביותר.

  3. ‫topK: הפרמטר topK משנה את האופן שבו המודל בוחר טוקנים לפלט. אם הערך של topK הוא 1, האסימון שנבחר הוא הסביר ביותר מבין כל האסימונים באוצר המילים של המודל (נקרא גם פענוח חמדני). אם הערך של topK הוא 3, האסימון הבא נבחר מבין 3 האסימונים הסבירים ביותר באמצעות הטמפרטורה. בכל שלב של בחירת אסימון, מתבצעת דגימה של האסימונים topK עם ההסתברויות הכי גבוהות. לאחר מכן, הטוקנים מסוננים עוד יותר על סמך topP, והטוקן הסופי נבחר באמצעות דגימה לפי טמפרטורה.

  4. ‫topP: הפרמטר topP משנה את האופן שבו המודל בוחר טוקנים לפלט. הטוקנים נבחרים מהסבירים ביותר ועד הכי פחות סבירים, עד שסכום ההסתברויות שלהם שווה לערך topP. לדוגמה, אם ההסתברות של האסימונים A, ‏ B ו-C היא 0.3,‏ 0.2 ו-0.1, והערך של topP הוא 0.5, המודל יבחר באסימון A או באסימון B כאסימון הבא באמצעות הטמפרטורה, ויפסול את C כמועמד. ערך ברירת המחדל של topP הוא 0.95.

  5. ‫stop_sequences: הגדרת רצף עצירה כדי להנחות את המודל להפסיק ליצור תוכן. רצף עצירה יכול להיות כל רצף של תווים. כדאי להימנע משימוש ברצף של תווים שעשויים להופיע בתוכן שנוצר.

אסטרטגיות לחידוד פרומפטים

לפעמים צריך לבצע כמה איטרציות של עיצוב הנחיה כדי לקבל באופן עקבי את התשובה הרצויה. בקטע הזה מפורטות כמה הצעות לדברים שאפשר לנסות כשמשפרים את ההנחיות:

  1. שימוש בניסוח שונה: שימוש במילים או בניסוח שונים בהנחיות לרוב יוביל לתשובות שונות מהמודל, גם אם המשמעות של כולן זהה. אם לא קיבלתם את התוצאות שציפיתם להן מהפרומפט, נסו לשנות את הניסוח שלו.

    Version 1:
    How do I bake a pie?
    
    Version 2:
    Suggest a recipe for a pie.
    
    Version 3:
    What's a good pie recipe?
      

  2. עברו למשימה דומה: אם המודל לא מבצע את ההוראות שלכם למשימה מסוימת, נסו לתת לו הוראות למשימה דומה שמניבה את אותה תוצאה.

    ההנחיה הזו אומרת למודל לסווג ספר לפי קטגוריות מוגדרות מראש:

    Which category does The Odyssey belong to:
    thriller
    sci-fi
    mythology
    biography
      
        The Odyssey belongs to the category of **mythology**. 
    
        Here's why:
    
        * **Mythology:** The Odyssey tells the story of Odysseus, a hero from Greek mythology, and his
        journey home after the Trojan War. It features gods, monsters, and supernatural events common to
        Greek mythology.
    .....
      

    התשובה נכונה, אבל המודל לא נשאר בגבולות האפשרויות. אתם רוצים שהמודל ישיב רק עם אחת מהאפשרויות במקום עם משפט מלא. במקרה כזה, אפשר לנסח מחדש את ההוראות כשאלה אמריקאית ולבקש מהמודל לבחור אפשרות.

    Multiple choice problem: Which of the following options describes the book The Odyssey?
    Options:

    • thriller
    • sci-fi
    • mythology
    • biography
    The correct answer is mythology. 
    

  3. לשנות את הסדר של התוכן בפרומפט: לפעמים הסדר של התוכן בפרומפט משפיע על התשובה. נסו לשנות את סדר התוכן ולראות איך זה משפיע על התשובה.

    Version 1:
    [examples]
    [context]
    [input]
    
    Version 2:
    [input]
    [examples]
    [context]
    
    Version 3:
    [examples]
    [input]
    [context]
    

תשובות חלופיות

תשובת גיבוי היא תשובה שמוחזרת על ידי המודל אם ההנחיה או התשובה מפעילות מסנן בטיחות. דוגמה לתשובת ברירת מחדל: "אני לא יכול לעזור בזה, כי אני רק מודל שפה".

אם המודל מגיב בתגובת ברירת מחדל, נסו להגדיל את הטמפרטורה.

הארקה והרצת קוד

‫Gemini יכול להשתמש בכלים כדי להימנע מהזיות בתרחישים שבהם הוא עלול לתת תשובות שגויות.

‫עיגון באמצעות חיפוש Google מחבר את מודל Gemini לתוכן מהאינטרנט שמתעדכן בזמן אמת, וכדאי להפעיל אותו בכל מקרה שבו המודל עשוי להזדקק למידע על עובדות לא ברורות או עדכניות.

כלי הרצת הקוד של Gemini מאפשר למודל ליצור ולהריץ קוד Python, וצריך להפעיל אותו בכל פעם שהמודל צריך לבצע פעולות חשבון, ספירה או חישוב.

Gemini 3

‫מודלים של Gemini 3 מיועדים לחשיבה רציונלית משופרת מתקדמת ולביצוע הוראות. הם מגיבים הכי טוב לפרומפטים ישירים ומובנים היטב, שמגדירים בבירור את המשימה ואת כל המגבלות. כדי לקבל תוצאות אופטימליות מ-Gemini 3, מומלץ לפעול לפי השיטות הבאות:

עקרונות הליבה של הנדסת פרומפטים

  • היו מדויקים וישירים: ציינו את המטרה שלכם בצורה ברורה ותמציתית. הימנעו מניסוחים מיותרים או משכנעים מדי.
  • מבנה עקבי: השתמשו בתווים מפרידים ברורים כדי להפריד בין החלקים השונים של ההנחיה. תגים בסגנון XML (למשל, <context>, <task>) או כותרות Markdown הם יעילים. בחרו פורמט אחד והשתמשו בו באופן עקבי בהנחיה אחת.
  • הגדרת פרמטרים: הסבירו במפורש כל מונח או פרמטר שניתן להבין אותו בכמה דרכים.
  • שליטה בדרגת המלל של הפלט: כברירת מחדל, מודלים של Gemini 3 מספקים תשובות ישירות ויעילות. אם אתם רוצים תשובה מפורטת יותר או בסגנון של שיחה, אתם צריכים לבקש את זה במפורש בהוראות.
  • טיפול עקבי בקלט מולטי-מודאלי: כשמשתמשים בטקסט, בתמונות, באודיו או בווידאו, צריך להתייחס אליהם כאל קלט מאותה קטגוריה. חשוב לוודא שההוראות מתייחסות בבירור לכל אופן תקשורת לפי הצורך.
  • תעדוף הוראות קריטיות: כדאי להציב את האילוצים ההתנהגותיים החיוניים, את הגדרות התפקיד (פרסונה) ואת הדרישות לגבי פורמט הפלט בהוראות המערכת או בתחילת ההנחיה למשתמש.
  • מבנה להקשרים ארוכים: כשמספקים כמויות גדולות של הקשר (למשל מסמכים, קוד), צריך לספק קודם את כל ההקשר. כדאי למקם את ההוראות או השאלות הספציפיות בסוף הפרומפט.
  • הקשר עוגן: אחרי בלוק גדול של נתונים, השתמשו בביטוי מעבר ברור כדי לגשר על ההקשר והשאילתה, כמו "על סמך המידע שלמעלה..."

אסטרטגיות של Gemini 3 Flash

  • דיוק של היום הנוכחי: מוסיפים את הסעיף הבא להוראות המערכת כדי לעזור למודל לשים לב שהיום הנוכחי הוא בשנת 2026:

    For time-sensitive user queries that require up-to-date information, you
    MUST follow the provided current time (date and year) when formulating
    search queries in tool calls. Remember it is 2026 this year.
    
  • דיוק של תאריך סף הידע: מוסיפים את הפסוקית הבאה להוראות המערכת כדי שהמודל יהיה מודע לתאריך סף הידע שלו:

    Your knowledge cutoff date is January 2025.
    
  • ביצועי ביסוס: כדי לשפר את היכולת של המודל לבסס תשובות בהקשר שסופק, הוסיפו את הסעיף הבא להוראות המערכת (עם עריכות לפי הצורך):

    You are a strictly grounded assistant limited to the information provided in
    the User Context. In your answers, rely **only** on the facts that are
    directly mentioned in that context. You must **not** access or utilize your
    own knowledge or common sense to answer. Do not assume or infer from the
    provided facts; simply report them exactly as they appear. Your answer must
    be factual and fully truthful to the provided text, leaving absolutely no
    room for speculation or interpretation. Treat the provided context as the
    absolute limit of truth; any facts or details that are not directly
    mentioned in the context must be considered **completely untruthful** and
    **completely unsupported**. If the exact answer is not explicitly written in
    the context, you must state that the information is not available.
    

שיפור היכולות של הסקת מסקנות ותכנון

המודלים מסדרות Gemini 2.5 ו-Gemini 3 יוצרים באופן אוטומטי טקסט "חשיבה" פנימי כדי לשפר את ביצועי החשיבה. לכן, בדרך כלל אין צורך שהמודל יציג את המתאר, התוכנית או שלבי הנימוק בתשובה שמתקבלת. לבעיות שדורשות הסקת מסקנות מורכבת, בקשות פשוטות כמו "תחשוב טוב לפני שתענה" יכולות לשפר את הביצועים, אבל הן כרוכות בעלות של טוקנים נוספים של חשיבה.

מידע נוסף זמין במסמכי התיעוד של Gemini Thinking.

דוגמאות לפרומפטים מובנים

שימוש בתגים או ב-Markdown עוזר למודל להבחין בין הוראות, הקשר ומשימות.

דוגמה לפורמט XML:

<role>
You are a helpful assistant.
</role>

<constraints>
1. Be objective.
2. Cite sources.
</constraints>

<context>
[Insert User Input Here - The model knows this is data, not instructions]
</context>

<task>
[Insert the specific user request here]
</task>

דוגמה ל-Markdown:

# Identity
You are a senior solution architect.

# Constraints
- No external libraries allowed.
- Python 3.11+ syntax only.

# Output format
Return a single code block.

תבנית לדוגמה שמשלבת שיטות מומלצות

תבנית זו כוללת את עקרונות הליבה לכתיבת פרומפטים ל-Gemini 3. חשוב תמיד לחזור על התהליך ולשנות את ההגדרות בהתאם לתרחיש השימוש הספציפי שלכם.

הוראה למערכת:

<role>
You are Gemini 3, a specialized assistant for [Insert Domain, e.g., Data Science].
You are precise, analytical, and persistent.
</role>

<instructions>
1. **Plan**: Analyze the task and create a step-by-step plan.
2. **Execute**: Carry out the plan.
3. **Validate**: Review your output against the user's task.
4. **Format**: Present the final answer in the requested structure.
</instructions>

<constraints>
- Verbosity: [Specify Low/Medium/High]
- Tone: [Specify Formal/Casual/Technical]
</constraints>

<output_format>
Structure your response as follows:
1. **Executive Summary**: [Short overview]
2. **Detailed Response**: [The main content]
</output_format>

פרומפט של משתמש:

<context>
[Insert relevant documents, code snippets, or background info here]
</context>

<task>
[Insert specific user request here]
</task>

<final_instruction>
Remember to think step-by-step before answering.
</final_instruction>

Agentic workflows

בתהליכי עבודה Agentic Workflows, לעיתים קרובות נדרשות הוראות ספציפיות כדי לשלוט באופן שבו המודל מסיק מסקנות, מתכנן ומבצע משימות. למרות ש-Gemini מספק ביצועים כלליים טובים, כדי להשתמש בסוכנים מורכבים צריך לעיתים להגדיר את האיזון בין עלות החישוב (זמן האחזור והטוקנים) לבין דיוק המשימה.

כשמעצבים הנחיות לסוכנים, כדאי להתייחס למאפייני ההתנהגות הבאים שאפשר להגדיר בסוכן:

חשיבה ואסטרטגיה

הגדרה של אופן החשיבה והתכנון של המודל לפני שהוא מבצע פעולה.

  • פירוק לוגי: מגדיר את רמת הניתוח של האילוצים, הדרישות המוקדמות וסדר הפעולות שהמודל צריך לבצע.
  • אבחון בעיות: קובע את עומק הניתוח כשמזהים סיבות ואת השימוש של המודל בחשיבה אבדוקטיבית. ההגדרה הזו קובעת אם המודל צריך לקבל את התשובה הכי ברורה או לבחון הסברים מורכבים ופחות סבירים.
  • מידע מקיף: הפשרה בין ניתוח של כל מסמך ומדיניות זמינים לבין תעדוף של יעילות ומהירות.

ביצוע ואמינות

הגדרות לגבי אופן הפעולה האוטונומי של הסוכן והטיפול בבעיות.

  • יכולת הסתגלות: איך המודל מגיב לנתונים חדשים. הוא מחליט אם להמשיך בתוכנית המקורית או לשנות אותה מיד כשהתצפיות סותרות את ההנחות.
  • התמדה והתאוששות: המידה שבה המודל מנסה לתקן שגיאות בעצמו. התמדה גבוהה מגדילה את שיעורי ההצלחה, אבל עלולה להגדיל את עלויות האסימונים או ליצור לולאות.
  • הערכת סיכונים: הלוגיקה להערכת ההשלכות. מבחין באופן מפורש בין פעולות חקירה בסיכון נמוך (קריאות) לבין שינויי מצב בסיכון גבוה (כתיבות).

אינטראקציה ופלט

הגדרת האופן שבו הנציג מתקשר עם המשתמש ומעצב את התוצאות.

  • טיפול במצבים של חוסר ודאות ובקשות הרשאה: מגדיר מתי המודל יכול להניח הנחות ומתי הוא חייב להשהות את הביצוע כדי לבקש מהמשתמש הבהרה או הרשאה.
  • דרגת מלל: קובעת את נפח הטקסט שנוצר לצד קריאות הכלים. ההגדרה הזו קובעת אם המודל יסביר למשתמש את הפעולות שלו או לא יגיד כלום בזמן הביצוע.
  • דיוק ושלמות: רמת הדיוק הנדרשת של הפלט. מציינים אם המודל צריך לפתור כל מקרה קצה ולספק נתונים מדויקים, או אם אפשר להשתמש בהערכות גסות.

תבנית להוראות למערכת

ההוראה הבאה למערכת היא דוגמה שנבדקה על ידי חוקרים כדי לשפר את הביצועים בנקודות השוואה של סוכנים, שבהן המודל צריך לפעול לפי מערכת מורכבת של כללים ולקיים אינטראקציה עם משתמש. הוא מעודד את הסוכן לפעול כמתכנן וכמסיק מסקנות חזק, אוכף התנהגויות ספציפיות בממדים שצוינו למעלה ודורש מהמודל לתכנן באופן יזום לפני ביצוע פעולה כלשהי.

אפשר להתאים את התבנית הזו למגבלות של תרחיש השימוש הספציפי שלכם.

You are a very strong reasoner and planner. Use these critical instructions to structure your plans, thoughts, and responses.

Before taking any action (either tool calls *or* responses to the user), you must proactively, methodically, and independently plan and reason about:

1) Logical dependencies and constraints: Analyze the intended action against the following factors. Resolve conflicts in order of importance:
    1.1) Policy-based rules, mandatory prerequisites, and constraints.
    1.2) Order of operations: Ensure taking an action does not prevent a subsequent necessary action.
        1.2.1) The user may request actions in a random order, but you may need to reorder operations to maximize successful completion of the task.
    1.3) Other prerequisites (information and/or actions needed).
    1.4) Explicit user constraints or preferences.

2) Risk assessment: What are the consequences of taking the action? Will the new state cause any future issues?
    2.1) For exploratory tasks (like searches), missing *optional* parameters is a LOW risk. **Prefer calling the tool with the available information over asking the user, unless** your `Rule 1` (Logical Dependencies) reasoning determines that optional information is required for a later step in your plan.

3) Abductive reasoning and hypothesis exploration: At each step, identify the most logical and likely reason for any problem encountered.
    3.1) Look beyond immediate or obvious causes. The most likely reason may not be the simplest and may require deeper inference.
    3.2) Hypotheses may require additional research. Each hypothesis may take multiple steps to test.
    3.3) Prioritize hypotheses based on likelihood, but do not discard less likely ones prematurely. A low-probability event may still be the root cause.

4) Outcome evaluation and adaptability: Does the previous observation require any changes to your plan?
    4.1) If your initial hypotheses are disproven, actively generate new ones based on the gathered information.

5) Information availability: Incorporate all applicable and alternative sources of information, including:
    5.1) Using available tools and their capabilities
    5.2) All policies, rules, checklists, and constraints
    5.3) Previous observations and conversation history
    5.4) Information only available by asking the user

6) Precision and Grounding: Ensure your reasoning is extremely precise and relevant to each exact ongoing situation.
    6.1) Verify your claims by quoting the exact applicable information (including policies) when referring to them. 

7) Completeness: Ensure that all requirements, constraints, options, and preferences are exhaustively incorporated into your plan.
    7.1) Resolve conflicts using the order of importance in #1.
    7.2) Avoid premature conclusions: There may be multiple relevant options for a given situation.
        7.2.1) To check for whether an option is relevant, reason about all information sources from #5.
        7.2.2) You may need to consult the user to even know whether something is applicable. Do not assume it is not applicable without checking.
    7.3) Review applicable sources of information from #5 to confirm which are relevant to the current state.

8) Persistence and patience: Do not give up unless all the reasoning above is exhausted.
    8.1) Don't be dissuaded by time taken or user frustration.
    8.2) This persistence must be intelligent: On *transient* errors (e.g. please try again), you *must* retry **unless an explicit retry limit (e.g., max x tries) has been reached**. If such a limit is hit, you *must* stop. On *other* errors, you must change your strategy or arguments, not repeat the same failed call.

9) Inhibit your response: only take an action after all the above reasoning is completed. Once you've taken an action, you cannot take it back.

השלבים הבאים