A partire dal 29 aprile 2025, i modelli Gemini 1.5 Pro e Gemini 1.5 Flash non sono disponibili nei progetti che non li hanno mai utilizzati, inclusi i nuovi progetti. Per maggiori dettagli, vedi Versioni e ciclo di vita dei modelli.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Fornire al modello istruzioni su cosa fare è un modo efficace ed efficiente per personalizzare il suo comportamento. Fornisci istruzioni chiare, concise e dirette, fornendo il contesto necessario e delineato l'output desiderato. Le istruzioni possono essere semplici come un elenco di istruzioni passo passo o complesse come la mappatura dell'esperienza e del modo di pensare di un utente.
Come scrivere istruzioni efficaci
Le istruzioni efficaci si basano sui seguenti principi:
Indica al modello cosa fare.
Sii chiaro e specifico.
Specifica eventuali vincoli o requisiti di formattazione per l'output.
Esempio
Ad esempio, supponiamo che tu possieda un ristorante di cheeseburger e voglia utilizzare un modello per scoprire quali sono i piatti più apprezzati. Vuoi che il modello formatti le trascrizioni degli ordini dei clienti in JSON in modo da poter identificare rapidamente gli elementi del menu. Le seguenti tabelle
mostrano le diverse risposte fornite dal modello quando vengono fornite istruzioni generiche e specifiche
che seguono i principi di istruzione:
Istruzioni generiche
Extract the transcript in JSON.
Transcript:
Speaker 1 (Customer): Hi, can I get a cheeseburger and large fries, please?
Speaker 2 (Restaurant employee): Coming right up! Anything else you'd like to add to your order?
Speaker 1: Hmmm, maybe a small orange juice. And could I get the fries with ketchup on the side?
Speaker 2: No problem, one cheeseburger, one large fries with ketchup on the side, and a small
orange juice. That'll be $5.87. Drive through to the next window please.
{
"speakers": [
{
"speaker": "Customer",
"utterances": [
"Hi, can I get a cheeseburger and large fries, please?"
]
},
{
"speaker": "Restaurant Employee",
"utterances": [
"Coming right up! Anything else you'd like to add to your order?"
]
},
{
"speaker": "Customer",
"utterances": [
"Hmm, maybe a small orange juice. And could I get the fries with ketchup on the
side?"
]
},
{
"speaker": "Restaurant Employee",
"utterances": [
"No problem, one cheeseburger, one large fries with ketchup on the side, and a
small orange juice. That'll be $5.87. Drive through to the next window please."
]
}
]
}
Nell'esempio, le istruzioni generiche generano una risposta con più campi JSON di quelli necessari per identificare gli elementi del menu ordinati dai clienti. Migliora le istruzioni definendo vincoli di output più specifici, come mostrato nella seguente tabella:
Istruzioni specifiche
Extract the items from this transcript in JSON and separate drinks from food.
Transcript:
Speaker 1 (Customer): Hi, can I get a cheeseburger and large fries, please?
Speaker 2 (Restaurant employee): Coming right up! Anything else you'd like to add to your order?
Speaker 1: Hmmm, maybe a small orange juice. And could I get the fries with ketchup on the side?
Speaker 2: No problem, one cheeseburger, one large fries with ketchup on the side, and a small
orange juice. That'll be $5.87. Drive through to the next window please.
Applicando i principi di istruzione, questo esempio è passato da una risposta che conteneva troppi dati a una che conteneva esattamente i dati richiesti per questo caso d'uso. Le istruzioni che utilizzano i principi di istruzione possono aiutarti a guidare il modello a fornire la risposta più utile per il tuo caso d'uso.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Give clear and specific instructions\n\nGiving the model instructions on what to do is an effective and efficient way to customize model\nbehavior. Be clear, concise, and direct in the instructions, providing the needed context and\noutlining the desired output. Instructions can be as simple as a list of step-by-step instructions\nor as complex as mapping out a user's experience and mindset.\n\nHow to write effective instructions\n-----------------------------------\n\nEffective instructions apply the following principles:\n\n- Tell the model what to do.\n- Be clear and specific.\n- Specify any constraints or formatting requirements for the output.\n\n### Example\n\nFor example, suppose you own a cheeseburger restaurant and you want to use a model to help you\nlearn about which menu items are the most popular. You want the model to format transcripts of\ncustomer orders in JSON so that you can quickly identify menu items. The following tables\ndemonstrate the different responses the model provides when given generic instructions and specific\ninstructions that follow the instruction principles:\n\nIn the example, generic instructions lead to a response with more JSON fields than what you need to identify the menu items customers are ordering. Improve the instructions by making more specific output constraints, as demonstrated in the following table:\n\nBy applying the instruction principles, this example went from a response that contained too\nmuch data to one that contained exactly the data required for this use case. Instructions that use\nthe instruction princples can help you guide the model to deliver the most helpful response for\nyour use case.\n\nWhat's next\n-----------\n\n- Explore more examples of prompts in the [Prompt gallery](/vertex-ai/generative-ai/docs/prompt-gallery)."]]