You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rasa 3天气聊天机器人训练报错:YAML语法与Slot映射问题

解决Rasa 3天气机器人训练报错问题

一、修复nlu.yml的YAML语法错误

报错源于三处问题:

  1. 带实体标注([]()格式)的句子未加引号,YAML解析器误将方括号识别为序列起始符;
  2. intent:city_info的冒号后缺少空格,违反YAML语法规范;
  3. 部分实体标注存在空格(如[Mumbai] (location)),会导致实体识别失效。

修改后的nlu.yml关键部分代码:

- intent: weather_for_location
  examples:
    - "what is the weather in [Noida](location)"
    - "what is the weather in [New Delhi](location)"
    - "weather of [Mumbai](location)"
    - "Today's weather in [Bangalore](location)"
    - "[Kolkata](location) weather"
    - "Tell me weather of [Hyderabad](location)"
    - "Can you tell me weather of [London](location)"

- intent: city_info
  examples:
    - "[New Delhi](location)"
    - "[India](location)"
    - "[Mumbai](location)"
    - "[Noida](location)"
    - "[Kolkata](location)"
    - "[Bangalore](location)"
    - "[London](location)"

二、修复domain.yml的槽映射无效问题

Rasa 3要求槽映射必须遵循指定格式,不能直接使用键值对。由于location槽需要从同名实体提取值,需将映射类型设置为from_entity。

修改后的domain.yml中slots部分代码:

slots:
  location:
    type: text
    mappings:
      - type: from_entity
        entity: location
    influence_conversation: false

内容的提问来源于stack exchange,提问作者Nisarg Kudgunti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 18:40:18