Skip to content

Tongyi Xiaomi Conversation Analysis

Reference, synced 2026-06-13.

flowchart TD
  n0["**Core Features**"]
  n1["**Applicability**"]
  n2["**Model Selection Guide**"]
  n3["**Getting Started**"]
  n4["**Best Practices**"]
  n5["**Code Examples**"]
  n6["Customer Service Quality Inspection: Satisfact"]
  n7["Objective"]
  n8["Assessment Workflow Match rules top-down; stop"]
  n0 --> n1
  n1 --> n2
  n2 --> n3
  n3 --> n4
  n4 --> n5
  n5 --> n6
  n6 --> n7
  n7 --> n8

Documentation

Alibaba Cloud Model Studio

User Guide (Models) User Guide (Application) API Reference (Models) API Reference (Application)

Search for Help Content

Getting Started

The Beginner's Guide

Well-Architected Framework

AI & Machine Learning

Platform For AI

Alibaba Cloud Model Studio

DashVector

Artificial Intelligence Recommendation

OpenSearch

Image Search

Machine Translation

Intelligent Speech Interaction

Optimization Solver

Intelligent Computing LINGJUN

Computing

Elastic Compute Service

Elastic GPU Service

Elastic Container Instance

Dedicated Host

Compute Nest

Simple Application Server

Cloud Box

Auto Scaling

Elastic High Performance Computing

Batch Compute (Deprecated)

Function Compute

Serverless App Engine

ENS

Elastic Desktop Service

App Streaming

WUYING Terminal

Cloud Phone

Edge Network Acceleration

Alibaba Cloud Linux

AgentBay

Container

Container Service for Kubernetes

Container Compute Service

Container Registry

Storage

Object Storage Service

Cloud Parallel File Storage

File Storage NAS

Tablestore

Storage Capacity Unit

Simple Log Service

Cloud Backup

Intelligent Media Management

Drive and Photo Service

Data Transport

Cloud Storage Gateway

Data Online Migration

Hybrid Cloud Storage Array

Storage Services Overview

Backup and Disaster Recovery Center

Networking and CDN

Server Load Balancer

Elastic IP Address

Internet Shared Bandwidth

Data Transfer Plan

Virtual Private Cloud

NAT Gateway

PrivateLink

Alibaba Cloud DNS PrivateZone

Network Intelligence Service

Cloud Data Transfer

IPv6 Gateway

Anycast Elastic IP Address

Cloud Enterprise Network

Global Accelerator

VPN Gateway

Smart Access Gateway

Express Connect

CDN

Edge Security Acceleration

Cloud Network Well-architected Design Guidelines

Security

Anti-DDoS

Web Application Firewall

Cloud Firewall

Security Center

Bastionhost

Secure Access Service Edge

Certificate Management Service

Key Management Service

Data Security Center

Identity as a Service

Fraud Detection

AI Guardrails

Captcha

Blockchain as a Service

ID Verification

Managed Security Service

Middleware

Enterprise Distributed Application Service

Microservices Engine

Alibaba Cloud Service Mesh

SchedulerX

ApsaraMQ for RocketMQ

ApsaraMQ for Kafka

ApsaraMQ for RabbitMQ

ApsaraMQ for MQTT

Simple Message Queue (formerly MNS)

CloudFlow

EventBridge

Application Real-Time Monitoring Service

Managed Service for Prometheus

Managed Service for Grafana

Managed Service for OpenTelemetry

Performance Testing

STAROps

Databases

ApsaraDB Console

PolarDB

ApsaraDB RDS

ApsaraDB for OceanBase (Deprecated)

Tair (Redis® OSS-Compatible)

Lindorm

Time Series Database

ApsaraDB for MongoDB

ApsaraDB for HBase

ApsaraDB for Memcache

ApsaraDB for MyBase

AnalyticDB

ApsaraDB for ClickHouse

ApsaraDB for SelectDB

Data Transmission Service

Database Autonomy Service

Data Management

Database Gateway - Deprecated

ApsaraDB for Cassandra - Deprecated

Analytics Computing

MaxCompute

Hologres

Realtime Compute for Apache Flink

Elasticsearch

Vector Retrieval Service for Milvus

E-MapReduce

Data Lake Formation

DataV

Quick BI

Quick Audience

Quick Tracking

DataWorks

DataHub

Dataphin

Media Services

ApsaraVideo VOD

ApsaraVideo Live

Intelligent Media Services

ApsaraVideo Media Processing

Apsara Video SDK

Enterprise Services & Cloud Communication

Energy Expert

CloudQuotation

Salesforce on Alibaba Cloud

GoChina ICP Filing Assistant

Marketplace

Alibaba Mail

Direct Mail

Short Message Service

Voice Service

Phone Number Verification Service

Cell Phone Number Service

Chat App Message Service

Financial Intelligence Engine

Domain Names and Websites

Domain Names

ICP Filing

Alibaba Cloud DNS

End User Computing

Elastic Desktop Service

App Streaming

WUYING Terminal

Cloud Phone

AgentBay

Internet of Things

IoT Platform

Serverless

Serverless App Engine

CloudFlow

EventBridge

Simple Message Queue (formerly MNS)

Function Compute

Developer Tools

OpenAPI Explorer

Alibaba Cloud SDK

Cloud Shell

Resource Orchestration Service

Alibaba Cloud CLI

BSS OpenAPI

Terraform

Pulumi

Ticket System API

Mobile Platform as a Service

Alibaba Cloud DevOps

API Gateway

