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 の高度な自然言語理解機能を活用して、顧客の意図、緊急度、優先順位、顧客プロフィールなど、様々な要因に基づいて大規模な顧客サポートチケットを分類する方法について説明します。
    • チケットルーティングに Claude を使用するかどうかを決定する
    • LLM サポートワークフローを構築してデプロイする
    • 適切な Claude モデルを選択する
    • 20 以上のインテントカテゴリがある場合は、分類学的階層を使用する
    • Claude をより大きなサポートワークフローに統合する

    チケットルーティングに Claude を使用するかどうかを決定する

    従来の ML アプローチではなく、Claude のような LLM を分類タスクに使用すべき主な指標を以下に示します。


    LLM サポートワークフローを構築してデプロイする

    現在のサポートアプローチを理解する

    自動化に飛び込む前に、既存のチケッティングシステムを理解することが重要です。サポートチームが現在チケットルーティングをどのように処理しているかを調査することから始めます。

    以下のような質問を検討してください。

    • どのような基準を使用して、どの SLA/サービス提供が適用されるかを決定していますか?
    • チケットルーティングは、チケットがどのレベルのサポートまたは製品スペシャリストに送られるかを決定するために使用されていますか?
    • すでに実装されている自動ルールまたはワークフローはありますか? どのような場合に失敗しますか?
    • エッジケースまたは曖昧なチケットはどのように処理されていますか?
    • チームはチケットをどのように優先順位付けしていますか?

    人間が特定のケースをどのように処理するかについて知識が多いほど、Claude でそのタスクを実行するのに役立ちます。

    ユーザーインテントカテゴリを定義する

    ユーザーインテントカテゴリの明確に定義されたリストは、Claude を使用した正確なサポートチケット分類に重要です。Claude がシステム内でチケットを効果的にルーティングする能力は、システムのカテゴリがどの程度明確に定義されているかに正比例します。

    以下は、ユーザーインテントカテゴリとサブカテゴリの例です。

    インテントに加えて、チケットルーティングと優先順位付けは、緊急度、顧客タイプ、SLA、言語などの他の要因の影響を受ける場合があります。自動ルーティングシステムを構築する際に、他のルーティング基準も考慮してください。

    成功基準を確立する

    サポートチームと協力して、測定可能なベンチマーク、閾値、目標を含む明確な成功基準を定義してください。

    サポートチケットルーティングに LLM を使用する場合の標準的な基準とベンチマークを以下に示します。

    LLM が使用されるかどうかに関係なく、有用である可能性のある一般的な成功基準を以下に示します。

    適切な Claude モデルを選択する

    モデルの選択は、コスト、精度、応答時間の間のトレードオフに依存します。

    多くの顧客は、claude-haiku-4-5-20251001 がチケットルーティングに理想的なモデルであることに気付いています。これは Claude 4 ファミリーで最も高速で最もコスト効率的なモデルでありながら、優れた結果を提供しています。分類問題が深い主題専門知識または大量のインテントカテゴリと複雑な推論を必要とする場合は、より大きな Sonnet モデルを選択することができます。

    強力なプロンプトを構築する

    チケットルーティングは分類タスクの一種です。Claude はサポートチケットのコンテンツを分析し、問題タイプ、緊急度、必要な専門知識、またはその他の関連要因に基づいて、事前定義されたカテゴリに分類します。

    チケット分類プロンプトを作成しましょう。初期プロンプトには、ユーザーリクエストのコンテンツが含まれ、推論とインテントの両方を返す必要があります。

    Claude Console のプロンプトジェネレータを試して、Claude に最初のドラフトを作成させてください。

    チケットルーティング分類プロンプトの例を以下に示します。

    def classify_support_request(ticket_contents):
        # Define the prompt for the classification task
        classification_prompt = f"""You will be acting as a customer support ticket classification system. Your task is to analyze customer support requests and output the appropriate classification intent for each request, along with your reasoning. 
    
            Here is the customer support request you need to classify:
    
            <request>{ticket_contents}</request>
    
            Please carefully analyze the above request to determine the customer's core intent and needs. Consider what the customer is asking for has concerns about.
    
            First, write out your reasoning and analysis of how to classify this request inside <reasoning> tags.
    
            Then, output the appropriate classification label for the request inside a <intent> tag. The valid intents are:
            <intents>
            <intent>Support, Feedback, Complaint</intent>
            <intent>Order Tracking</intent>
            <intent>Refund/Exchange</intent>
            </intents>
    
            A request may have ONLY ONE applicable intent. Only include the intent that is most applicable to the request.
    
            As an example, consider the following request:
            <request>Hello! I had high-speed fiber internet installed on Saturday and my installer, Kevin, was absolutely fantastic! Where can I send my positive review? Thanks for your help!</request>
    
            Here is an example of how your output should be formatted (for the above example request):
            <reasoning>The user seeks information in order to leave positive feedback.</reasoning>
            <intent>Support, Feedback, Complaint</intent>
    
            Here are a few more examples:
            <examples>
            <example 2>
            Example 2 Input:
            <request>I wanted to write and personally thank you for the compassion you showed towards my family during my father's funeral this past weekend. Your staff was so considerate and helpful throughout this whole process; it really took a load off our shoulders. The visitation brochures were beautiful. We'll never forget the kindness you showed us and we are so appreciative of how smoothly the proceedings went. Thank you, again, Amarantha Hill on behalf of the Hill Family.</request>
    
            Example 2 Output:
            <reasoning>User leaves a positive review of their experience.</reasoning>
            <intent>Support, Feedback, Complaint</intent>
            </example 2>
            <example 3>
    
            ...
    
            </example 8>
            <example 9>
            Example 9 Input:
            <request>Your website keeps sending ad-popups that block the entire screen. It took me twenty minutes just to finally find the phone number to call and complain. How can I possibly access my account information with all of these popups? Can you access my account for me, since your website is broken? I need to know what the address is on file.</request>
    
            Example 9 Output:
            <reasoning>The user requests help accessing their web account information.</reasoning>
            <intent>Support, Feedback, Complaint</intent>
            </example 9>
    
            Remember to always include your classification reasoning before your actual intent output. The reasoning should be enclosed in <reasoning> tags and the intent in <intent> tags. Return only the reasoning and the intent.
            """

    このプロンプトの主要なコンポーネントを分解してみましょう。

    • Python f-string を使用してプロンプトテンプレートを作成し、ticket_contents を <request> タグに挿入できるようにしています。
    • Claude に分類システムとしての明確に定義された役割を与え、チケットコンテンツを慎重に分析して顧客の中核的な意図とニーズを決定します。
    • Claude に適切な出力フォーマットについて指示し、この場合、推論と分析を <reasoning> タグ内に、適切な分類ラベルを <intent> タグ内に提供します。
    • 有効なインテントカテゴリを指定します。「Support, Feedback, Complaint」、「Order Tracking」、「Refund/Exchange」です。
    • 出力がどのようにフォーマットされるべきかを示すために、いくつかの例 (少数ショットプロンプティングとも呼ばれます) を含めます。これにより、精度と一貫性が向上します。

    Claude の応答を様々な XML タグセクションに分割したい理由は、正規表現を使用して出力から推論とインテントを個別に抽出できるようにするためです。これにより、チケットルーティングワークフロー内で対象となる次のステップを作成できます。例えば、インテントのみを使用してチケットをどの人にルーティングするかを決定します。

    プロンプトをデプロイする

    プロンプトがテスト本番環境でどの程度機能するかを知ることは難しく、評価を実行する必要があります。

    デプロイメント構造を構築しましょう。Claude への呼び出しをラップするメソッドシグネチャを定義することから始めます。すでに書き始めたメソッドを取得します。これは ticket_contents を入力として持ち、reasoning と intent のタプルを出力として返すようにします。従来の ML を使用した既存の自動化がある場合は、代わりにそのメソッドシグネチャに従う必要があります。

    import anthropic
    import re
    
    # Create an instance of the Claude API client
    client = anthropic.Anthropic()
    
    # Set the default model
    DEFAULT_MODEL="claude-haiku-4-5-20251001"
    
    def classify_support_request(ticket_contents):
        # Define the prompt for the classification task
        classification_prompt = f"""You will be acting as a customer support ticket classification system. 
            ...
            ... The reasoning should be enclosed in <reasoning> tags and the intent in <intent> tags. Return only the reasoning and the intent.
            """
        # Send the prompt to the API to classify the support request.
        message = client.messages.create(
            model=DEFAULT_MODEL,
            max_tokens=500,
            temperature=0,
            messages=[{"role": "user", "content": classification_prompt}],
            stream=False,
        )
        reasoning_and_intent = message.content[0].text
    
        # Use Python's regular expressions library to extract `reasoning`.
        reasoning_match = re.search(
            r"<reasoning>(.*?)</reasoning>", reasoning_and_intent, re.DOTALL
        )
        reasoning = reasoning_match.group(1).strip() if reasoning_match else ""
    
        # Similarly, also extract the `intent`.
        intent_match = re.search(r"<intent>(.*?)</intent>", reasoning_and_intent, re.DOTALL)
        intent = intent_match.group(1).strip() if intent_match else ""
    
        return reasoning, intent

    このコードは以下を実行します。

    • Anthropic ライブラリをインポートし、API キーを使用してクライアントインスタンスを作成します。
    • ticket_contents 文字列を取得する classify_support_request 関数を定義します。
    • classification_prompt を使用して ticket_contents を Claude に送信します。
    • レスポンスから抽出された reasoning と intent を返します。

    推論とインテントテキスト全体が生成されるのを待ってから解析する必要があるため、stream=False (デフォルト) を設定します。


    プロンプトを評価する

    プロンプティングは、本番環境に対応するために、テストと最適化が必要なことが多いです。ソリューションの準備状況を判断するには、以前に確立した成功基準と閾値に基づいてパフォーマンスを評価します。

    評価を実行するには、実行するテストケースが必要です。このガイドの残りの部分では、すでにテストケースを開発していることを前提としています。

    評価関数を構築する

    このガイドの例の評価は、3 つの主要なメトリクスに沿って Claude のパフォーマンスを測定します。

    • 精度
    • 分類あたりのコスト

    あなたにとって重要な要因に応じて、他の軸で Claude を評価する必要があるかもしれません。

    これを評価するために、まず書いたスクリプトを変更し、予測されたインテントと実際のインテントを比較し、正しい予測の割合を計算する関数を追加する必要があります。また、コスト計算と時間測定機能を追加する必要があります。

    import anthropic
    import re
    
    # Create an instance of the Claude API client
    client = anthropic.Anthropic()
    
    # Set the default model
    DEFAULT_MODEL="claude-haiku-4-5-20251001"
    
    def classify_support_request(request, actual_intent):
        # Define the prompt for the classification task
        classification_prompt = f"""You will be acting as a customer support ticket classification system. 
            ...
            ...The reasoning should be enclosed in <reasoning> tags and the intent in <intent> tags. Return only the reasoning and the intent.
            """
    
        message = client.messages.create(
            model=DEFAULT_MODEL,
            max_tokens=500,
            temperature=0,
            messages=[{"role": "user", "content": classification_prompt}],
        )
        usage = message.usage  # Get the usage statistics for the API call for how many input and output tokens were used.
        reasoning_and_intent = message.content[0].text
    
        # Use Python's regular expressions library to extract `reasoning`.
        reasoning_match = re.search(
            r"<reasoning>(.*?)</reasoning>", reasoning_and_intent, re.DOTALL
        )
        reasoning = reasoning_match.group(1).strip() if reasoning_match else ""
    
        # Similarly, also extract the `intent`.
        intent_match = re.search(r"<intent>(.*?)</intent>", reasoning_and_intent, re.DOTALL)
        intent = intent_match.group(1).strip() if intent_match else ""
    
          # Check if the model's prediction is correct.
        correct = actual_intent.strip() == intent.strip()
    
        # Return the reasoning, intent, correct, and usage.
        return reasoning, intent, correct, usage

    加えた編集を分解してみましょう。

    • テストケースから actual_intent を classify_support_request メソッドに追加し、Claude のインテント分類が黄金のインテント分類と一致するかどうかを評価するための比較を設定しました。
    • API 呼び出しの使用統計を抽出して、使用されたインプットトークンとアウトプットトークンに基づいてコストを計算しました。

    評価を実行する

    適切な評価には、何が良い結果であるかを判断するための明確な閾値とベンチマークが必要です。上記のスクリプトは、精度、応答時間、分類あたりのコストの実行時値を提供しますが、明確に確立された閾値が必要です。例えば:

    • 精度: 95% (100 個のテストのうち)
    • 分類あたりのコスト: 現在のルーティング方法から平均 50% 削減 (100 個のテスト全体)

    これらの閾値を設定することで、大規模で公平な経験主義を使用して、どの方法があなたに最適であるか、そしてあなたの要件に合わせるためにどのような変更が必要かを迅速かつ簡単に判断できます。


    パフォーマンスを改善する

    複雑なシナリオでは、標準的なプロンプトエンジニアリング技術とガードレール実装戦略を超えてパフォーマンスを改善するための追加戦略を検討することが役立つ場合があります。一般的なシナリオを以下に示します。

    20 以上のインテントカテゴリがある場合は、分類学的階層を使用する

    クラスの数が増えるにつれて、必要な例の数も増加し、プロンプトが扱いにくくなる可能性があります。別の方法として、分類器の混合を使用して階層的分類システムを実装することを検討できます。

    1. インテントを分類学的ツリー構造に整理します。
    2. ツリーのすべてのレベルで一連の分類器を作成し、カスケードルーティングアプローチを有効にします。

    例えば、チケットを「技術的な問題」、「請求に関する質問」、「一般的な問い合わせ」に大まかに分類する最上位の分類器がある場合があります。これらのカテゴリのそれぞれは、分類をさらに絞り込むための独自のサブ分類器を持つことができます。

    • 長所 - より大きなニュアンスと精度: 各親パスに対して異なるプロンプトを作成でき、より対象を絞った文脈固有の分類が可能になります。これにより、精度が向上し、顧客リクエストのより微妙な処理が可能になります。

    • 短所 - レイテンシの増加: 複数の分類器はレイテンシの増加につながる可能性があり、最速のモデルである Haiku でこのアプローチを実装することをお勧めします。

    ベクトルデータベースと類似性検索検索を使用して、非常に可変的なチケットを処理する

    例を提供することが最も効果的なパフォーマンス改善方法ですが、サポートリクエストが非常に可変的な場合、単一のプロンプトに十分な例を含めるのは難しい場合があります。

    このシナリオでは、ベクトルデータベースを使用して例のデータセットから類似性検索を実行し、特定のクエリに対して最も関連性の高い例を取得できます。

    分類レシピで詳しく説明されているこのアプローチは、パフォーマンスを 71% の精度から 93% の精度に改善することが示されています。

    予想されるエッジケースを具体的に考慮する

    Claude がチケットを誤分類する可能性があるシナリオを以下に示します (あなたの状況に固有の他のシナリオがある場合があります)。これらのシナリオでは、Claude がエッジケースをどのように処理するかについて、プロンプトで明示的な指示または例を提供することを検討してください。


    Claude をより大きなサポートワークフローに統合する

    適切な統合には、Claude ベースのチケットルーティングスクリプトがより大きなチケットルーティングシステムのアーキテクチャにどのように適合するかについて、いくつかの決定を行う必要があります。これを行う方法は 2 つあります。

    • プッシュベース: 使用しているサポートチケットシステム (例: Zendesk) は、ルーティングサービスに webhook イベントを送信することでコードをトリガーし、その後、インテントを分類してルーティングします。
      • このアプローチはより web スケーラブルですが、公開エンドポイントを公開する必要があります。
    • プルベース: コードは指定されたスケジュールに基づいて最新のチケットをプルし、プル時にルーティングします。
      • このアプローチは実装が簡単ですが、プル頻度が高すぎるとサポートチケットシステムへの不要な呼び出しが発生する可能性があり、プル頻度が低すぎるとやや遅い可能性があります。

    これらのアプローチのいずれかについて、スクリプトをサービスにラップする必要があります。アプローチの選択は、サポートチケッティングシステムが提供する API に依存します。


    分類クックブック

    より多くのサンプルコードと詳細な評価ガイダンスについては、分類クックブックをご覧ください。

    Claude Console

    Claude Console でワークフローの構築と評価を開始します。