While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models here.
Das Vorfüllen ist nur für Modi ohne erweitertes Denken verfügbar. Es wird derzeit nicht mit erweitertem Denken unterstützt.
Assistant
-Nachricht vorfüllen. Diese leistungsstarke Technik ermöglicht es Ihnen, Claudes Aktionen zu steuern, Einleitungen zu überspringen, bestimmte Formate wie JSON oder XML zu erzwingen und Claude sogar dabei zu helfen, in Rollenspielszenarien Charakterkonsistenz zu wahren.
In einigen Fällen, in denen Claude nicht wie erwartet funktioniert, können ein paar vorausgefüllte Sätze die Leistung von Claude erheblich verbessern. Ein wenig Vorfüllen bewirkt viel!
Wie man Claudes Antwort vorfüllt
Um vorzufüllen, fügen Sie den gewünschten Anfangstext in dieAssistant
-Nachricht ein (Claudes Antwort wird dort fortgesetzt, wo die Assistant
-Nachricht aufhört):
Der vorgefüllte Inhalt darf nicht mit Leerzeichen am Ende enden. Eine Vorfüllung wie
"As an AI assistant, I "
(mit einem Leerzeichen am Ende) führt zu einem Fehler.Beispiele
Beispiel 1: Steuerung der Ausgabeformatierung und Überspringen der Einleitung
Profi-Tipp: Das Vorfüllen von
{
zwingt Claude dazu, die Einleitung zu überspringen und direkt das JSON-Objekt auszugeben. Dies ist sauberer, präziser und für Programme leichter zu analysieren, ohne zusätzliche Verarbeitung.Beispiel: Strukturierte Datenextraktion ohne Vorfüllung
Beispiel: Strukturierte Datenextraktion ohne Vorfüllung
Rolle | Inhalt |
---|---|
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! |
Beispiel: Strukturierte Datenextraktion mit Vorfüllung
Beispiel: Strukturierte Datenextraktion mit Vorfüllung
Rolle | Inhalt |
---|---|
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” ] } |
Beispiel 2: Charakterkonsistenz in Rollenspielszenarien bewahren
Rollenspiel-Tipp: Das Vorfüllen eines in eckige Klammern gesetzten
[ROLLEN_NAME]
kann Claude daran erinnern, im Charakter zu bleiben, selbst bei längeren und komplexeren Gesprächen. Dies ist besonders wirkungsvoll, wenn es mit Rollenprompting im system
-Parameter kombiniert wird.Beispiel: Charakterkonsistenz ohne Rollenprompting
Beispiel: Charakterkonsistenz ohne Rollenprompting
Rolle | Inhalt |
---|---|
User (50 Gesprächsrunden mit “Sherlock Holmes” Claude) | 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… |
Beispiel: Charakterkonsistenz mit Rollenprompting
Beispiel: Charakterkonsistenz mit Rollenprompting
Rolle | Inhalt |
---|---|
User (50 Gesprächsrunden mit “Sherlock Holmes” Claude) | 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! |
Prompt-Bibliothek
Lassen Sie sich von einer kuratierten Auswahl von Prompts für verschiedene Aufgaben und Anwendungsfälle inspirieren.
GitHub Prompting-Tutorial
Ein beispielreiches Tutorial, das die Prompt-Engineering-Konzepte aus unserer Dokumentation behandelt.
Google Sheets Prompting-Tutorial
Eine leichtgewichtigere Version unseres Prompt-Engineering-Tutorials über eine interaktive Tabelle.