Cloud Control API

AI Coding Assistant Lingma

Cloud Skills Portal

Migration & O&M Management

CloudOps Orchestration Service

Cloud Monitor

Intelligent Advisor

Cloud Governance Center

ActionTrail

Cloud Config

Resource Access Management

Resource Management

Cloud Architect Design Tools

Migration Hub

Server Migration Center

Service Catalog

Logic Composer

Quota Center

CloudSSO

HTTPDNS

Solutions

SAP

SuperApp

OpenLake

Membership Service

Expenses and Costs

Account Center

More

Support

Legal

Tech Share Terms and Conditions

After Sales Support

China Gateway Program

Service Level Objectives

Management Console

Security Control

This topic was translated by AI and is currently in queue for revision by our editors. Alibaba Cloud does not guarantee the accuracy of AI-translated content. Request expedited revision

Tongyi Xiaomi Conversation Analysis focuses on analytical tasks such as information extraction, scenario classification, and satisfaction assessment. It excels at handling complex business logic in quality inspection rules, supports custom analysis criteria, and offers strong multi-turn conversation understanding and semantic reasoning capabilities.

Core Features

  • Conversation Information Extraction: Automatically extracts key information from unstructured conversations, such as time, location, product, issue description, and customer requests.

Typical use cases: Auto-fill for ticketing systems, CRM customer profile updates, issue categorization and archiving.

  • Scenario Classification: Identifies the business scenario of a conversation and supports custom scenario categories.

Typical use cases: Automatic routing of conversations to specialized teams, tracking consultation volume by scenario, targeted service process optimization.

  • Satisfaction Mining: Determines customer satisfaction levels based on custom rules and supports multi-dimensional evaluation.

Typical use cases: Agent performance evaluation, service quality monitoring, customer experience improvement.

  • Complex Quality Inspection: Supports complex inspection rules involving nested conditions and logical reasoning, accurately enforcing organization-specific quality standards.

Typical use cases: Quality inspection in highly regulated industries such as finance and healthcare, multi-step business process validation, complex script compliance checks.

  • Multi-Turn Conversation Understanding: Automatically links different parts of a dialogue to accurately interpret references and contextual dependencies, capturing the user's true intent across extended interactions.

Typical use cases: Conversation analysis for complex workflows, intent recognition in long dialogues, context-aware information extraction.

  • Deep Semantic Understanding: Accurately identifies implicit meaning, emotional tone, and implied intent in conversations.

Typical use cases: Customer sentiment monitoring, early warning for potential complaints, sales opportunity identification.

You can implement these features using custom prompts. For more information, see Feature Examples.

Applicability

  • Supported regions: Only the Beijing region is supported. Use an API key from this region.

  • Supported languages: The conversation analysis model supports only Chinese conversations.

  • Supported models:

    • tongyi-xiaomi-analysis-flash: Designed for structured analysis tasks such as information extraction and scenario classification. Suitable for online analysis with low response latency requirements and cost-sensitive batch analytics.

    • tongyi-xiaomi-analysis-pro: Built for complex logical reasoning and deep semantic understanding. Ideal for scenarios involving nested quality inspection rules and context-dependent multi-turn conversation analysis. Compared to the Flash model, it offers stronger reasoning and comprehension capabilities but incurs higher cost and latency.

For more information, see Model List.

Model Selection Guide

ScenarioRecommended ModelModel AdvantageUsage Guidance
ScenarioRecommended ModelModel AdvantageUsage Guidance
Fast information extraction and scenario classificationtongyi-xiaomi-analysis-flashLow latency and low cost, suitable for high-frequency real-time callsUse for standardized information extraction and classification tasks that do not involve complex reasoning
Standardized quality inspectiontongyi-xiaomi-analysis-flashAccurately understands conversational semantics and emotional tone, supports custom evaluation rules, and meets most quality inspection needsUse for clear-rule inspection scenarios; for complex business logic, use the pro model
Complex logic-based quality inspectiontongyi-xiaomi-analysis-proStronger reasoning capability, supports complex business rules with nested conditions and contextual dependenciesHigher cost than Flash; suitable for finance, healthcare, and other scenarios requiring high accuracy
Deep multi-turn conversation analysistongyi-xiaomi-analysis-proStronger conversation understanding, accurately interprets references and implicit intentUse for scenarios requiring holistic understanding, such as post-sale ticket analysis and root-cause investigation of complaints

Getting Started

Best Practices

  • Standardize conversation formatting: Format conversation content as [turn] role: content. A consistent format helps the model parse the dialogue structure, and accurately identify speaker roles, turn order, and contextual references.

Example:

plaintext
[1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today?
[2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running.
[3] Agent: I’m sorry for the inconvenience. Does the noise occur immediately after startup or after it’s been running for a while?
  • Write clear rules: Clear analysis rules are essential for accurate model execution. Vague or contradictory rules can lead to unexpected results.

Rule-writing tips:

  • Be specific and actionable: Avoid ambiguous phrasing. For example, replace "good service attitude" with "prompt responses and use of polite language."

  • Define priority: Specify rule priority and execution order to prevent conflicts.

  • Provide positive and negative examples: Include examples in your rules to help the model understand the evaluation criteria.

  • Use special markers for key terms: If a business term has a definition that differs from common usage, replace it with a special marker (for example, an acronym) to prevent the model from applying general knowledge.

  • Set invocation parameters: Conversation analysis tasks typically require deterministic and accurate results. Use the following parameter settings:

    • temperature: Set to 0.0 to ensure identical outputs for identical inputs, which guarantees consistency.

    • top_k: Set to 1 so the model always selects the highest-probability token, which eliminates randomness.

  • Control output format: To produce parseable and predictable results, explicitly define the output format in your prompt. Provide an output example when necessary.

Code Examples

Prerequisites: You have obtained an API key. If calling via SDK, install the latest SDK.

OpenAI-compatible

DashScope

Python

Java

Node.js

Go

cURL

python
from openai import OpenAI
import os

dialogue = """
[1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today?
[2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running.
[3] Agent: I’m sorry for the inconvenience. Does the noise occur immediately after startup or after it’s been running for a while?
[4] Customer: It starts a few seconds after turning on, and the sound is very sharp.
[5] Agent: Understood. Could you please record a short video of it running and send it to our technical team for verification?
[6] Customer: Sure, I’ll send it shortly.
[7] Agent: Great. We’ll reply with a resolution within two hours of receiving the video.
[8] Customer: If it’s confirmed as a quality issue, can I get a direct replacement?
[9] Agent: Yes, if it’s verified as a quality issue, we’ll replace it free of charge and cover shipping.

"""

analysis_prompt = f"""
## Customer Service Quality Inspection: Satisfaction Assessment Rules

### Objective

### Assessment Workflow (Match rules top-down; stop immediately when a condition is met)

1. **No Customer Input**
   - Condition: No customer utterances in the entire conversation.
   - Result: **Neutral**

2. **Complaint or Strong Dissatisfaction**
   - Condition: Customer directly or indirectly mentions filing a complaint (against riders, couriers, merchants, agents, etc.), or shows clear anxiety, questioning, or complaining while following up on issue progress.
   - Examples:
     - "I want to complain about your delivery person"
     - "Why hasn’t this been handled yet? When will it be fixed?"
   - Result: **Dissatisfied** (terminate assessment immediately)

3. **Negative Emotion in Final Utterance**
   - Condition: Customer’s last statement expresses negative emotion.
   - Result: **Dissatisfied**

4. **No Expression of Gratitude**
   - Condition: Customer never says “thank you” or similar explicit thanks.
   - Result: **Neutral**

5. **Explicit Satisfaction or Praise**

   - Result: **Satisfied** (overrides Rule 4)

6. **Gratitude After Solution Offered**
   - Condition: Before closing, after the agent offers compensation, refund, or solution, the customer explicitly and positively expresses thanks.
   - Notes:
     - “Okay” or “Alright” does not count as thanks
     - No reply does not count as acknowledgment
   - Result: **Satisfied**

7. **All Other Cases**
   - Condition: None of the above apply, and no complaints or clear dissatisfaction exist.
   - Result: **Neutral**

### Conversation Content
```text
{dialogue}
```

### Output Format
Include two parts:
1. **Satisfaction Label**: Satisfied / Dissatisfied / Neutral
2. **Reasoning**: Brief explanation based on the rules above.

Format:
```
Satisfaction Label#Reasoning
```
Examples:
```
Neutral#The customer expressed no thanks and showed no complaint or dissatisfaction, so the result is neutral.
Dissatisfied#The customer showed clear frustration and questioning while following up, matching Rule 2.
```
"""

# Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
# If DASHSCOPE_API_KEY environment variable is not set, replace the next line with: api_key="sk-xxx"
client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="tongyi-xiaomi-analysis-flash",
    messages=[\
        {\
            'role': 'user',\
            'content': analysis_prompt\
        }\
    ],
    temperature=0,
    extra_body={
        "top_k": 1
    }
)

print(completion.choices[0].message.content)
java
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.core.JsonValue;
import com.openai.models.chat.completions.ChatCompletion;
import com.openai.models.chat.completions.ChatCompletionCreateParams;

public class Main {
    public static void main(String[] args) {
        try {
            OpenAIClient client = OpenAIOkHttpClient.builder()
                    // Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
                    // If DASHSCOPE_API_KEY environment variable is not set, replace the next line with .apiKey("sk-xxx")
                    .apiKey(System.getenv("DASHSCOPE_API_KEY"))
                    .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                    .build();
            // Create ChatCompletion parameters
            ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
                    .model("tongyi-xiaomi-analysis-flash")
                    .addUserMessage(getUserMessage())
                    .temperature(0.0)
                    .putAdditionalBodyProperty("top_k", JsonValue.from(1))
                    .build();
            // Send request and get response
            ChatCompletion chatCompletion = client.chat().completions().create(params);
            String content = chatCompletion.choices().get(0).message().content().orElse("No valid content returned");
            System.out.println(content);
            // To view full response, uncomment the next line
            // System.out.println(chatCompletion);

        } catch (Exception e) {
            System.err.println("Error message: " + e.getMessage());
        }
    }

    private static String getUserMessage() {
        String dialogue ="[1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today?\n" +
                "                [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running.\n" +
                "                [3] Agent: I’m sorry for the inconvenience. Does the noise occur immediately after startup or after it’s been running for a while?\n" +
                "                [4] Customer: It starts a few seconds after turning on, and the sound is very sharp.\n" +
                "                [5] Agent: Understood. Could you please record a short video of it running and send it to our technical team for verification?\n" +
                "                [6] Customer: Sure, I’ll send it shortly.\n" +
                "                [7] Agent: Great. We’ll reply with a resolution within two hours of receiving the video.\n" +
                "                [8] Customer: If it’s confirmed as a quality issue, can I get a direct replacement?\n" +
                "                [9] Agent: Yes, if it’s verified as a quality issue, we’ll replace it free of charge and cover shipping.\n" +

        String analysisPrompt = "## Customer Service Quality Inspection: Satisfaction Assessment Rules\n" +
                "\n" +
                "### Objective\n" +

                "\n" +
                "### Assessment Workflow (Match rules top-down; stop immediately when a condition is met)\n" +
                "\n" +
                "1. **No Customer Input**\n" +
                "   - Condition: No customer utterances in the entire conversation.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "2. **Complaint or Strong Dissatisfaction**\n" +
                "   - Condition: Customer directly or indirectly mentions filing a complaint (against riders, couriers, merchants, agents, etc.), or shows clear anxiety, questioning, or complaining while following up on issue progress.\n" +
                "   - Examples:\n" +
                "     - \"I want to complain about your delivery person\"\n" +
                "     - \"Why hasn’t this been handled yet? When will it be fixed?\"\n" +
                "   - Result: **Dissatisfied** (terminate assessment immediately)\n" +
                "\n" +
                "3. **Negative Emotion in Final Utterance**\n" +
                "   - Condition: Customer’s last statement expresses negative emotion.\n" +
                "   - Result: **Dissatisfied**\n" +
                "\n" +
                "4. **No Expression of Gratitude**\n" +
                "   - Condition: Customer never says \"thank you\" or similar explicit thanks.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "5. **Explicit Satisfaction or Praise**\n" +

                "   - Result: **Satisfied** (overrides Rule 4)\n" +
                "\n" +
                "6. **Gratitude After Solution Offered**\n" +
                "   - Condition: Before closing, after the agent offers compensation, refund, or solution, the customer explicitly and positively expresses thanks.\n" +
                "   - Notes:\n" +
                "     - \"Okay\" or \"Alright\" does not count as thanks\n" +
                "     - No reply does not count as acknowledgment\n" +
                "   - Result: **Satisfied**\n" +
                "\n" +
                "7. **All Other Cases**\n" +
                "   - Condition: None of the above apply, and no complaints or clear dissatisfaction exist.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "### Conversation Content\n" +
                "```text\n" +
                dialogue + "\n" +
                "```\n" +
                "\n" +
                "### Output Format\n" +
                "Include two parts:\n" +
                "1. **Satisfaction Label**: Satisfied / Dissatisfied / Neutral\n" +
                "2. **Reasoning**: Brief explanation based on the rules above.\n" +
                "\n" +
                "Format:\n" +
                "```\n" +
                "Satisfaction Label#Reasoning\n" +
                "```\n" +
                "Examples:\n" +
                "```\n" +
                "Neutral#The customer expressed no thanks and showed no complaint or dissatisfaction, so the result is neutral.\n" +
                "Dissatisfied#The customer showed clear frustration and questioning while following up, matching Rule 2.\n" +
                "```";

        return analysisPrompt;
    }
}
nodejs
// Requires Node.js v18+ and must run in an ES Module environment
import OpenAI from "openai";
const openai = new OpenAI(
    {
        // Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
        // If DASHSCOPE_API_KEY environment variable is not set, replace the next line with: apiKey: "sk-xxx",
        apiKey: process.env.DASHSCOPE_API_KEY,
        baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1"
    }
);
const completion = await openai.chat.completions.create({
    model: "tongyi-xiaomi-analysis-flash",
    messages: [\
        {\
            role: "user",\
            content: "Please extract key information from the following conversation: [1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today? [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running."\
        }\
    ],
    temperature: 0,
    top_k: 1
});
console.log(completion.choices[0].message.content);
// To view full response, uncomment the next line
// console.log(JSON.stringify(completion, null, 4));
go
// OpenAI Go SDK version must be v2.4.0 or higher
package main

import (
	"context"
	// To view full response, uncomment the lines below and at the end
	// "encoding/json"
	"fmt"
	"os"

	"github.com/openai/openai-go/v2"
	"github.com/openai/openai-go/v2/option"
)

func main() {
	// Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
	// If DASHSCOPE_API_KEY environment variable is not set, replace the next line with: apiKey := "sk-xxx"
	apiKey := os.Getenv("DASHSCOPE_API_KEY")
	client := openai.NewClient(
		option.WithAPIKey(apiKey),
		option.WithBaseURL("https://dashscope.aliyuncs.com/compatible-mode/v1"),
	)

	chatCompletion, err := client.Chat.Completions.New(
		context.TODO(), openai.ChatCompletionNewParams{
			Messages: []openai.ChatCompletionMessageParamUnion{
				openai.UserMessage("Please extract key information from the following conversation: [1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today? [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running."),
			},
			Model:       "tongyi-xiaomi-analysis-flash",
			Temperature: openai.Float(0.0),
		},
		option.WithJSONSet("top_k", 1),
	)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Request failed: %v\n", err)
		os.Exit(1)
	}
	if len(chatCompletion.Choices) > 0 {
		fmt.Println(chatCompletion.Choices[0].Message.Content)
	}
	// To view full response, uncomment the next lines
	// jsonData, _ := json.MarshalIndent(chatCompletion, "", "  ")
	// fmt.Println(string(jsonData))
}
curl
curl --location "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "tongyi-xiaomi-analysis-flash",
    "messages": [\
        {\
            "role": "user",\
            "content": "Please extract key information from the following conversation: [1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today? [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running."\
        }\
    ],
    "temperature": 0.0,
    "top_k": 1
}'

