מדריך למשתמש: עזרה למנהלים עבור נציגים אנושיים

בעזרת התכונה 'סיוע למפקחים' לנציגים אנושיים, מפקחים אנושיים יכולים לעקוב אחרי שיחות בין משתמשי קצה לבין נציגים אנושיים. אתם מגדירים כללים להעברת שיחה למפקח אנושי. לאחר מכן, העזרה למפקח מתריעה באופן אוטומטי למפקח אנושי כששיחה תואמת לאחד מהכללים שהגדרתם.

לכל פנייה של משתמש קצה בשיחה, מוצגים ציוני סנטימנט ותמליל. הכללים יכולים להשתמש בציוני הסנטימנט האלה או בAI Coach כדי לקבוע מתי המפקח האנושי יקבל התראה.

לפני שמתחילים

כדי להשתמש בתכונה 'עזרה למפקח', אתם צריכים פרופיל שיחה של Agent Assist ואת התפקידים הבאים בניהול הזהויות והרשאות הגישה (IAM).

  • dialogflow.virtualAgentMonitoringSupervisor
  • dialogflow.processor

שלב 1: הגדרת פרופיל שיחה

פרופיל שיחה מגדיר קבוצה של פרמטרים ששולטים בהצעות שמוצגות לסוכן במהלך שיחה. בשלבים הבאים יוצרים ConversationProfile עם אובייקט HumanAgentAssistantConfig. אפשר גם לבצע את הפעולות האלה באמצעות מסוף Agent Assist אם אתם מעדיפים לא לבצע קריאה ישירה ל-API.

יצירת פרופיל שיחה

כדי ליצור פרופיל שיחה, מבצעים קריאה ל-method‏ create במשאב ConversationProfile. צריך לספק את מזהה מאגר הידע, מזהה המסמך, מזהה הפרויקט ומזהה המודל. התשובה מכילה את המזהה החדש של פרופיל השיחה.

דוגמה ל-JSON:

{
  "displayName": "smart_compose_assist",
  "humanAgentAssistantConfig": {
    "humanAgentSuggestionConfig": {
      "featureConfigs": [
        {
          "suggestionFeature": {
            "type": "SMART_COMPOSE"
          },
          "queryConfig": {
            "documentQuerySource": {
              "documents": "projects/project-id/knowledgeBases/knowledge-base-id/documents/document-id"
            },
           "maxResults": "1"
          },
         "conversationModelConfig": {
           "model": "projects/project-id/conversationModels/model-id"
         }
        }
      ]
    }
  }
}

שלב 2: בחירת סנטימנט או AI Coach

בוחרים אם להשתמש בניתוח סנטימנט, ב-AI Coach או בשניהם כדי לעקוב אחרי השיחות. הבחירה הזו משתקפת גם בכללי ההעלאה לטיפול ברמה גבוהה יותר.

סנטימנט

כדי לנתח את הסנטימנט של משתמש הקצה לאורך השיחה, מוסיפים ניתוח סנטימנט לפרופיל השיחה.

מאמן מבוסס-AI

כדי לנתח שיחות באמצעות AI Coach, פועלים לפי ההוראות ליצירת גנרטור של AI Coach. אפשר ליצור רק AI Coach אחד בכל פעם לפרופיל שיחה יחיד. אפשר להוסיף מספר בלתי מוגבל של הוראות לגנרטור של AI Coach, וכל הוראה חייבת לכלול לפחות שם לתצוגה ותנאי.

אחרי שיוצרים גנרטור, מעתיקים את מזהה הגנרטור החדש ומוסיפים אותו לפרופיל השיחה.

שלב 3: הגדרת כללים למעקב אחרי שיחות

