Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

工具选择+文本内容提取,有时能成功有时候不行 #3017

Open
2 of 7 tasks
joveth1 opened this issue Oct 29, 2024 · 2 comments
Open
2 of 7 tasks

工具选择+文本内容提取,有时能成功有时候不行 #3017

joveth1 opened this issue Oct 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@joveth1
Copy link

joveth1 commented Oct 29, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已完整查看过项目 README,以及项目文档
  • 我使用了自己的 key,并确认我的 key 是可正常使用的
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • 公有云版本
  • 私有部署版本, 具体版本号:

问题描述, 日志截图

工具选择+文本内容提取无法提取想要的字段

根据用户输入提取多个字段,但是大多数情况下无法提取正确的字段,极少数情况下能成功,我在本地版(4.8.12)测试中一次都没成功,用了云版本第一次成功,后面关了页面再进去也没有成功过了 ^^!。

用工具选择,是因为有多个工具(目前测试只搞了一个),这是其中的一个工具,有多个参数,比如充值金额、缴费系统、房间号等。

另外问一下,不知道用户会怎么问,他可能会说电费充值100元等,后续的字段需要引导用户选择具体的电费系统、房间号等,这些应该怎么做呢?尝试过用工具自定义参数,但是这个参数它会给默认的值(这个值有的时候是未知,有的时候是unsigned,总之意外情况很多)

截图见最后

复现步骤

下面是我的配置