Python

Java

cURL

python
from http import HTTPStatus
import dashscope
import os

dashscope.base_http_api_url = "https://dashscope.aliyuncs.com/api/v1"

dialogue = """
[1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today?
[2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running.
[3] Agent: I’m sorry for the inconvenience. Does the noise occur immediately after startup or after it’s been running for a while?
[4] Customer: It starts a few seconds after turning on, and the sound is very sharp.
[5] Agent: Understood. Could you please record a short video of it running and send it to our technical team for verification?
[6] Customer: Sure, I’ll send it shortly.
[7] Agent: Great. We’ll reply with a resolution within two hours of receiving the video.
[8] Customer: If it’s confirmed as a quality issue, can I get a direct replacement?
[9] Agent: Yes, if it’s verified as a quality issue, we’ll replace it free of charge and cover shipping.

"""

analysis_prompt = f"""
## Customer Service Quality Inspection: Satisfaction Assessment Rules

### Objective

### Assessment Workflow (Match rules top-down; stop immediately when a condition is met)

1. **No Customer Input**
   - Condition: No customer utterances in the entire conversation.
   - Result: **Neutral**

2. **Complaint or Strong Dissatisfaction**
   - Condition: Customer directly or indirectly mentions filing a complaint (against riders, couriers, merchants, agents, etc.), or shows clear anxiety, questioning, or complaining while following up on issue progress.
   - Examples:
     - "I want to complain about your delivery person"
     - "Why hasn’t this been handled yet? When will it be fixed?"
   - Result: **Dissatisfied** (terminate assessment immediately)

3. **Negative Emotion in Final Utterance**
   - Condition: Customer’s last statement expresses negative emotion.
   - Result: **Dissatisfied**

4. **No Expression of Gratitude**
   - Condition: Customer never says “thank you” or similar explicit thanks.
   - Result: **Neutral**

5. **Explicit Satisfaction or Praise**

   - Result: **Satisfied** (overrides Rule 4)

6. **Gratitude After Solution Offered**
   - Condition: Before closing, after the agent offers compensation, refund, or solution, the customer explicitly and positively expresses thanks.
   - Notes:
     - “Okay” or “Alright” does not count as thanks
     - No reply does not count as acknowledgment
   - Result: **Satisfied**

7. **All Other Cases**
   - Condition: None of the above apply, and no complaints or clear dissatisfaction exist.
   - Result: **Neutral**

### Conversation Content
```text
{dialogue}
```

### Output Format
Include two parts:
1. **Satisfaction Label**: Satisfied / Dissatisfied / Neutral
2. **Reasoning**: Brief explanation based on the rules above.

Format:
```
Satisfaction Label#Reasoning
```
Examples:
```
Neutral#The customer expressed no thanks and showed no complaint or dissatisfaction, so the result is neutral.
Dissatisfied#The customer showed clear frustration and questioning while following up, matching Rule 2.
```
"""

# Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
# If DASHSCOPE_API_KEY environment variable is not set, replace the next line with: api_key="sk-xxx"
response = dashscope.Generation.call(
    api_key=os.getenv('DASHSCOPE_API_KEY'),
    model="tongyi-xiaomi-analysis-flash",
    messages=[\
        {\
            'role': 'user',\
            'content': analysis_prompt\
        }\
    ],
    temperature=0.0,
    top_k=1,
    result_format="message"
)

if response.status_code == HTTPStatus.OK:
    print(response.output.choices[0].message.content)
else:
    print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
        response.request_id, response.status_code,
        response.code, response.message
    ))
java
import java.util.Arrays;
import java.lang.System;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.protocol.Protocol;

public class Main {
    public static GenerationResult callWithMessage() throws ApiException, NoApiKeyException, InputRequiredException {
        Generation gen = new Generation(Protocol.HTTP.getValue(), "https://dashscope.aliyuncs.com/api/v1");

        Message userMsg = Message.builder()
                .role(Role.USER.getValue())
                .content(getContent())
                .build();

        GenerationParam param = GenerationParam.builder()
                // Get API Key: https://www.alibabacloud.com/help/en/model-studio/get-api-key
                // If DASHSCOPE_API_KEY environment variable is not set, replace the next line with: .apiKey("sk-xxx")
                .apiKey(System.getenv("DASHSCOPE_API_KEY"))
                .model("tongyi-xiaomi-analysis-flash")
                .messages(Arrays.asList(userMsg))
                .temperature(0.0f)
                .topK(1)
                .resultFormat(GenerationParam.ResultFormat.MESSAGE)
                .build();
        return gen.call(param);
    }

    public static void main(String[] args) {
        try {
            GenerationResult result = callWithMessage();
            System.out.println(result.getOutput().getChoices().get(0).getMessage().getContent());
            // To view full response, uncomment the next line
            // System.out.println(JsonUtils.toJson(result));
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.err.println("Error message: "+e.getMessage());
        }
    }

