검색
검색
공개 노트 검색
회원가입로그인

클로드 프롬프트 Tutorial: 고객 서비스 콜 기록 요약하기

Tutorial: 고객 서비스 콜 기록 요약하기

소개

이 튜토리얼에서는 고객 서비스 콜 기록을 요약하기 위한 복잡한 프롬프트를 작성하는 방법에 대해 배웁니다. Acme Corporation이라는 스마트 홈 장치 제조 회사에서 일한다고 가정합니다. 이 회사는 매일 수백 건의 고객 서비스 전화를 처리하며, 이러한 대화를 유용한 구조화된 데이터로 변환하는 빠른 방법이 필요합니다.

목표

전체 고객 서비스 콜을 요약하여 고객 지원 팀의 효율성을 평가하는 것이 목표입니다. 효과적인 요약을 방해하는 연결 문제, 언어 장벽, 기타 문제들이 포함된 콜들은 제외합니다.

중요 고려 사항

  • 전화 통화는 아주 짧거나 매우 복잡할 수 있습니다.

  • 고객은 간단한 Wi-Fi 연결 문제부터 복잡한 시스템 오작동까지 다양한 문제를 상담할 수 있습니다.

  • 요약은 나중에 분석이 용이하도록 특정 형식으로 제공해야 합니다.

  • 요약 내용에 고객 개인 정보를 포함하지 않도록 해야 합니다.

데이터 이해하기

아래는 Acme Corporation의 스마트 홈 장치 지원 팀에게서 수집된 다양한 고객 서비스 콜 기록의 예입니다:

콜 기록 예시

  1. 짧고 간단한 기록:

    Agent: Thank you for calling Acme Smart Home Support. This is Alex. How can I help you?
    Customer: Hi, I can't turn on my smart light bulb.
    Agent: I see. Have you tried resetting the bulb?
    Customer: Oh, no. How do I do that?
    Agent: Just turn the power off for 5 seconds, then back on. It should reset.
    Customer: Ok, I'll try that. Thanks!
    Agent: You're welcome. Call us back if you need further assistance.
  2. 중간 길이 기록과 해결:

    Agent: Acme Smart Home Support, this is Jamie. How may I assist you today?
    Customer: Hi Jamie, my Acme SmartTherm isn't maintaining the temperature I set. It's set to 72 but the house is much warmer.
    Agent: I'm sorry to hear that. Let's troubleshoot. Is your SmartTherm connected to Wi-Fi?
    Customer: Yes, the Wi-Fi symbol is showing on the display.
    Agent: Great. Let's recalibrate your SmartTherm. Press and hold the menu button for 5 seconds.
    Customer: Okay, done. A new menu came up.
    Agent: Perfect. Navigate to "Calibration" and press select. Adjust the temperature to match your room thermometer.
    Customer: Alright, I've set it to 79 degrees to match.
    Agent: Great. Press select to confirm. It will recalibrate, which may take a few minutes. Check back in an hour to see if it's fixed.
    Customer: Okay, I'll do that. Thank you for your help, Jamie.
    Agent: You're welcome! Is there anything else I can assist you with today?
    Customer: No, that's all. Thanks again.
    Agent: Thank you for choosing Acme Smart Home. Have a great day!
  3. 해결되지 않은 긴 콜 기록:

    Agent: Thank you for contacting Acme Smart Home Support. This is Sarah. How can I help you today?
    Customer: Hi Sarah, I'm having trouble with my Acme SecureHome system. The alarm keeps going off randomly.
    Agent: I'm sorry to hear that. Can you tell me when this started happening?
    Customer: It started about two days ago. It's gone off three times now, always in the middle of the night.
    Agent: I see. Are there any error messages on the control panel when this happens?
    Customer: No, I didn't notice any. But I was pretty groggy each time.
    Agent: Understood. Let's check a few things. First, can you confirm that all your doors and windows are closing properly?
    Customer: Yes, I've checked all of them. They're fine.
    Agent: Okay. Next, let's check the battery in your control panel. Can you tell me if the low battery indicator is on?
    Customer: Give me a moment... No, the battery indicator looks normal.
    Agent: Alright. It's possible that one of your sensors is malfunctioning. I'd like to run a diagnostic, but I'll need to transfer you to our technical team for that. Is that okay?
    Customer: Yes, that's fine. I just want this fixed. It's really disruptive.
    Agent: I completely understand. I'm going to transfer you now. They'll be able to run a full system diagnostic and hopefully resolve the issue for you.
    Customer: Okay, thank you.
    Agent: You're welcome. Thank you for your patience, and I hope you have a great rest of your day.

