Assistant
메시지를 미리 채워서 응답을 안내할 수 있는 고유한 기능이 있습니다. 이 강력한 기술을 통해 Claude의 행동을 지시하고, 서문을 건너뛰고, JSON이나 XML과 같은 특정 형식을 강제하고, 심지어 역할극 시나리오에서 Claude가 캐릭터 일관성을 유지하도록 도울 수 있습니다.
Claude가 예상대로 수행하지 않는 일부 경우에는 몇 문장을 미리 채우는 것만으로도 Claude의 성능을 크게 향상시킬 수 있습니다. 약간의 미리 채우기가 큰 효과를 발휘합니다!
Assistant
메시지에 원하는 초기 텍스트를 포함시키세요(Claude의 응답은 Assistant
메시지가 끝나는 지점부터 계속됩니다):
"As an AI assistant, I "
같이 끝에 공백이 있는 미리 채우기는 오류가 발생합니다.{
로 미리 채우면 Claude가 서문을 건너뛰고 JSON 객체를 직접 출력하도록 강제합니다. 이는 더 깔끔하고 간결하며 추가 처리 없이 프로그램이 구문 분석하기 쉽습니다.예시: 미리 채우기 없는 구조화된 데이터 추출
역할 | 내용 |
---|---|
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! |
예시: 미리 채우기를 사용한 구조화된 데이터 추출
역할 | 내용 |
---|---|
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” ] } |
[ROLE_NAME]
을 미리 채우면 Claude가 더 길고 복잡한 대화에서도 캐릭터를 유지하도록 상기시킬 수 있습니다. 이는 특히 system
매개변수에서 역할 프롬프팅과 결합할 때 매우 강력합니다.예시: 역할 프롬프팅 없이 캐릭터 유지하기
역할 | 내용 |
---|---|
User (“셜록 홈즈” Claude와 50번의 대화 차례 후) | 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… |
예시: 역할 프롬프팅으로 캐릭터 유지하기
역할 | 내용 |
---|---|
User (“셜록 홈즈” Claude와 50번의 대화 차례 후) | 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! |