    private static String getContent() {
        String dialogue ="[1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today?\n" +
                "                [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running.\n" +
                "                [3] Agent: I’m sorry for the inconvenience. Does the noise occur immediately after startup or after it’s been running for a while?\n" +
                "                [4] Customer: It starts a few seconds after turning on, and the sound is very sharp.\n" +
                "                [5] Agent: Understood. Could you please record a short video of it running and send it to our technical team for verification?\n" +
                "                [6] Customer: Sure, I’ll send it shortly.\n" +
                "                [7] Agent: Great. We’ll reply with a resolution within two hours of receiving the video.\n" +
                "                [8] Customer: If it’s confirmed as a quality issue, can I get a direct replacement?\n" +
                "                [9] Agent: Yes, if it’s verified as a quality issue, we’ll replace it free of charge and cover shipping.\n" +

        String analysisPrompt = "## Customer Service Quality Inspection: Satisfaction Assessment Rules\n" +
                "\n" +
                "### Objective\n" +

                "\n" +
                "### Assessment Workflow (Match rules top-down; stop immediately when a condition is met)\n" +
                "\n" +
                "1. **No Customer Input**\n" +
                "   - Condition: No customer utterances in the entire conversation.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "2. **Complaint or Strong Dissatisfaction**\n" +
                "   - Condition: Customer directly or indirectly mentions filing a complaint (against riders, couriers, merchants, agents, etc.), or shows clear anxiety, questioning, or complaining while following up on issue progress.\n" +
                "   - Examples:\n" +
                "     - \"I want to complain about your delivery person\"\n" +
                "     - \"Why hasn’t this been handled yet? When will it be fixed?\"\n" +
                "   - Result: **Dissatisfied** (terminate assessment immediately)\n" +
                "\n" +
                "3. **Negative Emotion in Final Utterance**\n" +
                "   - Condition: Customer’s last statement expresses negative emotion.\n" +
                "   - Result: **Dissatisfied**\n" +
                "\n" +
                "4. **No Expression of Gratitude**\n" +
                "   - Condition: Customer never says \"thank you\" or similar explicit thanks.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "5. **Explicit Satisfaction or Praise**\n" +

                "   - Result: **Satisfied** (overrides Rule 4)\n" +
                "\n" +
                "6. **Gratitude After Solution Offered**\n" +
                "   - Condition: Before closing, after the agent offers compensation, refund, or solution, the customer explicitly and positively expresses thanks.\n" +
                "   - Notes:\n" +
                "     - \"Okay\" or \"Alright\" does not count as thanks\n" +
                "     - No reply does not count as acknowledgment\n" +
                "   - Result: **Satisfied**\n" +
                "\n" +
                "7. **All Other Cases**\n" +
                "   - Condition: None of the above apply, and no complaints or clear dissatisfaction exist.\n" +
                "   - Result: **Neutral**\n" +
                "\n" +
                "### Conversation Content\n" +
                "```text\n" +
                dialogue + "\n" +
                "```\n" +
                "\n" +
                "### Output Format\n" +
                "Include two parts:\n" +
                "1. **Satisfaction Label**: Satisfied / Dissatisfied / Neutral\n" +
                "2. **Reasoning**: Brief explanation based on the rules above.\n" +
                "\n" +
                "Format:\n" +
                "```\n" +
                "Satisfaction Label#Reasoning\n" +
                "```\n" +
                "Examples:\n" +
                "```\n" +
                "Neutral#The customer expressed no thanks and showed no complaint or dissatisfaction, so the result is neutral.\n" +
                "Dissatisfied#The customer showed clear frustration and questioning while following up, matching Rule 2.\n" +
                "```";

        return analysisPrompt;
    }
}
curl
curl --location "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
    "model": "tongyi-xiaomi-analysis-flash",
    "input":{
        "messages":[\
            {\
                "role": "user",\
                "content": "Please extract key information from the following conversation: [1] Agent: Hello, welcome to AB E-commerce platform. How can I help you today? [2] Customer: Hi, I bought a food processor from your store last week, and it’s making a strange noise when running."\
            }\
        ],
        "temperature": 0.0,
        "top_k": 1
    },
    "parameters": {
        "result_format": "message"
    }
}'

Feature Examples

Each feature example below provides a ready-to-run content block. To test a feature, replace the content in the code examples with the corresponding content block from this section.

Conversation Information Extraction

Scenario Classification

Satisfaction Mining

Complex Quality Inspection

Multi-Turn Conversation Understanding

Deep Semantic Understanding

Feature description: Automatically extracts key information from unstructured conversations, such as time, location, product, issue description, and customer requests.

Use cases:

  • Auto-fill for ticketing systems

  • CRM customer profile updates

  • Issue categorization and archiving

Content example:

plaintext
Extract key information from the following conversation and output in JSON format.

Conversation:
```
[1] Agent: Hello, I’m Xiao Wang. How can I help you?
[2] Customer: Hi, I bought an iPhone 15 last Wednesday at your Xinjiekou store in Nanjing. My order number is 123456789, and now the screen looks yellowish.
[3] Agent: Got it. May I have your mobile phone number?
[4] Customer: 138****5678
[5] Agent: Received. I’ve found your order. Regarding the yellowish screen, when did you first notice it?
[6] Customer: During normal use, especially when viewing white backgrounds—it’s very obvious.
```

Information to extract:
1. Purchase time
2. Store location
3. Product name
4. Order number
5. Customer contact information
6. Issue description
7. Context where issue was noticed

Output format (JSON):
```json
{{
"Purchase Time": "...",
"Store Location": "...",
"Product Name": "...",
"Order Number": "...",
"Customer Contact Information": "...",
"Issue Description": "...",
"Context Where Issue Was Noticed": "..."
}}
```

Note: If any field is not mentioned in the conversation, fill in "Not mentioned".

Feature description: Automatically identifies the business scenario of a conversation and supports custom scenario categories.

Use cases:

  • Automatic routing of conversations to specialized teams

  • Tracking consultation volume by scenario

  • Targeted service process optimization

Content example:

plaintext
Determine which business scenario the following conversation belongs to.

Conversation:
```
[1] Agent: Hello, welcome to our customer service hotline. How can I help you?
[2] Customer: I’d like to know what promotions you have for members.
[3] Agent: Currently, new members get 20% off their first month, and existing members earn points for referring friends.
[4] Customer: How do I sign up for membership?
[5] Agent: You can register through our app or mini program by filling in basic information.
[6] Customer: Got it, thanks.
```

Available scenario categories:
1. Pre-sales Inquiry – Customer asks about product features, pricing, or purchase methods
2. Post-sales Complaint – Customer reports product issues, service dissatisfaction, or requests returns/exchanges
3. Logistics Inquiry – Customer asks about order status, delivery progress, or shipping details
4. Membership Services – Customer inquires about membership benefits, points, or promotions
5. Technical Support – Customer seeks help with product usage or troubleshooting
6. Account Issues – Customer reports login, password, or account security problems

Output format:
```
Scenario Category: [Select one from the list above]
Confidence Level: [High/Medium/Low]
Reasoning: [Brief justification in 1–2 sentences]
```

Feature description: Determines customer satisfaction based on custom rules and supports multi-dimensional evaluation.

Use cases:

  • Agent performance evaluation

  • Service quality monitoring

  • Customer experience improvement

Content example:

plaintext
Assess customer satisfaction based on the following conversation.

Conversation:
```
[1] Agent: Hello, I’m customer service agent Xiao Li. How can I help you?
[2] Customer: Why hasn’t my order shipped yet? It’s been three days!
[3] Agent: I sincerely apologize for the inconvenience. Let me check right away. May I have your order number?
[4] Customer: 1234567890
[5] Agent: Found it. Due to recent logistics peak, shipping is delayed. I’ll escalate this to the warehouse for urgent processing—guaranteed to ship today.
[6] Customer: When will it arrive?
[7] Agent: Estimated delivery in 3–5 business days. As an apology, I’ve added a 20 CNY coupon to your account for your next purchase.
[8] Customer: Alright, just make sure it ships soon.
[9] Agent: Absolutely! I’ll monitor your order closely and notify you immediately once shipped. Anything else I can assist with?
[10] Customer: No.
```

Satisfaction criteria:
1. **Dissatisfied**: Customer explicitly complains, expresses dissatisfaction, or demands compensation/refund
2. **Neutral**: Issue resolved but no thanks or acknowledgment, or customer shows reservation about the solution
3. **Satisfied**: Customer explicitly thanks, acknowledges service, or accepts the solution positively

Evaluation dimensions:
- Customer emotion (initial vs. ending state)
- Issue resolution status (was a solution provided?)

- Compensation offered (any extra incentives or discounts?)

Output format:
```
Satisfaction Level: [Satisfied/Neutral/Dissatisfied]
Initial Emotion: [Describe customer’s initial emotional state]
Ending Emotion: [Describe customer’s emotional state at conversation end]
Issue Resolved: [Yes/No/Partially]
Reasoning: [Detailed justification based on evaluation dimensions]
```

Feature description: Supports complex inspection rules involving nested conditions and logical reasoning to accurately enforce organization-specific quality standards.

Use cases:

  • Highly regulated industries, such as finance and healthcare

  • Multi-step business process validation

  • Complex script compliance checks

Content example:

plaintext
Perform quality inspection on the following financial industry customer service conversation based on the rules below.

Conversation:
```
[1] Agent: Hello, welcome to XX Bank Credit Card Center. I’m agent Xiao Zhang, ID 8888. How can I help you?
[2] Customer: I’d like to increase my credit card limit.
[3] Agent: Sure. May I have your name and ID number?
[4] Customer: My name is Alice, ID 110101199001011234.
[5] Agent: Thank you, Mr. Alice. Your current limit is 20,000 CNY. Based on your usage history and credit score, we can raise it to 50,000 CNY. Would you like to proceed?
[6] Customer: Yes, please.
[7] Agent: Confirming: your credit limit will be increased from 20,000 CNY to 50,000 CNY, effective immediately. Do you confirm?
[8] Customer: Confirmed.
[9] Agent: Submitted. Processing will complete within 2 business days. Thank you for calling. Have a great day!
```

Quality inspection rules (must be strictly enforced):

**1. Opening Script (Mandatory)**
- Rule 1: Must include “Hello” or “Welcome”
- Rule 2: Must state agent ID
- Rule 3: Must specify department (e.g., “XX Bank Credit Card Center”)
- **Verdict**: All three must be satisfied to pass

**2. Identity Verification (Mandatory)**
- Rule 4: For account-related actions, must verify customer identity (name + ID number OR name + card number)
- **Verdict**: Failure to verify during account action = critical violation

**3. Critical Information Disclosure (Mandatory)**
- Rule 5: For limit adjustments, rate changes, or product modifications, must:
  - Clearly state pre- and post-change details
  - Disclose effective time
  - Obtain explicit customer confirmation (“yes”, “confirmed”, “agree”, etc.)
- **Verdict**: Missing any item = critical violation

**4. Closing Script (Recommended)**
- Rule 6: Should include expression of thanks
- Rule 7: Should include well-wishes
- **Verdict**: Failure affects scoring but not overall pass/fail

**Output format**:
```
Inspection Result: [Pass/Fail]
Number of Violations: [Number]

Detailed Check:
1. Opening Script: [Pass/Fail] - [Explanation]
2. Identity Verification: [Pass/Fail] - [Explanation]
3. Critical Information Disclosure: [Pass/Fail] - [Explanation]
4. Closing Script: [Pass/Fail (Recommended)] - [Explanation]

Summary: [1–2 sentence evaluation]
```

Feature description: Automatically links different parts of a dialogue to accurately interpret references and contextual dependencies.

Use cases:

  • Conversation analysis for complex workflows

  • Intent recognition in long dialogues

  • Context-aware information extraction

Content example:

plaintext
Extract complete ticket information from the following conversation by integrating scattered details across multiple turns.

Conversation:
```
[1] Agent: Hello, how can I help you?
[2] Customer: The router I bought last week keeps disconnecting.
[3] Agent: Which model did you purchase?
[4] Customer: AX3000, the white one.
[5] Agent: Noted. How often does it disconnect?
[6] Customer: Every 2–3 hours, which really disrupts my work.
[7] Agent: When did this start?
[8] Customer: Just these past two days—it worked fine before.
[9] Agent: Have you moved the router or changed any settings recently?
[10] Customer: No, it’s still in the living room, and settings haven’t changed.
[11] Agent: This might be due to an outdated firmware version. I suggest upgrading the firmware first.
[12] Customer: How do I upgrade?
[13] Agent: Open our app on your phone, find this device, and tap “Firmware Upgrade.”
[14] Customer: Okay, I’ll try now.
[15] Agent: The upgrade takes about 5 minutes—network will disconnect during this time. Don’t power off the router.
[16] Customer: Will it reconnect automatically after the upgrade?
[17] Agent: Yes, it will restart automatically, then just reconnect to Wi-Fi.
[18] Customer: What if it still disconnects after the upgrade?
[19] Agent: If the issue persists, it may be a hardware fault. We’ll arrange a replacement or on-site repair.
[20] Customer: Got it. Thanks.
```

Extract the following information (note: details are scattered across turns—use context to link them):

1. **Product Details** (model, appearance, purchase time)
2. **Issue Description** (symptoms, frequency)
3. **Timeline** (when it started, prior status)
4. **Customer Actions** (any special operations or adjustments)
5. **Agent Diagnosis** (initial suspected cause)
6. **Proposed Solution** (recommended steps)
7. **Contingency Plan** (alternative if solution fails)

Output in structured format and indicate which turns each piece of information comes from.

Feature description: Accurately identifies implicit meaning, emotional tone, and implied intent in conversations.

Use cases:

  • Customer sentiment monitoring

  • Early warning for potential complaints

  • Sales opportunity identification

Content example:

plaintext
Perform deep semantic analysis on the following conversation.

Conversation:
```
[1] Agent: Hello, how can I help you?
[2] Customer: Why did my membership expire suddenly? It was working last month.
[3] Agent: Let me check. May I have your phone number?
[4] Customer: 138****5678
[5] Agent: Your annual membership expired on October 15 last year.
[6] Customer: Oh, I see.
[7] Agent: Member-exclusive coupons become invalid after expiration. But you can renew your membership to restore them.
[8] Customer: Alright, I understand.
[9] Agent: Anything else I can assist with?
[10] Customer: No, thanks.
```

Analysis dimensions:

1. **Customer Emotion Analysis**
   - Turn 2: “Why did my membership expire suddenly? It was working last month.” — What is the emotion and implied meaning?
   - Turn 6: “Oh, I see.” — How has the emotion shifted?
   - Turn 8: “Alright, I understand.” — What is the true sentiment?

2. **Potential Issue Identification**
   - Is the customer dissatisfied?
   - Is there risk of a complaint?
   - Does the customer misunderstand service rules?

3. **True Customer Needs**
   - What matters most to the customer?
   - Was the issue resolved satisfactorily?
   - Are there unspoken needs?

4. **Improvement Suggestions**
   - Was the agent’s response appropriate?
   - How could the interaction be improved to boost satisfaction?

Output format: Provide clear analysis results for each of the four dimensions above.

API Reference

For information about model input and output parameters, see Qwen.

Previous: Mathematical capabilities (Qwen-Math)Next: Audio understanding (Qwen3-Omni-Captioner)

Is this page helpful?

Core Features

Applicability

Model Selection Guide

Getting Started

Best Practices

Code Examples

Feature Examples

API Reference

Contact Us

Sales Support

Live-chat with our sales team or get in touch with a business development professional in your region.

Contact Sales

Technical Support

Open a ticket and get quick help from our technical team.

Open a Ticket >

Connect & Report Abuse

We look forward to your suggestion.

Post a Suggestion > Report Abuse >

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

\ \ Hi, I'm Alibaba Cloud AI Assistant!\ \ I can help with questions and solutions.

Why Alibaba Cloud

About Alibaba Cloud

Asia Accelerator

Our Global Network

Global Offices

Trust Center

Case Studies

Analyst Reports

Products & Pricings

Pricing Calculator

ECS

SAS

Model Studio

Database

Security

SMS

Solutions

Financial Services

Retail Services

Media Services

Gaming Services

ISV Solutions

Engage

Developer Community

Partner Network

Startups

Marketplace

Join Alibaba Cloud

Resources & Support

Developer Learning Hub

Documentation Center

Training & Certification

Service Notices

Submit a Ticket

Security Report

Qwen Cloud

Careers About Us Privacy Policy Legal Integrity Compliance Reporting Channel Service Notices Links

© 2009-2026 Copyright by Alibaba Cloud All rights reserved

© 2009-2026 Copyright by Alibaba Cloud All rights reserved

Careers About Us Privacy Policy Legal Integrity Compliance Reporting Channel Service Notices Links