프롬프트 작성하기

기본 프롬프트

아래는 초기 프롬프트의 예시입니다. 이 프롬프트는 기본 과제를 설명합니다:

Summarize the following customer service call transcript. Focus on the main issue, how it was resolved, and any required follow-up.

{transcript}

이 프롬프트는 몇 가지 제한 사항이 있습니다:

  • 원하는 출력 형식을 명시하지 않아 일관성 없는 요약을 제공할 수 있습니다.

  • 각 상황에 대한 명확한 지침을 제공하지 않습니다(예: 해결되지 않은 문제나 정보가 부족한 경우 등).

  • 길이나 내용에 대한 제한을 설정하지 않아 지나치게 길거나 자세한 요약을 제공할 수 있습니다.

  • 개인정보를 생략하라는 지시가 없어 개인정보 보호 문제를 초래할 수 있습니다.

시스템 프롬프트 추가하기

시스템 프롬프트를 사용하여 Claude의 전반적인 컨텍스트와 역할을 설정할 수 있습니다:

You are an expert customer service analyst, skilled at extracting key information from call transcripts and summarizing them in a structured format.
Your task is to analyze customer service call transcripts and generate concise, accurate summaries while maintaining a professional tone.

프롬프트 구조화하기

프롬프트를 보다 효율적으로 사용하기 위해 다음 사항을 고려합니다:

  • 긴 문서(콜 기록)는 프롬프트 상단에 배치합니다.

  • 자세한 지침과 출력 형식 요구 사항을 추가합니다.

  • XML 태그를 사용하여 프롬프트 및 출력 구조화합니다.

  • Claude에게 '생각을 소리내어 표현'할 공간을 제공합니다.

이러한 방법으로 긴 프롬프트 작성 시각적 요소를 개선할 수 있습니다.

입력 데이터

긴 문서와 같이 콜 기록을 프롬프트 상단에 배치하고 XML 태그를 사용하여 작업할 문서를 식별합니다:

Analyze the following customer service call transcript and generate a JSON summary of the interaction:

<transcript>
[INSERT CALL TRANSCRIPT HERE]
</transcript>

출력 형식 및 지침

출력 결과를 쉽게 분석할 수 있도록 Claude에게 JSON 응답을 요청합니다.

출력 JSON에는 다음을 포함해야 합니다:

  • 고객 문제 요약

  • 문제가 해결되었는지 여부

  • 후속 조치가 필요한지 여부 및 관련 정보

  • 대화에서 발생한 모호한 점

코드 예시 및 테스트

다음은 개선된 코드 예시와 테스트 방법입니다. 고객 서비스 콜 기록을 분석하고 요약을 제공하는 함수를 작성합니다:

import re
from anthropic import Anthropic
from dotenv import load_dotenv

load_dotenv()
client = Anthropic()

def summarize_call_with_final_prompt(transcript):
    final_prompt = prompt.replace("[INSERT CALL TRANSCRIPT HERE]", transcript)
    # Make the API call
    response = client.messages.create(
        model="claude-3-sonnet-20240229",
        system=system,
        max_tokens=4096,
        messages=[
            {"role": "user", "content": final_prompt}
        ]
    )
    
    # Extract content between <json> tags
    json_content = re.search(r'<json>(.*?)</json>', response.content[0].text, re.DOTALL)
    
    if json_content:
        print(json_content.group(1).strip())
    else:
        print("No JSON content found in the response.")