{
  "nodes": [
    {
      "nodeId": "userGuide",
      "name": "common:core.module.template.system_config",
      "intro": "common:core.module.template.system_config_info",
      "avatar": "core/workflow/template/systemConfig",
      "flowNodeType": "userGuide",
      "position": {
        "x": 262.2732338817093,
        "y": -476.00241136598146
      },
      "version": "481",
      "inputs": [
        {
          "key": "welcomeText",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "string",
          "label": "core.app.Welcome Text",
          "value": ""
        },
        {
          "key": "variables",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "core.app.Chat Variable",
          "value": []
        },
        {
          "key": "questionGuide",
          "valueType": "boolean",
          "renderTypeList": [
            "hidden"
          ],
          "label": "core.app.Question Guide",
          "value": false
        },
        {
          "key": "tts",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": {
            "type": "web"
          }
        },
        {
          "key": "whisper",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": {
            "open": false,
            "autoSend": false,
            "autoTTSResponse": false
          }
        },
        {
          "key": "scheduleTrigger",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": null
        }
      ],
      "outputs": []
    },
    {
      "nodeId": "448745",
      "name": "common:core.module.template.work_start",
      "intro": "",
      "avatar": "core/workflow/template/workflowStart",
      "flowNodeType": "workflowStart",
      "position": {
        "x": 632.368838596004,
        "y": -347.7446492944009
      },
      "version": "481",
      "inputs": [
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "common:core.module.input.label.user question",
          "required": true,
          "toolDescription": "用户问题",
          "debugLabel": ""
        }
      ],
      "outputs": [
        {
          "id": "userChatInput",
          "key": "userChatInput",
          "label": "common:core.module.input.label.user question",
          "type": "static",
          "valueType": "string",
          "description": ""
        }
      ]
    },
    {
      "nodeId": "u7csVpo5JTG9",
      "name": "工具调用",
      "intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
      "avatar": "core/workflow/template/toolCall",
      "flowNodeType": "tools",
      "showStatus": true,
      "position": {
        "x": 943.0044641225234,
        "y": -485.13264854317566
      },
      "version": "481",
      "inputs": [
        {
          "key": "model",
          "renderTypeList": [
            "settingLLMModel",
            "reference"
          ],
          "label": "AI 模型",
          "valueType": "string",
          "llmModelType": "all",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": "",
          "selectedTypeIndex": 0,
          "value": "qwen-turbo"
        },
        {
          "key": "temperature",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 0,
          "valueType": "number",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "maxToken",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 4000,
          "valueType": "number",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "aiChatVision",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "boolean",
          "value": true,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "systemPrompt",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "max": 3000,
          "valueType": "string",
          "label": "提示词",
          "description": "core.app.tip.systemPromptTip",
          "placeholder": "core.app.tip.chatNodeSystemPromptTip",
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": "",
          "value": ""
        },
        {
          "key": "history",
          "renderTypeList": [
            "numberInput",
            "reference"
          ],
          "valueType": "chatHistory",
          "label": "聊天记录",
          "description": "workflow:max_dialog_rounds",
          "required": true,
          "min": 0,
          "max": 50,
          "value": 6,
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "用户问题",
          "toolDescription": "用户输入的问题(问题需要完善)",
          "required": true,
          "value": [
            "448745",
            "userChatInput"
          ],
          "valueDesc": "",
          "description": "",
          "debugLabel": ""
        }
      ],
      "outputs": [
        {
          "id": "answerText",
          "key": "answerText",
          "label": "common:core.module.output.label.Ai response content",
          "description": "将在 stream 回复完毕后触发",
          "valueType": "string",
          "type": "static"
        }
      ]
    },
    {
      "nodeId": "cUOUVD5oq4uB",
      "name": "文本内容提取",
      "intro": "当问电费,电费查询,查询电费,电费缴费,电费交费,电费充值,电费充值xx元,充值电费,交电费,缴电费时,请使用这个工具",
      "avatar": "core/workflow/template/extractJson",
      "flowNodeType": "contentExtract",
      "showStatus": true,
      "position": {
        "x": 872.368838596004,
        "y": 329.3774338526471
      },
      "version": "481",
      "inputs": [
        {
          "key": "model",
          "renderTypeList": [
            "selectLLMModel",
            "reference"
          ],
          "label": "AI 模型",
          "required": true,
          "valueType": "string",
          "llmModelType": "extractFields",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": "",
          "selectedTypeIndex": 0,
          "value": "qwen-turbo"
        },
        {
          "key": "description",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "valueType": "string",
          "label": "提取要求描述",
          "description": "workflow:extraction_requirements_description_detail",
          "placeholder": "workflow:extraction_requirements_placeholder",
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": "",
          "value": "你是一个电费缴费助手,从文本中提取出充值金额、电费系统"
        },
        {
          "key": "history",
          "renderTypeList": [
            "numberInput",
            "reference"
          ],
          "valueType": "chatHistory",
          "label": "聊天记录",
          "description": "workflow:max_dialog_rounds",
          "required": true,
          "min": 0,
          "max": 50,
          "value": 6,
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "content",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "label": "需要提取的文本",
          "required": true,
          "valueType": "string",
          "toolDescription": "需要检索的内容",
          "valueDesc": "",
          "description": "",
          "debugLabel": ""
        },
        {
          "key": "extractKeys",
          "renderTypeList": [
            "custom"
          ],
          "label": "",
          "valueType": "any",
          "description": "workflow:target_fields_description",
          "value": [
            {
              "valueType": "number",
              "required": true,
              "defaultValue": "",
              "desc": "充值金额",
              "key": "amount",
              "enum": ""
            },
            {
              "valueType": "string",
              "required": true,
              "defaultValue": "",
              "desc": "电费系统",
              "key": "elesys",
              "enum": ""
            }
          ],
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        }
      ],
      "outputs": [
        {
          "id": "success",
          "key": "success",
          "label": "workflow:full_field_extraction",
          "required": true,
          "description": "提取字段全部填充时返回 true (模型提取或使用默认值均属于成功)",
          "valueType": "boolean",
          "type": "static"
        },
        {
          "id": "fields",
          "key": "fields",
          "label": "workflow:complete_extraction_result",
          "required": true,
          "description": "一个 JSON 字符串,例如:{\"name:\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",
          "valueType": "string",
          "type": "static"
        },
        {
          "id": "gYIGUKV72WvO",
          "key": "amount",
          "label": "提取结果-充值金额",
          "valueType": "number",
          "type": "static"
        },
        {
          "id": "oUc4z0kUq47W",
          "key": "elesys",
          "label": "提取结果-电费系统",
          "valueType": "string",
          "type": "static"
        }
      ]
    },
    {
      "nodeId": "ogB3PZnzIEni",
      "name": "指定回复",
      "intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
      "avatar": "core/workflow/template/reply",
      "flowNodeType": "answerNode",
      "position": {
        "x": 1670.3994413969426,
        "y": 553.7121040435047
      },
      "version": "481",
      "inputs": [
        {
          "key": "text",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "valueType": "any",
          "required": true,
          "label": "回复的内容",
          "description": "common:core.module.input.description.Response content",
          "placeholder": "common:core.module.input.description.Response content",
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": "",
          "selectedTypeIndex": 1,
          "value": [
            "cUOUVD5oq4uB",
            "fields"
          ]
        }
      ],
      "outputs": []
    },
    {
      "nodeId": "fc0WwtNYh1pA",
      "name": "工具调用终止",
      "intro": "该模块需配置工具调用使用。当该模块被执行时,本次工具调用将会强制结束,并且不再调用AI针对工具调用结果回答问题。",
      "avatar": "core/workflow/template/stopTool",
      "flowNodeType": "stopTool",
      "position": {
        "x": 1693.28882911292,
        "y": 935.6991145833297
      },
      "version": "481",
      "inputs": [],
      "outputs": []
    }
  ],
  "edges": [
    {
      "source": "448745",
      "target": "u7csVpo5JTG9",
      "sourceHandle": "448745-source-right",
      "targetHandle": "u7csVpo5JTG9-target-left"
    },
    {
      "source": "u7csVpo5JTG9",
      "target": "cUOUVD5oq4uB",
      "sourceHandle": "selectedTools",
      "targetHandle": "selectedTools"
    },
    {
      "source": "cUOUVD5oq4uB",
      "target": "ogB3PZnzIEni",
      "sourceHandle": "cUOUVD5oq4uB-source-right",
      "targetHandle": "ogB3PZnzIEni-target-left"
    },
    {
      "source": "cUOUVD5oq4uB",
      "target": "fc0WwtNYh1pA",
      "sourceHandle": "cUOUVD5oq4uB-source-right",
      "targetHandle": "fc0WwtNYh1pA-target-left"
    }
  ],
  "chatConfig": {
    "welcomeText": "[电费充值1元]",
    "variables": [],
    "scheduledTriggerConfig": {
      "cronString": "",
      "timezone": "Asia/Shanghai",
      "defaultPrompt": ""
    },
    "_id": "672096faea477bde2cdb5843"
  }
}

预期结果

提取到想要的值

相关截图

不成功的截图,多数情况下无法提取到想要的值。

image

偶尔能成功的截图,成功次数非常少,怀疑跟文本提取模型有关

1730189196828_B7FCA83E-90A4-47f5-9118-8A13B434C96B

@joveth1 joveth1 added the bug Something isn't working label Oct 29, 2024
@lijiajun1997
Copy link

AI模型为啥要选用户问题?

@joveth1
Copy link
Author

joveth1 commented Oct 30, 2024

AI模型为啥要选用户问题?

这里做过很多尝试,一开始用的室qwen-turbo模型,发现不行,后续换成用户问题,工具AI回答等,都没成功,截图的时候,可能截的时候正好尝试了用户问题。

补一张模型图一样效果:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants