Mulai 29 April 2025, model Gemini 1.5 Pro dan Gemini 1.5 Flash tidak tersedia di project yang belum pernah menggunakan model ini, termasuk project baru. Untuk mengetahui detailnya, lihat Versi dan siklus proses model.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk mendapatkan respons berkualitas tinggi dari model, berikan petunjuk yang jelas dan spesifik. Halaman ini berisi contoh yang menunjukkan cara menulis perintah yang efektif.
Memberikan petunjuk pada model tentang apa yang harus dilakukan adalah cara yang efektif dan efisien untuk menyesuaikan perilaku model. Berikan petunjuk yang jelas, ringkas, dan langsung, dengan memberikan konteks yang diperlukan dan menguraikan output yang diinginkan. Petunjuk dapat berupa daftar petunjuk langkah demi langkah yang sederhana
atau serumit memetakan pengalaman dan pola pikir pengguna.
Cara menulis petunjuk yang efektif
Petunjuk yang efektif menerapkan prinsip-prinsip berikut:
Beri tahu model apa yang harus dilakukan.
Harus jelas dan spesifik.
Tentukan batasan atau persyaratan pemformatan untuk output.
Contoh
Misalnya, Anda memiliki restoran burger keju dan ingin menggunakan model untuk membantu Anda mempelajari item menu mana yang paling populer. Anda ingin model memformat transkrip pesanan pelanggan dalam JSON sehingga Anda dapat dengan cepat mengidentifikasi item menu. Tabel berikut menunjukkan berbagai respons yang diberikan model saat diberi petunjuk umum dan petunjuk spesifik yang mengikuti prinsip petunjuk:
Petunjuk umum
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."
]
}
]
}
Dalam contoh, petunjuk umum menghasilkan respons dengan lebih banyak kolom JSON daripada yang Anda butuhkan untuk mengidentifikasi item menu yang dipesan pelanggan. Tingkatkan kualitas petunjuk dengan membuat batasan output yang lebih spesifik, seperti yang ditunjukkan dalam tabel berikut:
Petunjuk khusus
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.
Dengan menerapkan prinsip petunjuk, contoh ini berubah dari respons yang berisi terlalu banyak data menjadi respons yang berisi data yang diperlukan untuk kasus penggunaan ini. Petunjuk yang menggunakan
prinsip petunjuk dapat membantu Anda memandu model untuk memberikan respons yang paling berguna untuk
kasus penggunaan Anda.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-25 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)."]]