AI Intent Recognition Workflow with LLMs

ML & AI · flowchart diagram · NOASSERTION

This flowchart illustrates a sophisticated AI-driven intent recognition process, detailing how an LLM identifies core questions, generates discussion outli

Source: https://github.com/lanzeweie/ASR-interview-coder-llm/blob/cad6297ac1dc16063215e57c175239b2019d44ab/README/Mermaid.md
Curated by lanzeweie
AI LLM Intent Recognition Flowchart Conversational AI System Design Natural Language Processing

Mermaid source

flowchart TD
    Start([阶段2:意图识别启动<br/>前提:阶段1判定需要AI介入<br/>且用户开启意图识别]) --> CheckAgent{Agent可用?}

    CheckAgent -- 否 --> Fallback[使用默认意图<br/>技术讨论/决策咨询/问题解决]
    CheckAgent -- 是 --> BuildIntentPrompt[构建意图识别提示<br/>包含对话内容和主人公信息]

    BuildIntentPrompt --> CallIntentModel[调用小模型<br/>提取核心问题和讨论大纲]

    subgraph IntentDetails [意图识别详细流程]
        direction TB
        ExtractCore[1. 识别核心问题<br/>提取对话中的主要讨论话题]
        ExtractOutline[2. 生成讨论大纲<br/>列出关键要点和子话题]
        ExtractEntities[3. 提取实体信息<br/>涉及的技术、概念、决策点]
    end

    CallIntentModel --> ParseIntentJSON[解析JSON响应]

    subgraph ParseProcess [解析过程]
        direction TB
        ExtractJSON[提取JSON对象<br/>使用正则匹配]
        ValidateJSON[验证JSON格式<br/>检查必要字段]
        ReturnResult[返回结构化结果<br/>包含core_question和outline]
    end

    ParseIntentJSON --> Success{解析成功?}
    Success -- 是 --> ReturnIntent[返回意图识别结果<br/>传递给阶段3分发准备]
    Success -- 否 --> LogError[记录解析错误]

    ReturnIntent --> End([意图识别完成<br/>传递给智囊团/单模型])
    LogError --> Fallback
    Fallback --> End

    %% 配置参数
    subgraph IntentConfig [⚙️ 意图识别配置]
        direction LR
        Config1["启用开关:intent_recognition_enabled"]
        Config2["模型选择:本地/云端API"]
        Config3["上下文长度:最大50条消息"]
        Config4["输出格式:JSON (core_question + outline)"]
    end

    %% 样式定义
    style Start fill:#e1f5fe
    style CheckAgent fill:#e1f5fe
    style Success fill:#e1f5fe

    style ReturnIntent fill:#c8e6c9
    style Fallback fill:#fff3e0
    style LogError fill:#ffcdd2
    style End fill:#ffcdd2
    style CallIntentModel fill:#8B4513
    style IntentDetails fill:#f1f8e9,stroke:#4caf50,stroke-width:2px
    style ParseProcess fill:#f1f8e9,stroke:#4caf50,stroke-width:2px

What this diagram shows

This diagram outlines a multi-step intent recognition process initiated when AI intervention is needed and intent recognition is enabled. It first checks for Agent availability, falling back to default intents if none. If an Agent is available, it constructs a prompt with dialogue context and user information, then calls a small language model to perform core question identification, discussion outline generation, and entity extraction. The model's JSON response is then parsed and validated, returning structured intent results for subsequent stages or logging errors and falling back to defaults if parsing fails. It also highlights key configuration parameters.

When to use it

Ideal for applications requiring dynamic understanding of user intent, such as intelligent chatbots, conversational AI platforms, customer support systems, or knowledge management tools where user queries need to be categorized and structured for appropriate responses or task routing.

How to adapt it for your project

This workflow can be adapted by integrating different LLM providers, customizing the prompt engineering for specific domains, adding more sophisticated fallback mechanisms, incorporating sentiment analysis, or expanding the entity extraction capabilities. The parsing logic can be made more robust with schema validation, and the configuration parameters can be extended to include model-specific settings or A/B testing options.

Key concepts