כדי להפעיל ולהגדיר כללי מעקב לשיחות תמיכת לקוחות שבהן נעשה שימוש בניתוח סנטימנט או ב-AI Coach, צריך לעדכן את פרופיל השיחה. כדי לעדכן את פרופיל השיחה באמצעות ה-API, בוחרים באחת מהאפשרויות הבאות:

  • מבצעים קריאה ל-update במשאב ConversationProfile.
  • מגדירים את התצורה של מעקב האינטראקציות באמצעות השיטה UpdateConversationProfile. הבקשה להגדרת מעקב האינטראקציות צריכה להיראות כמו בדוגמה הבאה.

    conversation_profile {
      name: "projects/agent-assist-console-demo/locations/global/conversationProfiles/your_new_conv_profile_id"
      interaction_monitoring_config {
        event_notification_config = {
        notification_config = { # If you want to enable notifications on your custom pub/sub topic, add it here.
        topic = 'ADD_YOUR_CUSTOM_PUBSUB_TOPIC'
            message_format = 'JSON'
          }
      # Optional: Leave both empty for *Default Mode*.
      # Other supported configurations:
      # 1. **Default Mode:** Always publish alert events when they are triggered and publish metric events only when an alert is triggered,
      #   - Metric event: `METRIC_EVENT_PUBLISH_IF_ALERT_TRIGGERED`
      #   - Alert event: `ALERT_EVENT_ALWAYS_PUBLISH`
      # 2. **Pure Monitoring Mode:** Publish all metric events, but never publish alert events.
      #   - Metric event: `METRIC_EVENT_ALWAYS_PUBLISH`
      #   - Alert event: `ALERT_EVENT_NEVER_PUBLISH`
      # 3. **Publish All Events:** Always publish both metric and alert     events.
      #   - Metric event: `METRIC_EVENT_ALWAYS_PUBLISH`
      #   - Alert event: `ALERT_EVENT_ALWAYS_PUBLISH`
      # Note: Avoid setting `metric_event_notification_mode` to `METRIC_EVENT_PUBLISH_IF_ALERT_TRIGGERED` while `alert_event_notification_mode` is `ALERT_EVENT_NEVER_PUBLISH`, as this combination will result in no events being published.
    metric_event_notification_mode = 'ADD'
    alert_event_notification_mode = 'ADD'
        }
        alerting_config {
          # Required.
          rules {
            alert_rule_id: "rule_1"
            description: "rule_1_description"
            trigger_condition {
            ...
            }
      rules {
            alert_rule_id: "rule_2"
            description: "rule_2_description"
            trigger_condition {
            ...
            }
          }
          # Optional Tool config to retrieve customer name. If not    required, skip setting the metadata_config
          metadata_config = {
            tool_configs = [
        {
          display_name = 'Customer Name'
          toolset_tool = {
            toolset = 'ADD_CUSTOM_TOOLSET'
            operation_id = 'load_profile'
          }
          response_key_path = 'sessionInfo.customerProfile.customerName'
        },
            ]
          }
    
        }
      }
    }
    update_mask {
      paths: "interaction_monitoring_config"
    }
    }

לקבלת עזרה נוספת, אפשר לפנות לנציג Google Cloud .

הגדרות לדוגמה

הדוגמאות הבאות ממחישות הגדרות של פרופיל שיחה למגוון שילובים של כללי מעקב.

דוגמה 1: התאמה לכלל של AI Coach

    conversation_profile     {
      name: "projects/agent-assist-console-demo/locations/global/conversationProfiles/your_new_conv_profile_id"
      interaction_monitoring_config {
        event_notification_config = {
            ...
        }
        alerting_config {
          rules {
            alert_rule_id: "agent coaching alert trigger rule(s) matched"
            description: "agent coaching alert trigger rule(s) matched"
            trigger_condition {
              metric_condition {
                metric_type: AGENT_COACHING_INSTRUCTIONS
                agent_coaching_config {
                  generator_name:    "projects/agent-assist-console-demo/locations/global/generators/newly_created_generator_id"
                }
                display_name: "agent coaching alert trigger rule(s) matched"
              }
            }
          }
          # Optional Tool config to retrieve customer name. If not required, skip setting the metadata_config.
          metadata_config = {
            ...
          }
        }
      }
    }
    update_mask {
      paths: "interaction_monitoring_config"
    }
    

