Assistant
. Teknik yang ampuh ini memungkinkan Anda mengarahkan tindakan Claude, melewati pendahuluan, menegakkan format spesifik seperti JSON atau XML, dan bahkan membantu Claude mempertahankan konsistensi karakter dalam skenario role-play.
Dalam beberapa kasus di mana Claude tidak berfungsi seperti yang diharapkan, beberapa kalimat yang diisi awal dapat sangat meningkatkan kinerja Claude. Sedikit pengisian awal bisa sangat berpengaruh!
Assistant
(respons Claude akan melanjutkan dari tempat pesan Assistant
berakhir):
"As an AI assistant, I "
(dengan spasi di akhir) akan menghasilkan error.{
memaksa Claude untuk melewati pendahuluan dan langsung mengeluarkan objek JSON. Ini lebih bersih, lebih ringkas, dan lebih mudah diurai oleh program tanpa pemrosesan tambahan.Contoh: Ekstraksi data terstruktur tanpa pengisian awal
Peran | Konten |
---|---|
User | Extract the name, size, price, and color from this product description as a JSON object: <description> The SmartHome Mini is a compact smart home assistant available in black or white for only $49.99. At just 5 inches wide, it lets you control lights, thermostats, and other connected devices via voice or app—no matter where you place it in your home. This affordable little hub brings convenient hands-free control to your smart devices. </description> |
Assistant | Here’s the extracted information in JSON format: ```json { “name”: “SmartHome Mini”, “size”: “5 inches wide”, “price”: “$49.99”, “colors”: [“black”, “white”] } ``` I’ve extracted the following details from the product description: - Name: SmartHome Mini - Size: 5 inches wide - Price: $49.99 - Colors: Available in black and white The JSON object provides a structured format that’s easy for programs to parse and use. Let me know if you need any modifications or have any other questions! |
Contoh: Ekstraksi data terstruktur dengan pengisian awal
Peran | Konten |
---|---|
User | Extract the name, size, price, and color from this product description as a JSON object: <description> The SmartHome Mini is a compact smart home assistant available in black or white for only $49.99. At just 5 inches wide, it lets you control lights, thermostats, and other connected devices via voice or app—no matter where you place it in your home. This affordable little hub brings convenient hands-free control to your smart devices. </description> |
Assistant (prefill) | { |
Assistant (Claude’s response) | “name”: “SmartHome Mini”, “size”: “5 inches wide”, “price”: “$49.99”, “colors”: [ “black”, “white” ] } |
[NAMA_PERAN]
dalam tanda kurung dapat mengingatkan Claude untuk tetap berperan, bahkan untuk percakapan yang lebih panjang dan kompleks. Ini sangat ampuh ketika dikombinasikan dengan role prompting dalam parameter system
.Contoh: Mempertahankan karakter tanpa role prompting
Peran | Konten |
---|---|
User (50 putaran percakapan dengan Claude “Sherlock Holmes”) | What do you deduce about the owner of this shoe? <image>muddy_shoe.jpg</image> |
Assistant | As an AI assistant, I would be happy to analyze the image of a muddy shoe as if you had provided it. Here’s my deduction… |
Contoh: Mempertahankan karakter dengan role prompting
Peran | Konten |
---|---|
User (50 putaran percakapan dengan Claude “Sherlock Holmes”) | What do you deduce about the owner of this shoe? <image>muddy_shoe.jpg</image> |
Assistant (prefill) | [Sherlock Holmes] |
Assistant (Claude’s response) | Ah, what have we here? A most curious specimen, Watson! Let us examine this shoe with a discerning eye. The mud, you see, is not your common London clay, but rather the distinctive reddish hue of the iron-rich soil found only in the environs of Hampstead Heath. And yet, the wear on the sole suggests a gait more suited to the cobblestones of Whitechapel than the gentle slopes of the Heath. Now, observe the laces! They are tied with a particular knot favored by those in the medical profession—doubtless a habit acquired during years of tying surgical gowns. But the scuff marks on the toe box tell a different tale: they are consistent with the kicking motion one might employ in the martial arts, specifically Baritsu. We may conclude, then, that our absent shoe owner is a doctor, possibly a surgeon, who resides in Whitechapel but frequents Hampstead Heath—perhaps for a secret Baritsu practice, away from prying eyes. A most intriguing case, Watson! We must make haste; the game is afoot! |