최종 프롬프트

최종 프롬프트에는 시스템 프롬프트 및 명확한 지침 포함:

system = """
You are an expert customer service analyst, skilled at extracting key information from call transcripts and summarizing them in a structured format.
Your task is to analyze customer service call transcripts and generate concise, accurate summaries while maintaining a professional tone.
"""

prompt = """
Analyze the following customer service call transcript and generate a JSON summary of the interaction:

<transcript>
[INSERT CALL TRANSCRIPT HERE]
</transcript>

Instructions:
<instructions>
1. Read the transcript carefully.
2. Analyze the transcript, focusing on the main issue, resolution, and any follow-up required.
3. Generate a JSON object summarizing the key aspects of the interaction according to the specified structure.

Important guidelines:
- Confidentiality: Omit all specific customer data like names, phone numbers, and email addresses.
- Character limit: Restrict each text field to a maximum of 100 characters.
- Maintain a professional tone in your summary.

Output format:
Generate a JSON object with the following structure:
<json>
{
  "summary": {
    "customerIssue": "Brief description of the main problem or reason for the call",
    "resolution": "How the issue was addressed or resolved, if applicable",
    "followUpRequired": true/false,
    "followUpDetails": "Description of any necessary follow-up actions, or null if none required"
  },
  "status": "COMPLETE",
  "ambiguities": ["List of any unclear or vague points in the conversation, or an empty array if none"]
}
</json>

Insufficient data criteria:
   If any of these conditions are met:
   a) The transcript has fewer than 5 total exchanges
   b) The customer's issue is unclear
   c) The call is garbled, incomplete, or is hindered by a language barrier
   Then return ONLY the following JSON:
   {
     "status": "INSUFFICIENT_DATA"
   }

Examples: 
<examples>
1. Complete interaction:
<transcript>
Agent: Thank you for calling Acme Smart Home Support. This is Alex. How may I assist you today?
Customer: Hi Alex, my Acme SmartTherm isn't maintaining the temperature I set. It's set to 72 but the house is much warmer.
Agent: I'm sorry to hear that. Let's troubleshoot. Is your SmartTherm connected to Wi-Fi?
Customer: Yes, the Wi-Fi symbol is showing on the display.
Agent: Great. Let's recalibrate your SmartTherm. Press and hold the menu button for 5 seconds.
Customer: Okay, done. A new menu came up.
Agent: Perfect. Navigate to "Calibration" and press select. Adjust the temperature to match your room thermometer.
Customer: Alright, I've set it to 79 degrees to match.
Agent: Great. Press select to confirm. It will recalibrate, which may take a few minutes. Check back in an hour to see if it's fixed.
Customer: Okay, I'll do that. Thank you for your help, Alex.
Agent: You're welcome! Is there anything else I can assist you with today?
Customer: No, that's all. Thanks again.
Agent: Thank you for choosing Acme Smart Home. Have a great day!
</transcript>

<thinking>
Main issue: SmartTherm not maintaining set temperature
Resolution: Guided customer through recalibration process
Follow-up: Not required, but customer should check effectiveness after an hour
Ambiguities: None identified
</thinking>

<json>
{
  "summary": {
    "customerIssue": "SmartTherm not maintaining set temperature, showing higher than set 72 degrees",
    "resolution": "Guided customer through SmartTherm recalibration process",
    "followUpRequired": false,
    "followUpDetails": null
  },
  "status": "COMPLETE",
  "ambiguities": []
}
</json>

2. Interaction requiring follow-up:
<transcript>
Agent: Acme Smart Home Support, this is Jamie. How can I help you?
Customer: Hi, I just installed my new Acme SmartCam, but I can't get it to connect to my Wi-Fi.
Agent: I'd be happy to help. Are you using the Acme Smart Home app?
Customer: Yes, I have the app on my phone.
Agent: Great. Make sure your phone is connected to the 2.4GHz Wi-Fi network, not the 5GHz one.
Customer: Oh, I'm on the 5GHz network. Should I switch?
Agent: Yes, please switch to the 2.4GHz network. The SmartCam only works with 2.4GHz.
Customer: Okay, done. Now what?
Agent: Open the app, select 'Add Device', choose 'SmartCam', and follow the on-screen instructions.
Customer: It's asking for a password now.
Agent: Enter your Wi-Fi password and it should connect.
Customer: It's still not working. I keep getting an error message.
Agent: I see. In that case, I'd like to escalate this to our technical team. They'll contact you within 24 hours.
Customer: Okay, that sounds good. Thank you for trying to help.
Agent: You're welcome. Is there anything else you need assistance with?
Customer: No, that's all for now. Thanks again.
Agent: Thank you for choosing Acme Smart Home. Have a great day!
</transcript>

<thinking>
Main issue: Customer unable to connect new SmartCam to Wi-Fi
Resolution: Initial troubleshooting unsuccessful, issue escalated to technical team
Follow-up: Required, technical team to contact customer within 24 hours
Ambiguities: Specific error message customer is receiving not mentioned
</thinking>

<json>
{
  "summary": {
    "customerIssue": "Unable to connect new SmartCam to Wi-Fi",
    "resolution": "Initial troubleshooting unsuccessful, issue escalated to technical team",
    "followUpRequired": true,
    "followUpDetails": "Technical team to contact customer within 24 hours for further assistance"
  },
  "status": "COMPLETE",
  "ambiguities": ["Specific error message customer is receiving not mentioned"]
}
</json>

3. Insufficient data:
<transcript>
Agent: Acme Smart Home Support, this is Sam. How may I assist you?
Customer: Hi, my smart lock isn't working.
Agent: I'm sorry to hear that. Can you tell me more about the issue?
Customer: It just doesn't work. I don't know what else to say.
Agent: Okay, when did you first notice the problem? And what model of Acme smart lock do you have?
Customer: I don't remember. Listen, I have to go. I'll call back later.
Agent: Alright, we're here 24/7 if you need further assistance. Have a good day.
</transcript>

<thinking>
This transcript has fewer than 5 exchanges and the customer's issue is unclear. The customer doesn't provide specific details about the problem with the smart lock or respond to the agent's questions. This interaction doesn't provide sufficient information for a complete summary.
</thinking>

<json>
{
  "status": "INSUFFICIENT_DATA"
}
</json>
</examples>
</instructions>

Before generating the JSON, please analyze the transcript in <thinking> tags. 
Include your identification of the main issue, resolution, follow-up requirements, and any ambiguities. 
Then, provide your JSON output in <json> tags.

정리 및 평가

이번 레슨에서는 고객 서비스 콜 기록을 요약하기 위한 복잡한 프롬프트를 개발하는 과정을 소개했습니다. 주요 기법은 다음과 같습니다:

  • 시스템 프롬프트 설정을 통해 Claude의 역할 및 컨텍스트를 정의합니다.

  • 입력 데이터 구조화 및 XML 태그 활용으로 명확한 문서 식별을 가능하게 합니다.

  • 명확한 지침 제공으로 분석의 초점을 맞추어 줍니다.

  • JSON 출력 형식은 명확하고 일관된 분석 결과를 제공합니다.

  • 예외 상황 처리 전략을 통해 불완전한 데이터를 식별합니다.

  • 예제를 통해 다양한 상황에 대한 예상 출력을 제시합니다.

  • 생각을 소리내어 표현하도록 Claude에게 요청하여 분석 과정을 명확히 합니다.

이러한 기법을 통해 고객 서비스 콜 기록을 구조화된 요약으로 효과적으로 변환할 수 있는 견고한 프롬프트를 개발했습니다. 이 접근 방식은 콜 요약 이외의 복잡한 케이스에도 적용될 수 있습니다.

출처 : courses/real_world_prompting/04_call_summarizer.ipynb at master · anthropics/courses

공유하기
카카오로 공유하기
페이스북 공유하기
트위터로 공유하기
url 복사하기
조회수 : 21
heart
T
페이지 기반 대답
AI Chat