דוגמה 2: ציון הסנטימנט < ‎-0.01

    conversation_profile     {
      name: "projects/agent-assist-console-demo/locations/global/conversationProfiles/your_new_conv_profile_id"
      interaction_monitoring_config {
        event_notification_config = {
            ...
        }
        alerting_config {
          rules {
            alert_rule_id: "customer sentiment negative"
            description: "negative sentiment"
            trigger_condition {
              metric_condition {
                metric_type: SENTIMENT
                value_range {
                  max_threshold: -0.01
                }
                display_name: "negative sentiment"
              }
            }
          }
          # Optional Tool config to retrieve customer name. If not required, skip setting the metadata_config.
          metadata_config = {
            ...
          }
        }
      }
    }
    update_mask {
      paths: "interaction_monitoring_config"
    }
    

דוגמה 3: ציון הסנטימנט < ‎-0.01 והתאמה לכלל של AI Coach

    conversation_profile     {
      name: "projects/agent-assist-console-demo/locations/global/conversationProfiles/your_new_conv_profile_id"
      interaction_monitoring_config {
        event_notification_config = {
            ...
        }
        alerting_config {
          # Required.
          rules {
            alert_rule_id: "sentiment is negative and agent coaching alert trigger rule(s) matched"
            description: "agent coaching alert trigger rule(s) matched and customer is unhappy"
            trigger_condition {
              and_condition {
                alert_conditions {
                  metric_condition {
                    metric_type: SENTIMENT_SCORE
                    value_range {
                      max_threshold: -0.01
                    }
                    display_name: "negative sentiment and agent coaching alert trigger rule(s) matched"
                  }
                }
                alert_conditions {
                  metric_condition {
                    metric_type: AGENT_COACHING_INSTRUCTIONS
                    agent_coaching_config {
                      generator_name: "projects/agent-assist-console-demo/locations/global/generators/newly_created_generator_id"
                    }
                    display_name: "negative sentiment and agent coaching alert trigger rule(s) matched"
                  }
                }
              }
            }
          }
          # Optional Tool config to retrieve customer name. If not required, skip setting the metadata_config.
          metadata_config = {
            ...
          }
        }
      }
    }
    update_mask {
      paths: "interaction_monitoring_config"
    }
    

דוגמה 4: כלל של AI Coach הופעל או ציון הסנטימנט < ‎-0.01

    conversation_profile     {
      name: "projects/agent-assist-console-demo/locations/global/conversationProfiles/your_new_conv_profile_id"
      interaction_monitoring_config {
        event_notification_config = {
            ...
        }
        alerting_config {
          rules {
            alert_rule_id: "agent coaching alert trigger rule(s) matched"
            description: "agent coaching alert trigger rule(s) matched"
            trigger_condition {
              metric_condition {
                metric_type: AGENT_COACHING_INSTRUCTIONS
                agent_coaching_config {
                  generator_name:    "projects/agent-assist-console-demo/locations/global/generators/newly_created_generator_id"
                }
                display_name: "agent coaching alert trigger rule(s) matched"
              }
            }
          }
          rules {
            alert_rule_id: "customer sentiment negative"
            description: "negative sentiment"
            trigger_condition {
              metric_condition {
                metric_type: SENTIMENT
                value_range {
                  max_threshold: -0.01
                }
                display_name: "negative sentiment"
              }
            }
          }
          # Optional Tool config to retrieve customer name. If not required, skip setting the metadata_config.
          metadata_config = {
            ...
          }
        }
      }
    }
    update_mask {
      paths: "interaction_monitoring_config"
    }
    

