这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: The resultVariable be removed after executeLLMInstruction. #4652

@playerC

Description

@playerC

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

I use Tencent Hunyuan-lite with openAPI interface.

Part of my Agentflow.

   {
      "type": "start",
      "config": {
        "variables": [
          {
            "name": "keywords",
            "value": ""
          },
          {
            "name": "ResponseText",
            "value": "1"
          }
        ]
      }
    },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "## Rules:\n\n- add the  title  before the JSON output.\n    title : `Online Search Result of  \"${keywords}\"` \n- Only keep the data under all `<item>` tags.\n- Use `item` as root object in output JSON .\n- The information under each `<item>` tag is described as follows:\n\n   Title (title);\n   Web link (link);\n   Description (description);\n   Publish time (pubDate);\n\n- output example :\n\n```\n## Online Search Result of \"AI\"\n```JSON\n{\nitem :[...]\n}\n```\n```\n\nPlease output the following RSS content in JSON format according to the rules:\n\n```\n${ResponseText}\n```",
        "resultVariable": "ResponseText",
        "directOutput": true
      }
    }

After executeLLMInstruction , it returns NULL , and the NULL is set to ResponseText , just like it remove the var.
and I can't use the var ResponseText in next step.

After adding some log , I found that:

The completion object don't have the result member, it have 'textResponse'

And I add this code before return ,it works fine.

if (completion["textResponse"]){
completion["result"] =completion.textResponse;
}

But I don't know if it is correct. please check.

Are there known steps to reproduce?

AnythingLLM Desktop APP , v1.9.0.

Create a Agentflow , just like this:

 {
      "type": "start",
      "config": {
        "variables": [
          {
            "name": "keywords",
            "value": ""
          },
          {
            "name": "ResponseText",
            "value": "1"
          }
        ]
      }
    },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "This var will be replaced with 1 , ${ResponseText}",
        "resultVariable": "ResponseText",
        "directOutput": NULL
      },
    {
      "type": "llmInstruction",
      "config": {
        "instruction": "This var will not be replaced ${ResponseText}",
        "resultVariable": "",
        "directOutput": true
      }
    }

The second instruction use the resultVariable from the first one ,will not be replaced .

Metadata

Metadata

Assignees

No one assigned

    Labels

    possible bugBug was reported but is not confirmed or is unable to be replicated.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions