Loading...
    • 개발자 가이드
    • API 레퍼런스
    • MCP
    • 리소스
    • 릴리스 노트
    Search...
    ⌘K
    리소스
    개요용어집시스템 프롬프트
    개요티켓 라우팅고객 지원 에이전트콘텐츠 모더레이션법률 요약
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    사용 사례

    고객 지원 에이전트

    이 가이드는 Claude의 고급 대화 기능을 활용하여 실시간으로 고객 문의를 처리하고, 24/7 지원을 제공하며, 대기 시간을 줄이고, 정확한 응답과 긍정적인 상호작용으로 대량의 지원 요청을 관리하는 방법을 안내합니다.

    Was this page helpful?

    • Claude로 구축하기 전에
    • 지원 채팅에 Claude를 사용할지 결정하기
    • Claude를 고객 서비스 에이전트로 구현하는 방법
    • 적합한 Claude 모델 선택하기
    • Claude를 지원 워크플로에 통합하기

    Claude로 구축하기 전에

    지원 채팅에 Claude를 사용할지 결정하기

    고객 지원 프로세스의 일부를 자동화하기 위해 Claude와 같은 LLM을 사용해야 하는 주요 지표는 다음과 같습니다:

    다른 LLM 대신 Claude를 선택할 때 고려할 사항:

    • 자연스럽고 미묘한 대화를 우선시하는 경우: Claude의 정교한 언어 이해 능력은 다른 LLM과의 채팅보다 더 자연스럽고 맥락을 인식하는 인간적인 대화를 가능하게 합니다.
    • 복잡하고 개방형 문의를 자주 받는 경우: Claude는 정형화된 응답을 생성하거나 사용자 발화의 순열에 대한 광범위한 프로그래밍 없이도 다양한 주제와 문의를 처리할 수 있습니다.
    • 확장 가능한 다국어 지원이 필요한 경우: Claude의 다국어 기능을 통해 지원되는 각 언어에 대해 별도의 챗봇이나 광범위한 번역 프로세스 없이 200개 이상의 언어로 대화할 수 있습니다.

    이상적인 채팅 상호작용 정의하기

    이상적인 고객 상호작용을 개요로 작성하여 고객이 Claude와 어떻게, 언제 상호작용할 것으로 예상하는지 정의하세요. 이 개요는 솔루션의 기술적 요구사항을 결정하는 데 도움이 됩니다.

    다음은 자동차 보험 고객 지원을 위한 예시 채팅 상호작용입니다:

    • 고객: 지원 채팅 경험을 시작합니다
      • Claude: 고객을 따뜻하게 맞이하고 대화를 시작합니다
    • 고객: 새 전기차 보험에 대해 문의합니다
      • Claude: 전기차 보장에 대한 관련 정보를 제공합니다
    • 고객: 전기차 보험의 고유한 요구사항에 관련된 질문을 합니다
      • Claude: 정확하고 유익한 답변을 제공하고 출처 링크를 제공합니다
    • 고객: 보험이나 자동차와 관련 없는 주제 외 질문을 합니다
      • Claude: 관련 없는 주제는 논의하지 않음을 명확히 하고 사용자를 자동차 보험으로 다시 안내합니다
    • 고객: 보험 견적에 관심을 표현합니다
      • Claude: 적절한 견적을 결정하기 위한 일련의 질문을 하며, 응답에 맞게 적응합니다
      • Claude: 사용자로부터 수집한 필요한 정보와 함께 견적 생성 API 도구 사용 요청을 보냅니다
      • Claude: API 도구 사용으로부터 응답 정보를 받아 자연스러운 응답으로 종합하고 제공된 견적을 사용자에게 제시합니다
    • 고객: 후속 질문을 합니다
      • Claude: 필요에 따라 후속 질문에 답변합니다
      • Claude: 고객을 보험 프로세스의 다음 단계로 안내하고 대화를 마무리합니다
    자신의 사용 사례를 위해 작성하는 실제 예시에서는 이 상호작용의 실제 단어를 작성하면 Claude가 가져야 할 이상적인 톤, 응답 길이 및 세부 수준에 대한 감각을 얻는 데 유용할 수 있습니다.

    상호작용을 고유한 작업으로 분류하기

    고객 지원 채팅은 질문 답변에서 정보 검색, 요청에 대한 조치까지 여러 다양한 작업의 모음으로, 단일 고객 상호작용으로 포장됩니다. 구축을 시작하기 전에 이상적인 고객 상호작용을 Claude가 수행할 수 있기를 원하는 모든 작업으로 분류하세요. 이렇게 하면 모든 작업에 대해 Claude를 프롬프트하고 평가할 수 있으며, 테스트 케이스를 작성할 때 고려해야 할 상호작용의 범위를 잘 파악할 수 있습니다.

    고객들은 때때로 사용자 요청에 따른 가능한 대화 분기점의 상호작용 흐름도로 이를 시각화하는 것이 도움이 된다고 합니다.

    위의 예시 보험 상호작용과 관련된 주요 작업은 다음과 같습니다:

    1. 인사 및 일반 안내

      • 고객을 따뜻하게 맞이하고 대화를 시작합니다
      • 회사 및 상호작용에 대한 일반 정보를 제공합니다
    2. 제품 정보

      • 전기차 보장에 대한 정보를 제공합니다
        이를 위해서는 Claude가 컨텍스트에 필요한 정보를 가지고 있어야 하며, RAG 통합이 필요할 수 있습니다.
      • 전기차 보험 고유의 요구사항에 관련된 질문에 답변합니다
      • 견적이나 보험 세부사항에 대한 후속 질문에 답변합니다
      • 적절한 경우 출처 링크를 제공합니다
    3. 대화 관리

      • 주제(자동차 보험)를 유지합니다

    성공 기준 수립하기

    지원 팀과 협력하여 명확한 성공 기준을 정의하고 측정 가능한 벤치마크와 목표가 포함된 상세한 평가를 작성하세요.

    다음은 Claude가 정의된 작업을 얼마나 성공적으로 수행하는지 평가하는 데 사용할 수 있는 기준과 벤치마크입니다:

    다음은 지원에 Claude를 사용하는 것의 비즈니스 영향을 평가하는 데 사용할 수 있는 기준과 벤치마크입니다:

    Claude를 고객 서비스 에이전트로 구현하는 방법

    적합한 Claude 모델 선택하기

    모델 선택은 비용, 정확도 및 응답 시간 간의 트레이드오프에 따라 달라집니다.

    고객 지원 채팅의 경우, Claude Opus 4.6은 지능, 지연 시간 및 비용의 균형을 잘 맞추는 데 적합합니다. 그러나 RAG, 도구 사용 및/또는 긴 컨텍스트 프롬프트를 포함하는 여러 프롬프트가 있는 대화 흐름의 경우, Claude Haiku 4.5가 지연 시간 최적화에 더 적합할 수 있습니다.

    강력한 프롬프트 작성하기

    고객 지원에 Claude를 사용하려면 Claude가 적절하게 응답할 수 있는 충분한 방향과 컨텍스트를 가지면서도 다양한 고객 문의를 처리할 수 있는 충분한 유연성이 필요합니다.

    시스템 프롬프트부터 시작하여 강력한 프롬프트의 요소를 작성해 봅시다:

    IDENTITY = """You are Eva, a friendly and knowledgeable AI assistant for Acme Insurance 
    Company. Your role is to warmly welcome customers and provide information on 
    Acme's insurance offerings, which include car insurance and electric car 
    insurance. You can also help customers get quotes for their insurance needs."""
    모든 정보를 시스템 프롬프트에 넣어 사용자 대화와 지시사항을 분리하고 싶을 수 있지만, Claude는 실제로 프롬프트 내용의 대부분이 첫 번째 User 턴에 작성될 때 가장 잘 작동합니다(역할 프롬프팅만 예외). 시스템 프롬프트로 Claude에게 역할 부여하기에서 자세히 읽어보세요.

    복잡한 프롬프트를 하위 섹션으로 나누고 한 번에 한 부분씩 작성하는 것이 가장 좋습니다. 각 작업에 대해 Claude가 작업을 잘 수행하는 데 필요한 프롬프트의 부분을 정의하는 단계별 프로세스를 따르면 더 큰 성공을 거둘 수 있습니다. 이 자동차 보험 고객 지원 예시에서는 "인사 및 일반 안내" 작업부터 시작하여 프롬프트의 모든 부분을 조각별로 작성할 것입니다. 이렇게 하면 전체 프롬프트의 개별 부분을 더 빠르게 조정할 수 있어 프롬프트 디버깅도 더 쉬워집니다.

    이 모든 조각을 config.py라는 파일에 넣겠습니다.

    STATIC_GREETINGS_AND_GENERAL = """
    <static_context>
    Acme Auto Insurance: Your Trusted Companion on the Road
    
    About:
    At Acme Insurance, we understand that your vehicle is more than just a mode of transportation—it's your ticket to life's adventures. 
    Since 1985, we've been crafting auto insurance policies that give drivers the confidence to explore, commute, and travel with peace of mind.
    Whether you're navigating city streets or embarking on cross-country road trips, Acme is there to protect you and your vehicle. 
    Our innovative auto insurance policies are designed to adapt to your unique needs, covering everything from fender benders to major collisions.
    With Acme's award-winning customer service and swift claim resolution, you can focus on the joy of driving while we handle the rest. 
    We're not just an insurance provider—we're your co-pilot in life's journeys.
    Choose Acme Auto Insurance and experience the assurance that comes with superior coverage and genuine care. Because at Acme, we don't just 
    insure your car—we fuel your adventures on the open road.
    
    Note: We also offer specialized coverage for electric vehicles, ensuring that drivers of all car types can benefit from our protection.
    
    Acme Insurance offers the following products:
    - Car insurance
    - Electric car insurance
    - Two-wheeler insurance
    
    Business hours: Monday-Friday, 9 AM - 5 PM EST
    Customer service number: 1-800-123-4567
    </static_context>
    """

    그런 다음 자동차 보험 및 전기차 보험 정보에 대해서도 동일하게 작성합니다.

    STATIC_CAR_INSURANCE="""
    <static_context>
    Car Insurance Coverage:
    Acme's car insurance policies typically cover:
    1. Liability coverage: Pays for bodily injury and property damage you cause to others.
    2. Collision coverage: Pays for damage to your car in an accident.
    3. Comprehensive coverage: Pays for damage to your car from non-collision incidents.
    4. Medical payments coverage: Pays for medical expenses after an accident.
    5. Uninsured/underinsured motorist coverage: Protects you if you're hit by a driver with insufficient insurance.
    
    Optional coverages include:
    - Rental car reimbursement
    - Roadside assistance
    - New car replacement
    </static_context>
    """
    
    STATIC_ELECTRIC_CAR_INSURANCE="""
    <static_context>
    Electric Car Insurance:
    Our specialized electric car insurance goes beyond traditional auto coverage, 
    offering tailored protection for your high-tech investment. In addition to standard coverages, we offer:
    - Safeguarding expensive battery systems
    - Covering home charging equipment
    - Adapting to the rapidly evolving world of electric vehicles
    
    Whether you're driving a Rivian, Nissan Leaf, Chevrolet Bolt, 
    or any other electric vehicle, our knowledgeable agents are ready to craft a policy 
    that gives you the confidence to enjoy every electron-powered mile.
    </static_context>
    """

    이제 정적 콘텐츠가 준비되었으니, Claude의 응답을 안내하기 위해 최소 4-5개의 "좋은" 상호작용 샘플을 추가합시다. 이러한 예시는 이상적인 고객 상호작용을 대표해야 하며 가드레일, 도구 호출 등을 포함할 수 있습니다.

    EXAMPLES="""
    Here are a few examples of how you can interact with customers:
    
    <example 1>
    H: Hi, do you offer commercial insurance for small businesses?
    
    A: Ah! Unfortunately, we don't offer commercial insurance at this time. 
    However, we do provide a range of personal insurance products including car insurance and electric car insurance. 
    Would you like to know more about these offerings?
    </example 1>
    
    <example 2>
    H: Hi, what are your business hours?
    
    A: Our business hours are Monday to Friday, 9 AM to 5 PM EST. 
    If you have any questions or need assistance, feel free to reach out during those times. 
    How else can I assist you today?
    </example 2>
    
    <example 3>
    H: I'm shopping for car insurance. What does Acme offer?
    
    A: Great choice! Acme's car insurance policies typically include:
    - Liability coverage: Protects you if you're at fault in an accident
    - Collision coverage: Pays for damage to your car in an accident
    - Comprehensive coverage: Covers non-collision incidents like theft or vandalism
    - Medical payments coverage: Pays for medical expenses after an accident
    - Uninsured/underinsured motorist coverage: Protects you from drivers with insufficient insurance
    
    We also offer optional coverages like rental car reimbursement, roadside assistance, and new car replacement. 
    Would you like more details on any of these coverages, or do you have specific questions about insuring your vehicle?
    </example 3>
    
    <example 4>
    H: I'd like to hear about your electric car insurance.
    
    A: Certainly! Our electric car insurance is specially designed to meet the unique needs of electric vehicle owners. 
    In addition to all the standard coverages we offer for regular cars, our electric car policies include:
    
    - Battery coverage: Protection against damage or degradation of your vehicle's expensive battery system
    - Tech package: Covers repairs or replacement of advanced electronics and onboard computer systems
    - Charging station coverage: Protects both home and portable charging equipment
    - Cybersecurity protection: Coverage against hacking or digital threats
    - Specialized roadside assistance: Includes flatbed towing to protect the vehicle's undercarriage
    
    We cover a wide range of electric vehicles, including popular models from Tesla, Rivian, Nissan, Chevrolet, and more. 
    Is there a specific electric vehicle you're looking to insure, or would you like more details on any of these coverages?
    </example 4>
    
    <example 5>
    H: I'd like to get a quote for my car insurance.
    
    A: Certainly! I'd be happy to help you get a quote for your car insurance. 
    To provide you with an accurate quote, I'll need to collect some information about your vehicle and the primary driver. 
    Let's start with the basics:
    
    1. What is the make and model of your vehicle?
    2. What year was it manufactured?
    3. Approximately how many miles have you driven?
    4. What is the age of the primary driver?
    
    Once you provide this information, I'll use our quoting tool to generate a personalized insurance quote for you.
    </example 5>
    """

    또한 Claude가 고객과 상호작용하는 방식에 대한 해야 할 것과 하지 말아야 할 것을 설명하는 중요한 지침을 포함해야 합니다. 이는 브랜드 가드레일이나 지원 정책에서 가져올 수 있습니다.

    ADDITIONAL_GUARDRAILS = """Please adhere to the following guardrails:
    1. Only provide information about insurance types listed in our offerings.
    2. If asked about an insurance type we don't offer, politely state 
    that we don't provide that service.
    3. Do not speculate about future product offerings or company plans.
    4. Don't make promises or enter into agreements it's not authorized to make.
    You only provide information and guidance.
    5. Do not mention any competitor's products or services.
    """

    이제 이 모든 섹션을 프롬프트로 사용할 단일 문자열로 결합합시다.

    TASK_SPECIFIC_INSTRUCTIONS = ' '.join([
       STATIC_GREETINGS_AND_GENERAL,
       STATIC_CAR_INSURANCE,
       STATIC_ELECTRIC_CAR_INSURANCE,
       EXAMPLES,
       ADDITIONAL_GUARDRAILS,
    ])

    도구 사용으로 동적 및 에이전트 기능 추가하기

    Claude는 클라이언트 측 도구 사용 기능을 사용하여 동적으로 작업을 수행하고 정보를 검색할 수 있습니다. 프롬프트가 활용해야 할 외부 도구나 API를 나열하는 것부터 시작하세요.

    이 예시에서는 견적 계산을 위한 하나의 도구로 시작하겠습니다.

    참고로, 이 도구는 실제 계산을 수행하지 않으며, 지정된 인수와 함께 도구를 사용해야 한다는 신호를 애플리케이션에 보내기만 합니다.

    예시 보험 견적 계산기:

    TOOLS = [{
      "name": "get_quote",
      "description": "Calculate the insurance quote based on user input. Returned value is per month premium.",
      "input_schema": {
        "type": "object",
        "properties": {
          "make": {"type": "string", "description": "The make of the vehicle."},
          "model": {"type": "string", "description": "The model of the vehicle."},
          "year": {"type": "integer", "description": "The year the vehicle was manufactured."},
          "mileage": {"type": "integer", "description": "The mileage on the vehicle."},
          "driver_age": {"type": "integer", "description": "The age of the primary driver."}
        },
        "required": ["make", "model", "year", "mileage", "driver_age"]
      }
    }]
    
    def get_quote(make, model, year, mileage, driver_age):
        """Returns the premium per month in USD"""
        # You can call an http endpoint or a database to get the quote.
        # Here, we simulate a delay of 1 seconds and return a fixed quote of 100.
        time.sleep(1)
        return 100

    프롬프트 배포하기

    프롬프트가 테스트 프로덕션 환경에 배포되고 평가를 실행하지 않으면 프롬프트가 얼마나 잘 작동하는지 알기 어렵습니다. 프롬프트, Anthropic SDK 및 사용자 인터페이스를 위한 streamlit을 사용하여 작은 애플리케이션을 구축해 봅시다.

    chatbot.py라는 파일에서 Anthropic SDK와의 상호작용을 캡슐화하는 ChatBot 클래스를 설정하는 것부터 시작합니다.

    이 클래스에는 generate_message와 process_user_input이라는 두 가지 주요 메서드가 있어야 합니다.

    from anthropic import Anthropic
    from config import IDENTITY, TOOLS, MODEL, get_quote
    from dotenv import load_dotenv
    
    load_dotenv()
    
    class ChatBot:
       def __init__(self, session_state):
           self.anthropic = Anthropic()
           self.session_state = session_state
    
       def generate_message(
           self,
           messages,
           max_tokens,
       ):
           try:
               response = self.anthropic.messages.create(
                   model=MODEL,
                   system=IDENTITY,
                   max_tokens=max_tokens,
                   messages=messages,
                   tools=TOOLS,
               )
               return response
           except Exception as e:
               return {"error": str(e)}
    
       def process_user_input(self, user_input):
           self.session_state.messages.append({"role": "user", "content": user_input})
    
           response_message = self.generate_message(
               messages=self.session_state.messages,
               max_tokens=2048,
           )
    
           if "error" in response_message:
               return f"An error occurred: {response_message['error']}"
    
           if response_message.content[-1].type == "tool_use":
               tool_use = response_message.content[-1]
               func_name = tool_use.name
               func_params = tool_use.input
               tool_use_id = tool_use.id
    
               result = self.handle_tool_use(func_name, func_params)
               self.session_state.messages.append(
                   {"role": "assistant", "content": response_message.content}
               )
               self.session_state.messages.append({
                   "role": "user",
                   "content": [{
                       "type": "tool_result",
                       "tool_use_id": tool_use_id,
                       "content": f"{result}",
                   }],
               })
    
               follow_up_response = self.generate_message(
                   messages=self.session_state.messages,
                   max_tokens=2048,
               )
    
               if "error" in follow_up_response:
                   return f"An error occurred: {follow_up_response['error']}"
    
               response_text = follow_up_response.content[0].text
               self.session_state.messages.append(
                   {"role": "assistant", "content": response_text}
               )
               return response_text
          
           elif response_message.content[0].type == "text":
               response_text = response_message.content[0].text
               self.session_state.messages.append(
                   {"role": "assistant", "content": response_text}
               )
               return response_text
          
           else:
               raise Exception("An error occurred: Unexpected response type")
    
       def handle_tool_use(self, func_name, func_params):
           if func_name == "get_quote":
               premium = get_quote(**func_params)
               return f"Quote generated: ${premium:.2f} per month"
          
           raise Exception("An unexpected tool was used")

    사용자 인터페이스 구축하기

    main 메서드를 사용하여 Streamlit으로 이 코드를 테스트 배포합니다. 이 main() 함수는 Streamlit 기반 채팅 인터페이스를 설정합니다.

    app.py라는 파일에서 이 작업을 수행합니다.

    import streamlit as st
    from chatbot import ChatBot
    from config import TASK_SPECIFIC_INSTRUCTIONS
    
    def main():
       st.title("Chat with Eva, Acme Insurance Company's Assistant🤖")
    
       if "messages" not in st.session_state:
           st.session_state.messages = [
               {'role': "user", "content": TASK_SPECIFIC_INSTRUCTIONS},
               {'role': "assistant", "content": "Understood"},
           ]
    
       chatbot = ChatBot(st.session_state)
    
       # Display user and assistant messages skipping the first two
       for message in st.session_state.messages[2:]:
           # ignore tool use blocks
           if isinstance(message["content"], str):
               with st.chat_message(message["role"]):
                   st.markdown(message["content"])
    
       if user_msg := st.chat_input("Type your message here..."):
           st.chat_message("user").markdown(user_msg)
    
           with st.chat_message("assistant"):
               with st.spinner("Eva is thinking..."):
                   response_placeholder = st.empty()
                   full_response = chatbot.process_user_input(user_msg)
                   response_placeholder.markdown(full_response)
    
    if __name__ == "__main__":
       main()

    다음 명령으로 프로그램을 실행합니다:

    streamlit run app.py

    프롬프트 평가하기

    프롬프팅은 프로덕션에 준비되기 위해 종종 테스트와 최적화가 필요합니다. 솔루션의 준비 상태를 결정하려면 정량적 및 정성적 방법을 결합한 체계적인 프로세스를 사용하여 챗봇 성능을 평가하세요. 정의된 성공 기준에 기반한 강력한 경험적 평가를 만들면 프롬프트를 최적화할 수 있습니다.

    Claude Console에는 이제 다양한 시나리오에서 프롬프트를 테스트할 수 있는 평가 도구가 있습니다.

    성능 개선하기

    복잡한 시나리오에서는 표준 프롬프트 엔지니어링 기법 및 가드레일 구현 전략 외에 성능을 개선하기 위한 추가 전략을 고려하는 것이 도움이 될 수 있습니다. 다음은 몇 가지 일반적인 시나리오입니다:

    RAG로 긴 컨텍스트 지연 시간 줄이기

    대량의 정적 및 동적 컨텍스트를 다룰 때, 모든 정보를 프롬프트에 포함하면 높은 비용, 느린 응답 시간 및 컨텍스트 윈도우 한계에 도달할 수 있습니다. 이 시나리오에서 검색 증강 생성(RAG) 기법을 구현하면 성능과 효율성을 크게 향상시킬 수 있습니다.

    Voyage와 같은 임베딩 모델을 사용하여 정보를 벡터 표현으로 변환하면 더 확장 가능하고 반응성이 좋은 시스템을 만들 수 있습니다. 이 접근 방식은 모든 프롬프트에 가능한 모든 컨텍스트를 포함하는 대신 현재 쿼리를 기반으로 관련 정보를 동적으로 검색할 수 있게 합니다.

    지원 사용 사례를 위한 RAG 구현 RAG 레시피는 광범위한 컨텍스트 요구사항이 있는 시스템에서 정확도를 높이고, 응답 시간을 줄이며, API 비용을 절감하는 것으로 나타났습니다.

    도구 사용으로 실시간 데이터 통합하기

    계정 잔액이나 보험 세부사항과 같은 실시간 정보가 필요한 쿼리를 처리할 때, 임베딩 기반 RAG 접근 방식만으로는 충분하지 않습니다. 대신 도구 사용을 활용하여 챗봇의 정확한 실시간 응답 제공 능력을 크게 향상시킬 수 있습니다. 예를 들어, 도구 사용을 통해 고객 정보를 조회하고, 주문 세부사항을 검색하며, 고객을 대신하여 주문을 취소할 수 있습니다.

    도구 사용: 고객 서비스 에이전트 레시피에 설명된 이 접근 방식을 통해 실시간 데이터를 Claude의 응답에 원활하게 통합하고 더 개인화되고 효율적인 고객 경험을 제공할 수 있습니다.

    입력 및 출력 가드레일 강화하기

    챗봇을 배포할 때, 특히 고객 서비스 시나리오에서는 오용, 범위 외 쿼리 및 부적절한 응답과 관련된 위험을 방지하는 것이 중요합니다. Claude는 본질적으로 이러한 시나리오에 대해 탄력적이지만, 챗봇 가드레일을 강화하기 위한 추가 단계는 다음과 같습니다:

    • 환각 줄이기: 팩트 체크 메커니즘과 인용을 구현하여 제공된 정보에 기반한 응답을 보장합니다.
    • 정보 교차 확인: 에이전트의 응답이 회사 정책 및 알려진 사실과 일치하는지 확인합니다.
    • 계약적 약속 피하기: 에이전트가 권한이 없는 약속을 하거나 계약을 체결하지 않도록 합니다.
    • 탈옥 완화: 무해성 스크린 및 입력 유효성 검사와 같은 방법을 사용하여 사용자가 모델 취약점을 악용하여 부적절한 콘텐츠를 생성하는 것을 방지합니다.
    • 경쟁사 언급 피하기: 브랜드 집중을 유지하고 경쟁사의 제품이나 서비스를 언급하지 않도록 경쟁사 언급 필터를 구현합니다.
    • Claude를 캐릭터에 유지하기: 길고 복잡한 상호작용 중에도 Claude가 스타일이나 컨텍스트를 변경하지 않도록 합니다.
    • 개인 식별 정보(PII) 제거: 명시적으로 요구되고 승인되지 않는 한, 응답에서 모든 PII를 제거합니다.

    스트리밍으로 체감 응답 시간 줄이기

    잠재적으로 긴 응답을 처리할 때, 스트리밍을 구현하면 사용자 참여도와 만족도를 크게 향상시킬 수 있습니다. 이 시나리오에서 사용자는 전체 응답이 생성될 때까지 기다리는 대신 점진적으로 답변을 받습니다.

    스트리밍을 구현하는 방법은 다음과 같습니다:

    1. Anthropic Streaming API를 사용하여 스트리밍 응답을 지원합니다.
    2. 들어오는 텍스트 청크를 처리하도록 프론트엔드를 설정합니다.
    3. 각 청크가 도착하면 표시하여 실시간 타이핑을 시뮬레이션합니다.
    4. 전체 응답을 저장하는 메커니즘을 구현하여 사용자가 이탈했다가 돌아올 때 볼 수 있도록 합니다.

    경우에 따라 스트리밍은 점진적 표시가 더 긴 처리 시간의 영향을 완화하므로 기본 지연 시간이 더 높은 고급 모델의 사용을 가능하게 합니다.

    챗봇 확장하기

    챗봇의 복잡성이 증가함에 따라 애플리케이션 아키텍처도 이에 맞게 발전할 수 있습니다. 아키텍처에 추가 레이어를 추가하기 전에 다음과 같은 덜 포괄적인 옵션을 고려하세요:

    • 프롬프트를 최대한 활용하고 프롬프트 엔지니어링을 통해 최적화하고 있는지 확인하세요. 프롬프트 엔지니어링 가이드를 사용하여 가장 효과적인 프롬프트를 작성하세요.
    • 프롬프트에 추가 도구를 추가하고(프롬프트 체인을 포함할 수 있음) 필요한 기능을 달성할 수 있는지 확인하세요.

    챗봇이 매우 다양한 작업을 처리하는 경우, 초기 고객 쿼리를 라우팅하기 위해 별도의 의도 분류기를 추가하는 것을 고려할 수 있습니다. 기존 애플리케이션의 경우, 이는 분류기를 통해 고객 쿼리를 라우팅한 다음 전문화된 대화(자체 도구 세트와 시스템 프롬프트 포함)로 연결하는 의사 결정 트리를 만드는 것을 포함합니다. 참고로, 이 방법은 지연 시간을 증가시킬 수 있는 Claude에 대한 추가 호출이 필요합니다.

    Claude를 지원 워크플로에 통합하기

    예시에서는 Streamlit 환경 내에서 호출 가능한 Python 함수에 초점을 맞추었지만, 실시간 지원 챗봇을 위해 Claude를 배포하려면 API 서비스가 필요합니다.

    접근 방법은 다음과 같습니다:

    1. API 래퍼 만들기: 분류 함수 주위에 간단한 API 래퍼를 개발합니다. 예를 들어, Flask API 또는 Fast API를 사용하여 코드를 HTTP 서비스로 래핑할 수 있습니다. HTTP 서비스는 사용자 입력을 수락하고 Assistant 응답을 전체적으로 반환할 수 있습니다. 따라서 서비스는 다음과 같은 특성을 가질 수 있습니다:

      • Server-Sent Events (SSE): SSE는 서버에서 클라이언트로의 실시간 응답 스트리밍을 가능하게 합니다. 이는 LLM으로 작업할 때 부드럽고 인터랙티브한 경험을 제공하는 데 중요합니다.
      • 캐싱: 캐싱을 구현하면 응답 시간을 크게 개선하고 불필요한 API 호출을 줄일 수 있습니다.
      • 컨텍스트 유지: 사용자가 이탈했다가 돌아올 때 컨텍스트를 유지하는 것은 대화의 연속성에 중요합니다.
    2. 웹 인터페이스 구축: Claude 기반 에이전트와 상호작용하기 위한 사용자 친화적인 웹 UI를 구현합니다.

    검색 증강 생성(RAG) 쿡북
  1. 주제 외 질문을 관련 주제로 다시 안내합니다
  2. 견적 생성

    • 견적 자격을 결정하기 위한 적절한 질문을 합니다
    • 고객 응답에 따라 질문을 조정합니다
    • 수집된 정보를 견적 생성 API에 제출합니다
    • 제공된 견적을 고객에게 제시합니다
  3. 더 많은 예시 코드와 상세한 안내를 위해 RAG 쿡북 레시피를 방문하세요.

    인용 쿡북

    정보의 정확성과 설명 가능성을 보장하는 방법에 대한 인용 쿡북 레시피를 살펴보세요.