שלב 4: הגדרת עזרה למנהלים

  1. יוצרים נושא Pub/Sub כדי לקבל התראות. הנושא הזה ב-Pub/Sub משמש את Agent Assist לקבלת התראות ומדדים. רושמים את מזהה הנושא.
  2. שולחים את הפרויקט ואת מזהה הנושא ב-Pub/Sub אל Google כדי להוסיף אותם לרשימת ההיתרים.

שירות המעקב בין בני אדם מפרסם את סוגי האירועים הבאים:

  • מדדי הסנטימנט הם חישובים מצטברים של הסנטימנט בכל תור של משתמש קצה בשיחה.
  • אירועי התראה הם התראות שמכילות פרטים על כללים שנוצרים על ידי Agent Assist כשסנטימנט חורג מסף שהוגדר.

התכונה 'סיוע למנהל' תומכת בהגדרות הסטנדרטיות הבאות כדי לתת מענה לדרישות שונות לשילוב של שני האירועים האלה. אפשר לכלול את ההגדרות האלה בהגדרות של ניטור האינטראקציות.

  • מצב ברירת מחדל: ההתראות מתפרסמות באופן מיידי כשתנאי מסוים מתקיים. מדדי הסנטימנט מתפרסמים רק אחרי שהופעלה התראה.
  • מצב ניטור בלבד: מדדי הסנטימנט מתפרסמים באופן רציף לכל תור. המערכת מתעלמת מאירועים של התראות.
  • התנהגות במצב 'פרסום הכל': שני סוגי האירועים תמיד מתפרסמים ללא תנאי.

שלב 5א: בדיקת הצ'אט

כדי לבדוק את העזרה למפקחים באמצעות סימולטור הצ'אט, פועלים לפי השלבים הבאים.

  1. עוברים לסימולטור המעקב:

    https://agentassist.cloud.google.com/projects/project-id/locations/location-id/human-supervisor
    
  2. לוחצים על הגדרותהגדרות ובוחרים באפשרות נציגים אנושיים.

  3. פותחים כרטיסייה נוספת בדפדפן ועוברים אל סימולטור השיחות ב-Chat באמצעות פרופיל השיחה.

  4. מתחילים את השיחה בסימולטור השיחות, ורואים שסימולטור המעקב מציג תמלילים וציוני סנטימנט.

שלב 5ב: בדיקת הקול

כדי לבדוק את העזרה למנהלים באמצעות סימולטור הקול:

  1. עוברים לסימולטור המעקב:

    https://agentassist.cloud.google.com/projects/project-id/locations/location-id/human-supervisor
    
  2. לוחצים על הגדרותהגדרות, ואז בוחרים באפשרות נציגים אנושיים ובאפשרות מעקב רק אחרי שיחות טלפון.

  3. פותחים כרטיסייה נוספת בדפדפן ועוברים אל סימולטור שיחות קוליות באמצעות פרופיל השיחה.

  4. לוחצים על שיחהמעבר לשיחה קולית.

  5. מזינים את מספר הטלפון של נציג התמיכה.

  6. משתמשים בטלפון אחר עם מספר אחר כדי להתקשר למספרים החדשים שמוצגים במסך.

מפות של כרטיסי מידע

התכונה 'עזרה למפקח' מספקת שני ציונים:

  • ציון הסנטימנט לכל תור הוא ערך נקודה צפה נפרד מ-1- עד 1.
  • ציון הסנטימנט עד לנקודה מסוימת הוא ערך נקודה צפה רציף מ-1- עד 1.

אפשר למפות את ציוני הסנטימנט הרציפים עד לנקודה מסוימת לציונים מותאמים אישית שמתאימים ליחידות עסקיות שונות. בדוגמה הבאה מוצגת גישת מיפוי אחת.

קוד JavaScript לדוגמה למיפוי:

/**
 * Maps a score to a bucket index (1-10) based on 11 boundary points.
 * * @param {number} score - The input score (between -1 and 1)
 * @param {number[]} boundaries - An array of exactly 11 numbers sorted in ascending order.
 * @return{number} The bucket index (1 to 10).
 */
function getBucketIndex(score, boundaries) {
  // 1. Validation: Ensure we have exactly 11 boundary points
  if (!Array.isArray(boundaries) || boundaries.length !== 11) {
    throw new Error("Boundaries must be an array of exactly 11 points.");
  }

  // 2. Validate Input Score Range 
  if (typeof score !== 'number' || score < -1 || score > 1) {
    throw new Error(`Input score ${score} is out of bounds. Must be between -1 and 1.`)
  }

  // 3. Iterate through boundaries to find the slot
  // We start checking from index 1 (the first upper bound)
  for (let i = 1; i < boundaries.length; i++) {
    // If the score is strictly less than the current boundary,
    // it belongs to the bucket corresponding to this index.
    if (score <= boundaries[i]) {
      return i;
    }
  }

  // Fallback (should be covered by step 2 validation, but ensures integer return)
  return -1;
}


// --- Example Usage ---

// Create 11 boundary points from -1 to 1
// [-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
const boundaries = [];
for (let i = 0; i <= 10; i++) {
  // Creating points: -1 + (i * 0.2)
  boundaries.push(parseFloat((-1 + (i * 0.2)).toFixed(1))); 
}

console.log("Boundaries:", boundaries);

// Test Cases
console.log(`Score -0.9 maps to Bucket: ${getBucketIndex(-0.9, boundaries)}`); // Expected: 1
console.log(`Score -0.8 maps to Bucket: ${getBucketIndex(-0.8, boundaries)}`); // Expected: 2 (Inclusive lower)
console.log(`Score 0.0 maps to Bucket: ${getBucketIndex(0.0, boundaries)}`);   // Expected: 6
console.log(`Score 0.95 maps to Bucket: ${getBucketIndex(0.95, boundaries)}`); // Expected: 10
console.log(`Score 1.0 maps to Bucket: ${getBucketIndex(1.0, boundaries)}`);   // Expected: 10 (Inclusive upper)

אפשר לבצע אופטימיזציה של המיפוי באמצעות הקוד הבא כדי לקבוע באופן אוטומטי ספים שממקסמים את המתאם בין התחזיות הממופות לבין ציון חוויית הלקוח. אחרי שמבצעים את האופטימיזציה הזו על הנתונים פעם אחת, אפשר להשתמש בגבולות מבוססי-הנתונים שמתקבלים במקום להגדיר אותם באופן ידני.

התראות לגבי אירועים ב-Pub/Sub

גם מדדי הסנטימנט וגם ההתראות מתפרסמים בנושא Pub/Sub יחיד שהוגדר. המטען הייעודי שונה בהתאם לסוג האירוע.

מטען ייעודי (payload) של הודעת Pub/Sub עם מדדי סנטימנט:

{
  "data": "{\"metric\":{\"metricType\":\"SENTIMENT_SCORE\",\"value\":{\"createTime\":\"2024-01-01T00:00:00.000Z\",\"sentiment\":{\"score\":0.5,\"magnitude\":0.5},\"advancedValues\":{\"exponentialMovingAverageValue\":0.5}},\"conversation\":\"projects/your-project-id/locations/global/conversations/conversation_id\",\"message\":{\"name\":\"projects/your-project-id/locations/global/conversations/conversation_id/messages/message_id\",\"content\":\"ok\",\"languageCode\":\"en-US\",\"participant\":\"projects/your-project-id/locations/global/conversations/conversation_id/participants/participant_id\",\"participantRole\":\"END_USER\",\"sendTime\":\"2024-01-01T00:00:00.000Z\"}}}",
  "attributes": {
    "conversation_id": "conversation_id"
  }
}

דוגמה לשינוי מטען ייעודי (payload) של הודעת Pub/Sub:

{"data": "{\"alert\":{\"name\":\"projects/project_id/locations/location_id/interactionMonitoringAlerts/alert_id\",\"conversation\":\"projects/project_id/locations/location_id/conversations/conversation_id\",\"alertState\":\"CREATED\",\"alertMetadata\":{\"alertTriggerRules\":[{\"alertRuleId\":\"negative-sentiment\",\"description\":\"dummy_description\",\"Strong negative sentiment detected in last 30 seconds\":[{\"metricType\":\"SENTIMENT_SCORE\",\"values\":[{\"createTime\":\"2024-01-01T00:00:00.000Z\",\"sentiment\":{\"score\":0.0,\"magnitude\":0.0}}]}]}],\"channelType\":\"CHAT\"},\"createTime\":\"2024-01-01T00:00:00.000Z\"}}",
  "attributes": {
    "conversation_id": "conversation_id"
  }
}

הפניית API

AnalyzeContent:

  • תרחיש שימוש: מעקב אחרי שיחות בצ'אט בין משתמש קצה לבין נציג אנושי.
  • שיטות בדיקה:
    • סימולטור של המסוף: אפשר להשתמש בסימולטור הצ'אט של מסוף Agent Assist.
    • שילוב API: שליחת בקשות HTTP או RPC ישירות (ראו [קוד לדוגמה]).

StreamingAnalyzeContent

  • תרחיש שימוש: מעקב אחרי שיחות קוליות בין משתמש קצה לבין סוכן אנושי.
  • שיטות בדיקה:
    • סימולטור במסוף: שימוש בסימולטור הקולי של מסוף Agent Assist.
    • שילוב API: שליחת בקשות HTTP או RPC ישירות (ראו [קוד לדוגמה]).

ListMessages:

  • הפעולה מחזירה את הרשימה המלאה של התמלילים (גם של הנציג וגם של הלקוח) של שיחה.
  • שיטה מומלצת: ה-API הזה שימושי במיוחד לשיחות קוליות, כדי לאמת את התמלילים הסופיים והמתוקנים של כל תור אחרי שהסטרימינג מסתיים.

ListInteractionMonitoringMetrics: אחזור של כל מדדי הסנטימנט שחושבו וצוברו לשיחה ספציפית.

דוגמה למטען ייעודי (payload) של בקשה:

{
  "parent": "projects/{project-id}/locations/{location-id}",
  "conversation":
"projects/{project-id}/locations/{location-id}/conversations/{conversation-id}"
}

דוגמה למטען ייעודי לתגובה:

{
  "interactionMonitoringMetrics": [{
    "metricType": "SENTIMENT_SCORE",
    "values": {
      "createTime": "2025-12-01T22:20:49.925Z",
      "sentiment": {
        "score": -1.0,
        "magnitude": 1.0
      },
      "advancedValues": {
        "movingAverageValue": -0.4994999999762513
      }
    }, {
      "createTime": "2025-12-01T22:20:21.027Z",
      "sentiment": {
        "score": 0.001,
        "magnitude": 0.001
      },
      "advancedValues": {
        "movingAverageValue": -0.4994999999762513
      }
    },
      "advancedValues": {
      }
    }]
}

ListInteractionMonitoringAlert: אחזור של התראות שנוצרו. אפשר להגדיר את ההיקף של ההרשאות לפרויקט שלם או לסנן אותן לשיחה ספציפית.

כדי לשלוח שאילתה לגבי כל ההתראות בפרויקט:

{
  "parent": "projects/{project-id}/locations/{location-id}"
}

**כדי לשלוח שאילתה לגבי התראות של מזהה שיחה ספציפי **

{
  "parent": "projects/{project-id}/locations/{location-id}",
  "filter": "context_id=projects/{project-id}/locations/{location-id}/conversations/{conversation-id}"
}

אפשרויות סינון. המשתמשים יכולים להחיל קריטריוני סינון נוספים, כמו סטטוס ההתראה:

alert_state=CREATED,alert_state=ACKNOWLEDGED